forked from guardian/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
147 lines (102 loc) · 3.72 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Targets marked '# PRIVATE' will be hidden when running `make help`.
# They're helper targets that you probably only need to know about
# if you've got as far as reading the makefile.
# Lists common tasks.
# Also the default task (`make` === `make help`).
help:
@node tools/messages.js describeMakefile
# Lists *all* targets.
list: # PRIVATE
@node tools/messages.js describeMakefile --all
# *********************** SETUP ***********************
# Install all 3rd party dependencies.
install: check-node-env
@yarn -s install
@cd ui && yarn -s install
@cd dev/eslint-plugin-guardian-frontend && yarn -s install
@cd tools/amp-validation && yarn -s install
# Remove all 3rd party dependencies.
uninstall: # PRIVATE
@rm -rf node_modules
@rm -rf ui/node_modules
@rm -rf dev/eslint-plugin-guardian-frontend/node_modules
@rm -rf tools/amp-validation/node_module
@echo 'All 3rd party dependencies have been uninstalled.'
# Reinstall all 3rd party dependencies from scratch.
# The nuclear option if `make install` hasn't worked.
reinstall: uninstall install
# Make sure the local node env is up to scratch.
check-node-env: # PRIVATE
@./tools/check-node-env.js
# *********************** DEVELOPMENT ***********************
# Watch and automatically compile/reload all JS/SCSS.
# Uses port 3000 insead of 9000.
watch: compile-watch
@./dev/watch.js
# *********************** ASSETS ***********************
# Compile all assets in production.
compile: install
@./tools/task-runner/runner compile
# Compile all assets in development.
compile-dev: install
@./tools/task-runner/runner compile --dev
# Compile atom-specific JS
compile-atoms: install
@./tools/task-runner/runner compile/javascript/index.atoms
# Compile all assets for watch.
compile-watch: install # PRIVATE
@./tools/task-runner/runner compile/index.watch
compile-javascript: install # PRIVATE
@./tools/task-runner/runner compile/javascript
compile-javascript-dev: install # PRIVATE
@./tools/task-runner/runner compile/javascript --dev
compile-css: install # PRIVATE
@./tools/task-runner/runner compile/css
compile-images: install # PRIVATE
@./tools/task-runner/runner compile/images
compile-svgs: install # PRIVATE
@./tools/task-runner/runner compile/inline-svgs
compile-fonts: install # PRIVATE
@./tools/task-runner/runner compile/fonts
# *********************** CHECKS ***********************
# Run the JS test suite.
test: install
@./tools/task-runner/runner test/javascript --verbose
# Run the modern JS test suite in watch mode.
test-watch: install
@yarn test -- --watch --coverage
# Check the JS test suite coverage.
coverage: install
@./tools/task-runner/runner test/javascript/coverage --stdout
# Validate all assets.
validate: install
@./tools/task-runner/runner validate --verbose
# Validate all SCSS.
validate-sass: install # PRIVATE
@./tools/task-runner/runner validate/sass --verbose
# Validate all JS.
validate-javascript: install # PRIVATE
@./tools/task-runner/runner validate/javascript
# Fix JS linting errors.
fix: install
@./tools/task-runner/runner validate/javascript-fix
# Fix committed JS linting errors.
fix-commits: install
@./tools/task-runner/runner validate-head/javascript-fix
validate-amp: install # PRIVATE
@cd tools/amp-validation && npm install && NODE_ENV=dev node index.js
validate-a11y: install # PRIVATE
@./tools/task-runner/runner validate/a11y
# Take screenshots for a visual check.
screenshots: install
@./tools/task-runner/runner screenshot
# *********************** MISC ***********************
es6: install
@node ./tools/es5to6.js ${file}
# *********************** UI ***********************
ui-compile: install
@cd ui && yarn -s compile
ui-watch-nashorn: install
@cd ui && yarn -s watch:nashorn
ui-watch: install
@cd ui && yarn -s watch