-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtasks.toml
More file actions
168 lines (139 loc) · 5.83 KB
/
tasks.toml
File metadata and controls
168 lines (139 loc) · 5.83 KB
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
# ref: https://mise.jdx.dev/tasks/
#:schema https://mise.jdx.dev/schema/mise-task.json
[commit]
depends = ["buni:root"]
usage = '''
flag "--staged" help="Only commit staged files" default="false"
'''
run = ["{% if usage.staged == false %}git add .{% endif %}", "bun run git-cz"]
raw = true
description = "Commit changes with commitizen."
[check]
depends = ["check:*"]
description = "Run all linters and formatters. Set LINT=true to check formatting without applying it."
["check:oxlint"]
run = "oxlint --report-unused-disable-directives-severity error {% if env.LINT is undefined %}--fix{% endif %}"
description = "Run oxlint to lint JavaScript/TypeScript files."
["check:oxfmt"]
run = "oxfmt {% if env.LINT is defined %}--check{% endif %}"
description = "Run oxfmt to format JavaScript/TypeScript/JSON/JSONC/JSON5/Markdown files."
["check:tsc"]
depends = ["check:tsc:*"]
description = "Run TypeScript compiler to check types."
["check:tsc:root"]
depends = ["buni:root"]
run = "bun run tsc {% if env.CI is defined %}--incremental false{% endif %}"
description = "Run TypeScript compiler to check types in the root directory."
["check:jsonschema"]
# schema of wrangler.jsonc is in node_modules
depends = ["buni:worker"]
run = "jschema-validator"
env.GITHUB_TOKEN = "{{ env.GITHUB_TOKEN }}"
description = "Validate JSON/JSONC/JSON5 files with JSON schema."
["check:actionlint"]
run = "actionlint -color"
# SC2312: check-extra-masked-returns
# pipefail is set by shell: bash in GitHub Actions but cannot be detected by shellcheck
# ref: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#defaultsrunshell
env.SHELLCHECK_OPTS = "--enable=all --exclude=SC2312"
description = "Run actionlint to check GitHub Actions workflows."
["check:ghalint"]
wait_for = ["check:pinact"]
run = "ghalint run"
description = "Run ghalint to check GitHub Actions workflows."
["check:pinact"]
run = "pinact run --verify {% if env.LINT is defined %}--check{% endif %}"
env.GITHUB_TOKEN = "{{ env.GITHUB_TOKEN }}"
description = "Run pinact to pin/check pinned GitHub Actions dependencies in workflows."
["check:zizmor"]
run = "zizmor --pedantic {% if env.LINT is undefined %}--fix{% endif %} ."
env.GH_TOKEN = "{{ env.GITHUB_TOKEN }}"
description = "Run Zizmor to check GitHub Actions workflows."
["check:taplo"]
run = [
"taplo lint",
"taplo fmt {% if env.LINT is defined %}--check --diff{% endif %}",
]
description = "Run Taplo to lint and format TOML files."
["check:markdownlint"]
run = "markdownlint-cli2 {% if env.LINT is undefined %}--fix{% endif %}"
description = "Run markdownlint to lint Markdown files."
["check:shfmt"]
# cannot exclude gitignored files
# ref: https://github.com/mvdan/sh/issues/288
run = """
shfmt {% if env.LINT is undefined %}--list --write{% else %}--diff{% endif %} \
--simplify {{ exec(command='mise run util:list-scripts') }}"""
description = "Run shfmt to format shell scripts."
["check:shellcheck"]
# recursive globbing is not supported
# ref: https://www.shellcheck.net/wiki/Recursiveness
# ref: https://github.com/koalaman/shellcheck/issues/143
run = "shellcheck --external-sources {{ exec(command='mise run util:list-scripts') }}"
description = "Run shellcheck to lint shell scripts."
["check:pwsh"]
depends = ["install:ps-script-analyzer"]
shell = "pwsh -Command"
run = "Invoke-ScriptAnalyzer -Path . -Recurse -EnableExit -Settings PSScriptAnalyzerSettings.psd1"
dir = "win"
description = "Run PSScriptAnalyzer to lint PowerShell scripts."
["check:yamlfmt"]
run = "yamlfmt {% if env.LINT is defined %}-lint{% endif %} ."
description = "Run yamlfmt to format YAML files."
["check:yamllint"]
run = "yamllint --strict ."
description = "Run yamllint to lint YAML files."
["check:hadolint"]
# hadolint does not support recursive globbing
# ref: https://github.com/hadolint/hadolint/issues/972
run = "hadolint --failure-threshold none docker/wsl/Dockerfile worker/docker/Dockerfile"
description = "Run hadolint to lint Dockerfile."
# SHELLCHECK_OPTS cannot be set in hadolint
# ref: https://github.com/hadolint/hadolint/issues/469
["check:mise"]
run = ["mise fmt", "mise task validate"]
depends_post = [
"{% if env.CI is defined %}util:nodiff{% else %}util:donothing{% endif %}",
]
description = "Format mise.toml and validate tasks."
["check:lychee"]
run = "lychee {% if env.LINT is defined %}--verbose{% endif %} \"**/*\""
env.GITHUB_TOKEN = "{{ env.GITHUB_TOKEN }}"
# no other ways to set metadata for tasks
env.CACHE_PATH = ".lycheecache"
description = "Run Lychee to check links in files."
["check:typos"]
run = "typos {% if env.LINT is undefined %}--write-changes{% endif %}"
description = "Run typos to check typo in files."
["check:ignore-sync"]
run = "ignore-sync ."
depends_post = [
"{% if env.CI is defined %}util:nodiff{% else %}util:donothing{% endif %}",
]
env.GITHUB_TOKEN = "{{ env.GITHUB_TOKEN }}"
description = "Generate/update .gitignore from .gitignore-sync."
["buni"]
depends = ["buni:root", "buni:worker"]
description = "Install Bun dependencies."
["buni:root"]
run = "bun install --frozen-lockfile"
hide = true
description = "Install Bun dependencies in the root directory."
["install:ps-script-analyzer"]
shell = "pwsh -Command"
# Force is required to bypass untrusted repository confirmation
# ref: https://github.com/PowerShell/PowerShellGetv2/issues/461
run = "Install-Module -Name PSScriptAnalyzer -RequiredVersion {{ vars.PS_SCRIPT_ANALYZER_VERSION }} -Force"
["util:nodiff"]
run = ["git add .", "git diff --staged --exit-code"]
hide = true
description = "Check there are no changes in the repository."
["util:donothing"]
run = ":"
hide = true
description = "Do nothing. This is used to skip depends/depends_post."
["util:list-scripts"]
# .bashrc is not detected by shfmt --find
run = "git_files=$(git ls-files) && scripts=$(shfmt --find $git_files) && echo wsl/home/.bashrc $scripts"
hide = true
description = "List all shell scripts paths in the repository."