-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathTaskfile.yml
146 lines (138 loc) · 3.97 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
# https://taskfile.dev
version: "3"
tasks:
build:
cmds:
- tsc
build-readme:
cmds:
- readme-generator --template ./.template/readme.njk {{.CLI_ARGS}}
clean:
cmds:
- del-cli ./dist/ ./test/.temp/
fmt:
deps:
- |
{{- if or
(empty (splitArgs .CLI_ARGS))
(has "pkg" (splitArgs .CLI_ARGS))
-}}
_fmt-pkg
{{- end -}}
- task: |
{{- if or
(empty (splitArgs .CLI_ARGS))
(has "ts" (splitArgs .CLI_ARGS))
(has "js" (splitArgs .CLI_ARGS))
-}}
_fmt-xs
{{- end -}}
vars:
ESLINT_EXT: |
{{- concat
( and
(has "js" (splitArgs .CLI_ARGS))
(not (has "ts" (splitArgs .CLI_ARGS)))
| ternary (list ".js" ".cjs" ".mjs") (list) )
( and
(has "ts" (splitArgs .CLI_ARGS))
(not (has "js" (splitArgs .CLI_ARGS)))
| ternary (list ".ts") (list) )
| join ", " -}}
_fmt-pkg:
internal: true
cmds:
- prettier-package-json --write ./package.json
- sort-package-json ./package.json
_fmt-xs:
internal: true
cmds:
# Note: The "--report-unused-disable-directives" option was intentionally omitted for this command.
# The "--report-unused-disable-directives" option and the "--fix" option together will automatically remove old directive comments.
# However, the line from which the comment was removed remains intact, and Prettier may not remove this line.
# For this reason, we remove old directive comments manually.
- eslint {{- if .ESLINT_EXT }} --ext '{{ .ESLINT_EXT }}' {{- end }} --fix ./
lint:
deps: [eslint, tsc-src, tsc-test]
eslint:
cmds:
- eslint --report-unused-disable-directives ./
tsc-src:
cmds:
- tsc --noEmit
tsc-test:
cmds:
- tsc -p ./test/ --noEmit
test:
cmds:
# Use conditional expressions to decide whether or not to run tasks
# see https://github.com/go-task/task/issues/608#issue-1052678862
- task: |
{{- if not (has "--test-only" (splitArgs .CLI_ARGS)) -}}
_test-other
{{- end -}}
- cmd: |
{{- if not (has "--pre-test-only" (splitArgs .CLI_ARGS)) -}}
vitest {{- if .DISABLE_WATCH_MODE }} run {{- end -}}
{{- end -}}
interactive: true
_test-other:
internal: true
cmds:
- task: test-readme
- task: lint
test-readme:
cmds:
- task: build-readme
vars:
CLI_ARGS: --test
release:
cmds:
- task: release-validation
- task: clean
- task: build
- node ./dist/bin.js --push --verbose
- pnpm publish --access=public
release-validation:
deps:
- _release-validation-git-branch
- _release-validation-git-work-dir
- _release-validation-test
_release-validation-publishable:
internal: true
run: once
cmds:
- can-npm-publish --verbose
env:
COREPACK_ENABLE_STRICT: 0
_release-validation-git-branch:
internal: true
cmds:
- task: _release-validation-publishable
- git-branch-is master
_release-validation-git-work-dir:
internal: true
cmds:
- task: _release-validation-publishable
- is-git-status-clean
_release-validation-test:
internal: true
cmds:
- task: _release-validation-publishable
- task: test
vars:
DISABLE_WATCH_MODE: true
# do nothing
# It is required to execute the following tasks:
# ```yaml
# tasks:
# example:
# deps:
# # This task name may be an empty string.
# # If the task with the empty name does not exist, Task will fail to run this task.
# - |
# {{- if ... -}} some-task {{- end -}}
# ```
# see https://github.com/go-task/task/issues/608#issue-1052678862
"":
internal: true