forked from rolldown/rolldown
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
251 lines (182 loc) · 7.69 KB
/
justfile
File metadata and controls
251 lines (182 loc) · 7.69 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
set windows-shell := ["powershell"]
set shell := ["bash", "-cu"]
alias dt := t-run
alias ued := update-esbuild-diff
_default:
just --list -u
setup:
just check-setup-prerequisites
# Rust related setup
cargo install cargo-binstall
cargo binstall cargo-insta cargo-deny cargo-shear@1.11.2 typos-cli -y
# Node.js related setup
corepack enable
pnpm install
just setup-submodule
just setup-bench
@echo "✅✅✅ Setup complete!"
setup-submodule:
git submodule update --init
setup-bench:
node --import @oxc-node/core/register ./scripts/misc/setup-benchmark-input/index.js
# Update the submodule to the latest commit
update-submodule:
git submodule update --init
# --- `roll` series commands will run all relevant commands in one go.
# Run all relevant commands.
roll: pnpm-install roll-rust roll-node roll-repo update-esbuild-diff
# Run all relevant commands for Rust.
roll-rust: pnpm-install test-rust lint-rust
# Run all relevant commands for Node.js.
roll-node: test-node lint-node
# Run all relevant commands for the repository.
roll-repo: lint-repo
update-esbuild-diff *args="":
pnpm --filter=scripts esbuild-snap-diff {{ args }}
# --- `test` series commands aim to run tests and update snapshots automatically.
test: test-rust test-node update-generated-code
# Update snapshots both for Rust and Node.js tests.
test-update:
just test-rust # Rust tests will update snapshots automatically.
just test-node --update
# Update snapshots for Node.js tests.
test-update-node:
just test-node --update
# Run Rust tests.
test-rust: pnpm-install
cargo test --workspace --exclude rolldown_binding
# Run Node.js tests for Rolldown.
test-node-rolldown *args="": build-rolldown
just t-node-rolldown {{ args }}
# Run Node.js tests for Rolldown without building Rolldown.
# This command is still useful until we have advanced caching util.
test-node-rolldown-only *args="":
just t-node-rolldown {{ args }}
# Run Rollup's test suite to check Rolldown's behaviors.
test-node-rollup *args="": build-rolldown
just t-node-rollup {{ args }}
# Run both Rolldown's tests and Rollup's test suite.
test-node *args="": build-rolldown
just test-node-rolldown {{ args }}
just test-node-rollup
test-node-hmr *args: build build-test-dev-server
just test-node-hmr-only {{ args }}
test-node-hmr-only *args:
pnpm run --filter @rolldown/test-dev-server-tests test {{ args }}
# Run Vite's test suite to check Rolldown's behaviors.
test-vite: # We don't use `test-node-vite` because it's not expected to run in `just test-node`.
pnpm run --filter vite-tests test
# --- `t` series commands provide scenario-specific shortcut commands for testing compared to `test` series commands.
# Run both Rolldown's tests and Rollup's test suite without building Rolldown.
t-node: t-node-rolldown t-node-rollup
# Run Rolldown's tests without building Rolldown.
t-node-rolldown *args="":
pnpm run --filter rolldown-tests test:main {{ args }}
pnpm run --filter rolldown-tests test:watcher {{ args }}
# Run Rollup's test suite without building Rolldown.
t-node-rollup *args="":
pnpm run --filter rollup-tests test {{ args }}
# Run specific rust test without enabling extended tests.
[unix]
t-run *args:
NEEDS_EXTENDED=false cargo run-fixture {{ args }}
[windows]
t-run *args:
$env:NEEDS_EXTENDED="false"; cargo run-fixture {{ args }}
# --- `fix` series commands aim to fix fixable issues.
# Fix formatting issues both for Rust, Node.js and all files in the repository
fix: fix-rust fix-node fix-repo
# Fix formatting, linting and code fixing issues for Rust files.
fix-rust:
cargo fmt --all -- --emit=files
-cargo shear --fix # omit exit status with `-`
cargo fix --allow-dirty --allow-staged
# Fix linting issues for Node.js files.
fix-node:
pnpm lint-code -- --fix
# Fix formatting issues for all files except Rust files.
fix-repo:
pnpm run fmt
# --- `lint` series commands aim to catch linting and type checking issues.
lint: lint-rust lint-node lint-repo
# Linting formatting, syntax and linting issues for Rust files.
lint-rust: clippy
cargo fmt --all --check
cargo check --workspace --all-features --all-targets --locked
# For the most of the time, code is automatically formatted on save in the editor.
# Also, clippy already cover compiler error.
clippy:
cargo clippy --workspace --all-targets -- --deny warnings
lint-node:
pnpm lint-code
pnpm type-check
pnpm lint-knip
pnpm lint-publint
lint-repo:
typos # Check if the spelling is correct.
cargo ls-lint # Check if the file names are correct.
pnpm fmt-check # Check if files are formatted correctly.
# --- `build` series commands aim to provide a easy way to build the project.
# Build both `@rolldown/pluginutils` and rolldown
build: build-pluginutils build-rolldown
# Build `@rolldown/debug` located in `packages/debug`.
build-rolldown-debug:
pnpm run --filter "@rolldown/debug" build
# Only build `rolldown` located in `packages/rolldown` itself without triggering building binding `crates/rolldown_binding`.
build-glue:
pnpm run --filter rolldown build-js-glue
# Only build `.node` binding located in `packages/rolldown`.
build-rolldown-binding:
pnpm run --filter rolldown build-binding
# Build `rolldown` located in `packages/rolldown` itself and its `.node` binding.
build-rolldown: build-pluginutils
pnpm run --filter rolldown build-native:debug
# Build `rolldown` located in `packages/rolldown` itself and its `.wasm` binding for WASI.
build-rolldown-wasi: build-pluginutils
pnpm run --filter rolldown build-wasi:debug
# Build `rolldown` located in `packages/rolldown` itself and its `.node` binding in release mode.
build-rolldown-release: build-pluginutils
pnpm run --filter rolldown build-native:release
# Build `rolldown` located in `packages/rolldown` itself and its `.node` binding in profile mode.
build-rolldown-profile:
pnpm run --filter rolldown build-native:profile
build-rolldown-memory-profile:
pnpm run --filter rolldown build-native:memory-profile
# Build `@rolldown/browser` located in `packages/browser` itself and its `.wasm` binding.
build-browser: build-pluginutils
pnpm run --filter "@rolldown/browser" build:debug
# Build `@rolldown/browser` located in `packages/browser` itself and its `.wasm` binding in release mode.
build-browser-release: build-pluginutils
pnpm run --filter "@rolldown/browser" build:release
# Build `@rolldown/pluginutils` located in `packages/pluginutils`.
build-pluginutils:
pnpm run --filter "@rolldown/pluginutils" build
# Build `@rolldown/test-dev-server` located in `packages/test-dev-server`.
build-test-dev-server:
pnpm run --filter @rolldown/test-dev-server build
# --- `bench` series commands aim to provide a easy way to run benchmarks.
bench-rust:
cargo bench -p bench
bench-node:
pnpm --filter bench run bench
bench-node-par:
pnpm --filter bench exec node ./benches/par.js
# --- Misc
bump-packages *args:
node --import @oxc-node/core/register ./scripts/misc/bump-version.js {{ args }}
check-setup-prerequisites:
node ./scripts/misc/setup-prerequisites/node.js
# Trigger pnpm install. This is used the ensure up-to-date dependencies before running any commands.
pnpm-install:
pnpm install
# Regenerate auto-generated code files from templates (must run after core changes).
# This generates:
# - Runtime helper definitions (crates/rolldown_common/src/generated/runtime_helper.rs)
# - Check options (crates/rolldown_common/src/generated/checks_options.rs + TypeScript equivalents)
# - Hook usage tracking (crates/rolldown_plugin/src/generated/hook_usage.rs + TypeScript equivalent)
# - Event kind switching logic (crates/rolldown_error/src/generated/event_kind_switcher.rs)
update-generated-code:
cargo run --bin generator
# Run the `rolldown` cli using node.
run *args:
pnpm rolldown {{ args }}