Repository navigation
Expand file tree
/
Copy pathJustfile
More file actions
154 lines (123 loc) · 5.12 KB
/
Copy pathJustfile
File metadata and controls
154 lines (123 loc) · 5.12 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
set windows-shell := ["pwsh", "-NoProfile", "-Command"]
# List available recipes
default:
just --list
# Run all wirescript tests
test:
cargo test -p wirescript --lib
# Run a specific test by name
test-one name:
cargo test -p wirescript --lib -- {{name}}
# Build wirescript lib + check binary (debug)
build:
cargo build -p wirescript
# Build everything release
release:
cargo build --release -p wirescript -p wirescript-lsp -p wirescript-cli
# Build LSP server (release)
lsp:
cargo build --release -p wirescript-lsp
# Build check CLI (release)
check-bin:
cargo build --release -p wirescript --bin wirescript-check
# Regenerate the Contents list at the top of each docs/src page
doc-toc:
node crates/wirescript/scripts/gen_doc_toc.mjs
# Type-check every ```wirescript example in docs/src (CI gate)
doc-check: check-bin
node crates/wirescript/scripts/check_docs.mjs
node crates/wirescript/scripts/gen_doc_toc.mjs --check
node crates/wirescript/scripts/gen_book_summary.mjs --check
node crates/wirescript/scripts/gen_hljs_lang.mjs --check
# Regenerate the book's table of contents from the playground's page list
doc-summary:
node crates/wirescript/scripts/gen_book_summary.mjs
# Regenerate the book's highlight.js grammar from the playground's monarch.js
doc-hljs:
node crates/wirescript/scripts/gen_hljs_lang.mjs
# the version .github/workflows/deploy-playground.yml builds the published book with
MDBOOK_VERSION := "0.5.2"
# Build the docs book into docs/book (`just mdbook serve` previews with live reload)
[windows]
mdbook *ARGS='build': doc-summary doc-hljs
@if (-not (Get-Command mdbook -ErrorAction SilentlyContinue)) { \
Write-Host "mdbook not installed. cargo install mdbook --version {{ MDBOOK_VERSION }}"; \
Write-Host "or grab a binary from https://github.com/rust-lang/mdBook/releases"; \
exit 1 }
Copy-Item -Path CHANGELOG.md -Destination docs/src/ -Force
mdbook {{ ARGS }} docs
Remove-Item docs/src/CHANGELOG.md -Force -ErrorAction SilentlyContinue
# Build the docs book into docs/book (`just mdbook serve` previews with live reload)
[unix]
mdbook *ARGS='build': doc-summary doc-hljs
@command -v mdbook >/dev/null || { \
echo "mdbook not installed. cargo install mdbook --version {{ MDBOOK_VERSION }}" >&2; \
echo "or grab a binary from https://github.com/rust-lang/mdBook/releases" >&2; \
exit 1; }
cp -f CHANGELOG.md docs/src/CHANGELOG.md
mdbook {{ ARGS }} docs
rm -f docs/src/CHANGELOG.md
# Build WASM module (for playground/SDK)
wasm:
wasm-pack build crates/wasm --target nodejs --release --out-dir playground/sdk/pkg
# Fuzz the compiler: generate random programs and report anything that
# crashes, emits an `_Unsupported` placeholder, or fails to compile.
# `just fuzz 20000 7` runs 20k programs from seed 7.
fuzz count='5000' seed='1':
cargo run --release --example fuzz_programs -p wirescript -- --count {{count}} --seed {{seed}}
# Check a .ws file for errors
check file:
cargo run --release --bin wirescript-check -- {{file}}
# Check all .ws files in a directory
[windows]
check-dir dir:
Get-ChildItem -Path {{dir}} -Filter *.ws | ForEach-Object { cargo run --release --bin wirescript-check -- $_.FullName }
# Check all .ws files in a directory
[unix]
check-dir dir:
for f in {{dir}}/*.ws; do cargo run --release --bin wirescript-check -- "$f"; done
# Compile a .ws file to .brz
compile file:
cargo run --release -p wirescript-cli -- compile {{file}}
# Compile a .ws file to .brdb (SQLite, for BR.World.LoadAdditive)
compile-brdb file:
cargo run --release -p wirescript-cli -- compile {{file}} -o {{without_extension(file)}}.brdb
# Dump the lowered IR for a .ws file
ir file:
cargo run --release -p wirescript-cli -- compile {{file}} --dump-ir
# Rebuild VS Code extension (compile TS + formatter)
[windows]
vscode:
Set-Location editors/vscode; npm install; npm run build
# Rebuild VS Code extension (compile TS + formatter)
[unix]
vscode:
cd editors/vscode && npm install && npm run build
# Run the VS Code extension's unit tests
[windows]
vscode-test:
Set-Location editors/vscode; npm test
# Run the VS Code extension's unit tests
[unix]
vscode-test:
cd editors/vscode && npm test
# Regenerate the tree-sitter parser from grammar.js and run its corpus
[windows]
treesitter:
Set-Location editors/tree-sitter-wirescript; npm install; npx tree-sitter generate; npx tree-sitter test
# Regenerate the tree-sitter parser from grammar.js and run its corpus
[unix]
treesitter:
cd editors/tree-sitter-wirescript && npm install && npx tree-sitter generate && npx tree-sitter test
# Copy wirescript docs (+ the CHANGELOG) into playground for serving
[windows]
playground-docs:
Copy-Item -Path docs/src/*.md -Destination crates/wasm/playground/docs/ -Force
Copy-Item -Path CHANGELOG.md -Destination crates/wasm/playground/docs/ -Force
# Copy wirescript docs (+ the CHANGELOG) into playground for serving
[unix]
playground-docs:
cp -f docs/src/*.md crates/wasm/playground/docs/
cp -f CHANGELOG.md crates/wasm/playground/docs/
# Build everything (lib + lsp + cli + wasm + vscode)
all: release wasm vscode