-
Notifications
You must be signed in to change notification settings - Fork 248
Expand file tree
/
Copy pathjustfile
More file actions
131 lines (107 loc) · 4.25 KB
/
Copy pathjustfile
File metadata and controls
131 lines (107 loc) · 4.25 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
#!/usr/bin/env -S just --justfile
set windows-shell := ["powershell.exe", "-NoLogo", "-Command"]
set shell := ["bash", "-cu"]
_default:
@just --list -u
alias r := ready
[unix]
_clean_dist:
rm -rf packages/*/dist
[windows]
_clean_dist:
Remove-Item -Path 'packages/*/dist' -Recurse -Force -ErrorAction SilentlyContinue
init: _clean_dist _fix_symlinks
cargo binstall watchexec-cli cargo-insta typos-cli cargo-shear dprint taplo-cli -y
node packages/tools/src/index.ts sync-remote
pnpm install
pnpm -C docs install
[unix]
_fix_symlinks:
#!/usr/bin/env bash
if [ "$(git config --get core.symlinks)" != "true" ]; then \
echo "Enabling core.symlinks and re-checking out symlinks..."; \
git config core.symlinks true; \
git ls-files -s | grep '^120000' | cut -f2 | while read -r f; do git checkout -- "$f"; done; \
fi
[windows]
_fix_symlinks:
$symlinks = git config --get core.symlinks; \
if ($symlinks -ne 'true') { \
Write-Host 'Enabling core.symlinks and re-checking out symlinks...'; \
git config core.symlinks true; \
git ls-files -s | Where-Object { $_ -match '^120000' } | ForEach-Object { ($_ -split "`t", 2)[1] } | ForEach-Object { git checkout -- $_ }; \
}
build:
pnpm install
pnpm build
ready:
git diff --exit-code --quiet
typos
just fmt
just check
just test
just lint
just doc
watch *args='':
watchexec --no-vcs-ignore {{args}}
fmt:
cargo shear --fix
cargo fmt --all
pnpm fmt
check:
cargo check --workspace --all-features --all-targets --locked
watch-check:
just watch "'cargo check; cargo clippy'"
# Test all crates/* packages (new crates are automatically included) plus
# vite-plus-cli (lives outside crates/) to catch type sync issues.
# vp_cli_snapshots is excluded: its suite needs a built global binary and
# node, and runs via `just snapshot-test` instead.
# Single source of truth for cargo test, used by CI too.
[unix]
test:
RUST_MIN_STACK=8388608 cargo test $(for d in crates/*/; do n=$(basename $d); [ "$n" = "vp_cli_snapshots" ] || echo -n "-p $n "; done) -p vite-plus-cli
[windows]
test:
$packages = Get-ChildItem -Path crates -Directory | Where-Object { $_.Name -ne 'vp_cli_snapshots' } | ForEach-Object { '-p'; $_.Name }; $Env:RUST_MIN_STACK='8388608'; $Env:__COMPAT_LAYER='RunAsInvoker'; cargo test @packages -p vite-plus-cli
# PTY-based CLI snapshot tests (crates/vp_cli_snapshots). Builds the global
# binary and shim template first so the runner never tests a stale build, and
# installs Playwright Chromium for the browser-mode cases (idempotent).
# Filter by trial name substring: `just snapshot-test create`. Accept snapshot changes with
# `UPDATE_SNAPSHOTS=1 just snapshot-test`. Local-flavor cases additionally
# need a built packages/cli (`pnpm build`); the runner fails fast when dist
# is missing or stale. Use snapshot-test-global on checkouts without one.
snapshot-test *args='': _install_chromium
cargo build -p vp_global_cli -p vp_trampoline
cargo test -p vp_cli_snapshots -- {{args}}
# Browser-mode snapshot cases run with PLAYWRIGHT_BROWSERS_PATH=0, so the
# browser must be installed into node_modules with the same setting.
[unix]
_install_chromium:
PLAYWRIGHT_BROWSERS_PATH=0 pnpm exec playwright install chromium
[windows]
_install_chromium:
$Env:PLAYWRIGHT_BROWSERS_PATH='0'; pnpm exec playwright install chromium
# Global flavor + vpt cases only: needs no JS build, for Rust-side work on
# a checkout that never ran `pnpm build`.
[unix]
snapshot-test-global *args='':
VP_SNAP_SKIP_FLAVORS=local just snapshot-test {{args}}
[windows]
snapshot-test-global *args='':
$Env:VP_SNAP_SKIP_FLAVORS='local'; just snapshot-test {{args}}
# Single source of truth for clippy, used by CI too. The `-A` flags allow
# new toolchain lints that fire in upstream rolldown crates without a `[lints]` table.
lint:
cargo clippy --workspace --all-targets --all-features -- --deny warnings \
-A clippy::byte_char_slices \
-A clippy::manual_assert_eq \
-A clippy::needless_return_with_question_mark \
-A clippy::redundant_else \
-A clippy::unused_async_trait_impl \
-A clippy::useless_borrows_in_formatting
[unix]
doc:
RUSTDOCFLAGS='-D warnings' cargo doc --no-deps --document-private-items
[windows]
doc:
$Env:RUSTDOCFLAGS='-D warnings'; cargo doc --no-deps --document-private-items