-
-
Notifications
You must be signed in to change notification settings - Fork 894
Expand file tree
/
Copy pathjustfile
More file actions
291 lines (240 loc) · 9.39 KB
/
justfile
File metadata and controls
291 lines (240 loc) · 9.39 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
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
_default:
just --list -u
alias f := format
alias t := test
alias r := ready
alias l := lint
alias qt := test-quick
set windows-powershell := true
# Installs the tools needed to develop
install-tools:
cargo install cargo-binstall
cargo binstall cargo-insta wasm-opt
cargo binstall wasm-bindgen-cli --version 0.2.105
pnpm install
# Upgrades the tools needed to develop
upgrade-tools:
cargo install cargo-binstall --force
cargo binstall cargo-insta wasm-opt --force
cargo binstall wasm-bindgen-cli --version 0.2.105 --force
# Generate all files across crates and tools. You rarely want to use it locally.
gen-all:
cargo run -p xtask_codegen -- all
just gen-configuration
just gen-migrate
just gen-bindings
just format
# Generates TypeScript types and JSON schema of the configuration
gen-bindings:
just gen-schema
just gen-types
# Generates TypeScript types
gen-types:
cargo run -p xtask_codegen --features schema -- bindings
# Generates the JSON Schema of the configuration
gen-schema:
cargo codegen-schema
# Generates code generated files for the linter
gen-analyzer:
just gen-rules
just gen-configuration
just gen-migrate
just gen-bindings
just lint-rules
just format
# Generate and updates the files needed inside the *_analyze crates
gen-rules:
cargo run -p xtask_codegen -- analyzer
# Generates Baseline data for CSS features from web-features
gen-css-baseline:
cargo run -p xtask_codegen --features xtask_codegen/external_data -- css-baseline
gen-configuration:
cargo run -p xtask_codegen --features configuration -- configuration
# Generates code for eslint migration
gen-migrate:
cargo run -p xtask_codegen --features configuration -- migrate-eslint
# Generates the initial files for all formatter crates
gen-formatter *args='':
cargo run -p xtask_codegen -- formatter {{args}}
# Generates the Tailwind CSS preset for utility class sorting
[working-directory: 'packages/tailwindcss-config-analyzer']
gen-tw:
pnpm build
pnpm execute
# Build WASM for bundler target (development)
build-wasm-bundler-dev:
cargo build --lib --target wasm32-unknown-unknown -p biome_wasm
wasm-bindgen target/wasm32-unknown-unknown/debug/biome_wasm.wasm \
--out-dir packages/@biomejs/wasm-bundler \
--target bundler \
--typescript
# Build WASM for bundler target (release)
build-wasm-bundler:
cargo build --lib --target wasm32-unknown-unknown --release -p biome_wasm
wasm-bindgen target/wasm32-unknown-unknown/release/biome_wasm.wasm \
--out-dir packages/@biomejs/wasm-bundler \
--no-demangle \
--target bundler \
--typescript
wasm-opt packages/@biomejs/wasm-bundler/biome_wasm_bg.wasm \
-o packages/@biomejs/wasm-bundler/biome_wasm_bg.wasm \
-Os \
-g
# Build WASM for Node.js target (development)
build-wasm-node-dev:
cargo build --lib --target wasm32-unknown-unknown -p biome_wasm
wasm-bindgen target/wasm32-unknown-unknown/debug/biome_wasm.wasm \
--out-dir packages/@biomejs/wasm-nodejs \
--target nodejs \
--typescript
# Build WASM for Node.js target (release)
build-wasm-node:
cargo build --lib --target wasm32-unknown-unknown --release -p biome_wasm
wasm-bindgen target/wasm32-unknown-unknown/release/biome_wasm.wasm \
--out-dir packages/@biomejs/wasm-nodejs \
--no-demangle \
--target nodejs \
--typescript
wasm-opt packages/@biomejs/wasm-nodejs/biome_wasm_bg.wasm \
-o packages/@biomejs/wasm-nodejs/biome_wasm_bg.wasm \
-Os \
-g
# Build WASM for web target (development)
build-wasm-web-dev:
cargo build --lib --target wasm32-unknown-unknown -p biome_wasm
wasm-bindgen target/wasm32-unknown-unknown/debug/biome_wasm.wasm \
--out-dir packages/@biomejs/wasm-web \
--target web \
--typescript
# Build WASM for web target (release)
build-wasm-web:
cargo build --lib --target wasm32-unknown-unknown --release -p biome_wasm
wasm-bindgen target/wasm32-unknown-unknown/release/biome_wasm.wasm \
--out-dir packages/@biomejs/wasm-web \
--no-demangle \
--target web \
--typescript
wasm-opt packages/@biomejs/wasm-web/biome_wasm_bg.wasm \
-o packages/@biomejs/wasm-web/biome_wasm_bg.wasm \
-Os \
-g
# Generates the code of the grammars available in Biome
gen-grammar *args='':
cargo run -p xtask_codegen -- grammar {{args}}
# Generates the linter documentation and Rust documentation
documentation:
RUSTDOCFLAGS='-D warnings' cargo documentation
# Creates a new js lint rule with the given name. Name has to be camel case.
new-js-lintrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=js --category=lint --name={{rulename}}
just gen-analyzer
# Creates a new js assist rule with the given name. Name has to be camel case.
new-js-assistrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=js --category=assist --name={{rulename}}
just gen-analyzer
# Creates a new json lint rule with the given name. Name has to be camel case.
new-json-lintrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=json --category=lint --name={{rulename}}
just gen-analyzer
# Creates a new json assist rule with the given name. Name has to be camel case.
new-json-assistrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=json --category=assist --name={{rulename}}
just gen-analyzer
# Creates a new css lint rule with the given name. Name has to be camel case.
new-css-lintrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=css --category=lint --name={{rulename}}
just gen-analyzer
# Creates a new css assist rule with the given name. Name has to be camel case.
new-css-assistrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=css --category=assist --name={{rulename}}
just gen-analyzer
# Creates a new graphql lint rule with the given name. Name has to be camel case.
new-graphql-lintrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=graphql --category=lint --name={{rulename}}
just gen-analyzer
# Creates a new graphql assist rule with the given name. Name has to be camel case.
new-graphql-assistrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=graphql --category=assist --name={{rulename}}
just gen-analyzer
# Creates a new html lint rule with the given name. Name has to be camel case.
new-html-lintrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=html --category=lint --name={{rulename}}
just gen-analyzer
# Creates a new html assist rule with the given name. Name has to be camel case.
new-html-assistrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=html --category=assist --name={{rulename}}
just gen-analyzer
# Creates a new html lint rule with the given name, but targets vue. Name has to be camel case.
new-html-vue-lintrule rulename:
cargo run -p xtask_codegen -- new-lintrule --kind=html-vue --category=lint --name={{rulename}}
just gen-analyzer
# Promotes a rule from the nursery group to a new group
move-rule rulename group:
cargo run -p xtask_codegen -- move-rule --group={{group}} --name={{rulename}}
cargo run -p xtask_codegen -- analyzer
# Format Rust files and TOML files
format:
cargo format
pnpm format
[unix]
_touch file:
touch {{file}}
[windows]
_touch file:
powershell -Command "(Get-Item {{file}}).LastWriteTime = Get-Date"
# Run tests of all crates
test:
cargo test --no-fail-fast
# Run tests for the crate passed as argument e.g. just test-create biome_cli
test-crate name:
cargo test -p {{name}} --no-fail-fast
# Run doc tests
test-doc:
cargo test --doc
# Run CommonMark conformance tests for the markdown parser
test-markdown-conformance:
cargo run -p xtask_coverage -- --suites=markdown/commonmark
# Update the CommonMark spec.json to a specific version
update-commonmark-spec version:
./scripts/update-commonmark-spec.sh {{version}}
# Tests a lint rule. The name of the rule needs to be camel case
test-lintrule name:
just _touch crates/biome_js_analyze/tests/spec_tests.rs
just _touch crates/biome_json_analyze/tests/spec_tests.rs
just _touch crates/biome_css_analyze/tests/spec_tests.rs
just _touch crates/biome_graphql_analyze/tests/spec_tests.rs
just _touch crates/biome_html_analyze/tests/spec_tests.rs
cargo test -p biome_js_analyze -- {{snakecase(name)}} --show-output
cargo test -p biome_json_analyze -- {{snakecase(name)}} --show-output
cargo test -p biome_css_analyze -- {{snakecase(name)}} --show-output
cargo test -p biome_graphql_analyze -- {{snakecase(name)}} --show-output
cargo test -p biome_html_analyze -- {{snakecase(name)}} --show-output
# Tests a lint rule. The name of the rule needs to be camel case
test-transformation name:
just _touch crates/biome_js_transform/tests/spec_tests.rs
cargo test -p biome_js_transform -- {{snakecase(name)}} --show-output
# Run the quick_test for the given package.
test-quick package:
cargo test -p {{package}} --test quick_test -- quick_test --nocapture --ignored
# Alias for `cargo lint`, it runs clippy on the whole codebase
lint:
cargo lint
# Checks if the docs of the lint rules follow Biome's requirements
lint-rules:
cargo run -p rules_check
# When you finished coding, run this command to run the same commands in the CI.
ready:
git diff --exit-code --quiet
just gen-all
just documentation
#just format # format is already run in `just gen-all`
just lint
just test
just test-doc
git diff --exit-code --quiet
# Creates a new changeset for the final changelog
new-changeset:
pnpm changeset
# Create new crate
new-crate name:
cargo new crates/{{name}} --lib