forked from biomejs/biome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
170 lines (135 loc) · 5.17 KB
/
justfile
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
_default:
just --list -u
alias f := format
alias t := test
alias r := ready
alias l := lint
alias qt := test-quick
# Installs the tools needed to develop
install-tools:
cargo install cargo-binstall
cargo binstall cargo-insta cargo-nextest taplo-cli wasm-pack wasm-tools knope
# Upgrades the tools needed to develop
upgrade-tools:
cargo install cargo-binstall --force
cargo binstall cargo-insta cargo-nextest taplo-cli wasm-pack wasm-tools knope --force
# Generate all files across crates and tools. You rarely want to use it locally.
gen-all:
cargo run -p xtask_codegen -- all
cargo codegen-configuration
cargo run -p xtask_codegen --features configuration -- migrate-eslint
just gen-bindings
just format
# Generates TypeScript types and JSON schema of the configuration
gen-bindings:
cargo codegen-schema
cargo codegen-bindings
# Generates code generated files for the linter
gen-lint:
cargo run -p xtask_codegen -- analyzer
cargo codegen-configuration
cargo run -p xtask_codegen --features configuration -- migrate-eslint
just gen-bindings
cargo run -p rules_check
just format
# Generates the initial files for all formatter crates
gen-formatter:
cargo run -p xtask_codegen -- formatter
# Generates the Tailwind CSS preset for utility class sorting (requires Bun)
gen-tw:
bun packages/tailwindcss-config-analyzer/src/generate-tailwind-preset.ts
# 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 lint rule in the given path, 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-lint
just documentation
# Creates a new lint rule in the given path, 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-lint
just documentation
# Creates a new lint rule in the given path, 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-lint
just documentation
# Creates a new css lint rule in the given path, 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-lint
# Creates a new css lint rule in the given path, 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-lint
# Promotes a rule from the nursery group to a new group
promote-rule rulename group:
cargo run -p xtask_codegen -- promote-rule --name={{rulename}} --group={{group}}
just gen-lint
just documentation
-cargo test -p biome_js_analyze -- {{snakecase(rulename)}}
cargo insta accept
# Format Rust files and TOML files
format:
cargo format
taplo format
[unix]
_touch file:
touch {{file}}
[windows]
_touch file:
(gci {{file}}).LastWriteTime = Get-Date
# Run tests of all crates
test:
cargo nextest run --no-fail-fast
# Run tests for the crate passed as argument e.g. just test-create biome_cli
test-crate name:
cargo nextest run -E 'package({{name}})' --no-fail-fast
# Run doc tests
test-doc:
cargo test --doc
# 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
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
# 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
# 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 crate
new-crate name:
cargo new --lib crates/{{snakecase(name)}}
cargo run -p xtask_codegen -- new-crate --name={{snakecase(name)}}
# Creates a new changeset for the final changelog
new-changeset:
knope document-change
# Dry-run of the release
dry-run-release *args='':
knope release --dry-run {{args}}