-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaskfile.yml
299 lines (260 loc) · 7.79 KB
/
Taskfile.yml
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
version: '3'
env:
PHP_BIN: '{{.PHP_BIN | default "$(which php)"}}'
COMPOSER_BIN: '{{.COMPOSER_BIN | default "$(which composer)"}}'
NODE_BIN: '{{.NODE_BIN | default "$(which node)"}}'
YARN_BIN: '{{.YARN_BIN | default "$(which yarn)"}}'
vars:
CONFIG_DIR: '{{.TASKFILE_DIR}}/config'
COMPOSER_BIN_DIR: '{{.TASKFILE_DIR}}/vendor/bin'
NODEJS_BIN_DIR: '{{.TASKFILE_DIR}}/node_modules/.bin'
tasks:
default:
cmd: 'task --list-all'
composer:
label: Composer
desc: Runs 'composer' command.
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN}} {{.CLI_ARGS}}'
drush:
label: Drush
desc: Runs 'drush' command.
requires:
vars:
- COMPOSER_BIN_DIR
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN_DIR}}/drush {{.CLI_ARGS}}'
phpstorm-meta:
label: PHPStorm metadata
desc: Generates PHPStorm metadata.
cmds:
- task: drush
vars: { CLI_ARGS: 'generate -y phpstorm-meta' }
phpcs:
label: PHPCS
desc: Runs 'phpcs' command.
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN_DIR}}/phpcs -ps --colors --standard={{.CONFIG_DIR}}/phpcs.xml {{.CLI_ARGS}}'
phpcbf:
label: PHPCBF
desc: Runs 'phpcbf' command.
# @see https://github.com/squizlabs/PHP_CodeSniffer/issues/1818
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN_DIR}}/phpcbf -ps --colors --standard={{.CONFIG_DIR}}/phpcs.xml {{.CLI_ARGS}} || if [ $? -eq 1 ]; then exit 0; fi'
phpstan:
label: PHPStan
desc: Runs 'phpstan' command.
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN_DIR}}/phpstan --configuration={{.CONFIG_DIR}}/phpstan.neon {{.CLI_ARGS}}'
parallel-lint:
label: PHP Parallel lint
desc: Runs 'parallel-lint' command.
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN_DIR}}/parallel-lint {{.CLI_ARGS}}'
phpunit:
label: PHPUnit
desc: Runs 'phpunit' command.
vars:
SUITE: '{{if .SUITE}}--testsuite={{.SUITE}}{{end}}'
cmd: '{{.PHP_BIN}} {{.COMPOSER_BIN_DIR}}/phpunit --configuration={{.CONFIG_DIR}}/phpunit.xml {{.SUITE}} {{.CLI_ARGS}}'
yarn:
label: yarn
desc: Runs 'yarn' command.
cmd: '{{.YARN_BIN}} {{.CLI_ARGS}}'
eslint:
label: ESLint
desc: Runs 'eslint' command.
cmd: '{{.NODE_BIN}} {{.NODEJS_BIN_DIR}}/eslint {{.CLI_ARGS}}'
stylelint:
label: Stylelint
desc: Runs 'stylelint' command.
cmd: '{{.NODE_BIN}} {{.NODEJS_BIN_DIR}}/stylelint {{.CLI_ARGS}}'
cspell:
label: CSPell
desc: Runs 'cspell' command.
cmd: '{{.NODE_BIN}} {{.NODEJS_BIN_DIR}}/cspell {{.CLI_ARGS}}'
install:
desc: Install website.
summary: Installs a website with a demo content for development and testing.
prompt: |
This command will delete current database and install a fresh website.
All unsaved data will be permanently lost.
Are you sure?
cmds:
- task: composer
vars: { CLI_ARGS: 'install' }
- task: drush
vars: { CLI_ARGS: 'site:install -y --existing-config' }
- task: drush
vars: {CLI_ARGS: 'pm:install niklan_dev -y'}
- task: drush
vars: { CLI_ARGS: 'deploy:mark-complete -y' }
- task: phpstorm-meta
- task: drush
vars: { CLI_ARGS: 'user:login --uid=1' }
validate:
label: Project validation
desc: Validates project files.
cmds:
- task: validate/composer
- task: validate/phplint
- task: validate/phpcs
- task: validate/phpstan
- task: validate/js
- task: validate/css
- task: validate/yml
- task: validate/spellcheck
validate/composer:
label: Composer validation
desc: Validates composer.json file and checks platform requirements.
cmds:
- task: composer
vars: { CLI_ARGS: 'validate --strict' }
- task: composer
vars: { CLI_ARGS: 'check-platform-req' }
validate/phplint:
label: PHP linter
desc: Lints PHP files.
aliases:
- 'phplint'
cmds:
- task: parallel-lint
vars: { CLI_ARGS: '-e php,module,install,inc,theme app' }
validate/phpcs:
label: PHPCS validation
desc: Validate PHP for code style.
cmds:
- task: phpcs
validate/phpstan:
label: PHPStan analyze
desc: Analyze PHP code for bugs and errors.
cmds:
- task: phpstan
vars: { CLI_ARGS: 'analyze' }
validate/js:
label: JavaScript linter
desc: Lints JavaScript files.
aliases:
- 'jslint'
cmds:
- task: eslint
vars: { CLI_ARGS: '-c {{.CONFIG_DIR}}/.eslintrc.json --ext .js . {{.CLI_ARGS}}' }
validate/css:
label: CSS linter
desc: Lints CSS files.
aliases:
- 'csslint'
cmds:
- task: stylelint
vars: { CLI_ARGS: '-c {{.CONFIG_DIR}}/.stylelintrc.json **/*.css {{.CLI_ARGS}}' }
validate/yml:
label: YML linter
desc: Lints Y(A)ML files.
aliases:
- 'ymllint'
- 'yamllint'
cmds:
- task: eslint
vars: { CLI_ARGS: '-c {{.CONFIG_DIR}}/.eslintrc.json --ext .yml --ext .yaml . {{.CLI_ARGS}}' }
validate/spellcheck:
label: Spellcheck
desc: Checks for common spelling issues.
aliases:
- 'spellcheck'
cmds:
- task: cspell
vars: { CLI_ARGS: '--config {{.CONFIG_DIR}}/.cspell.json --quiet --no-progress "**" {{.CLI_ARGS}}' }
fix:
label: Fixing found issues
desc: Trying for automated fixes for found problems.
cmds:
- task: fix/phpcs
- task: fix/js
- task: fix/css
- task: fix/yml
fix/phpcs:
label: PHPCS
desc: Fix PHPCS issues.
cmds:
- task: phpcbf
fix/js:
label: JavaScript
desc: Fix JavaScript issues.
cmds:
- task: validate/js
vars: { CLI_ARGS: '--fix' }
fix/css:
label: CSS
desc: Fix CSS issues.
cmds:
- task: validate/css
vars: { CLI_ARGS: '--fix' }
fix/yml:
label: Y(A)ML
desc: Fix Y(A)ML issues.
aliases:
- 'fix/yaml'
cmds:
- task: validate/yml
vars: { CLI_ARGS: '--fix' }
test:
label: Tests
desc: Runs all available project tests.
cmds:
- task: test/unit
- task: test/kernel
- task: test/browser
- task: test/existing-site
- task: test/existing-site-js
test/unit:
label: Unit tests
desc: Runs Unit test
cmds:
- task: phpunit
vars: { SUITE: 'unit' }
test/kernel:
label: Kernel tests
desc: Runs Kernel tests.
cmds:
- task: phpunit
vars: { SUITE: 'kernel' }
test/browser:
label: Browser tests
desc: Runs Browser tests.
cmds:
- task: phpunit
vars: { SUITE: 'functional' }
test/existing-site:
label: Acceptance tests
desc: Runs Acceptance tests.
cmds:
- task: phpunit
vars: { SUITE: 'existing-site' }
test/existing-site-js:
label: Acceptance with JavaScript tests
desc: Runs Acceptance with JavaScript tests.
cmds:
- task: phpunit
vars: { SUITE: 'existing-site-javascript' }
update:
label: Update project
desc: Updates project dependencies withing constraints.
prompt: |
This command can break website. Do it independently without any other
active changes. Make sure you have a backup.
Never run it on production.
cmds:
- task: composer
vars: { CLI_ARGS: 'update -W' }
- task: drush
vars: { CLI_ARGS: 'updatedb -y' }
- task: drush
vars: { CLI_ARGS: 'config:export -y' }
- task: yarn
vars: { CLI_ARGS: 'upgrade' }
build-dictionary:
label: Builds dictionary
desc: Builds a project dictionary for CSPell.
cmds:
- task: cspell
vars: { CLI_ARGS: '--config {{.CONFIG_DIR}}/.cspell.json --words-only --unique "**" | sort -f > {{.CONFIG_DIR}}/cspell/dictionary.txt' }
import/translations:
label: Import translations
desc: Imports custom project-specific translations.
cmds:
- task: drush
vars: { CLI_ARGS: 'locale:import --type=customized --override=all ru {{.TASKFILE_DIR}}/assets/translation/ru.po' }