-
-
Notifications
You must be signed in to change notification settings - Fork 127
Expand file tree
/
Copy pathjustfile
More file actions
430 lines (350 loc) · 15.6 KB
/
Copy pathjustfile
File metadata and controls
430 lines (350 loc) · 15.6 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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
set positional-arguments
default:
@just --list --unsorted
var_sln := "src"
var_api := "src/Apps/NetPad.Apps.App"
var_spa := "src/Apps/NetPad.Apps.App/App"
var_cli := "src/Apps/NetPad.Apps.Cli"
var_tauri := "src/Apps/NetPad.Apps.Shells.Tauri/TauriApp"
var_rid_os := if os() == "windows" { "win" } else if os() == "macos" { "osx" } else { os() }
var_rid_arch := if arch() == "x86_64" { "x64" } else if arch() == "aarch64" { "arm64" } else { arch() }
var_rid := var_rid_os + "-" + var_rid_arch
# ─── GENERAL ──────────────────────────────────────────────────────────
# Prints all important paths
[group('general')]
paths:
@echo "API: {{ var_api }}"
@echo "SPA: {{ var_spa }}"
@echo "CLI: {{ var_cli }}"
@echo "Electron - Manifest: {{ var_api }}/electron.manifest.js (and electron.manifest.dev.js)"
@echo "Electron - Hook: {{ var_api }}/ElectronHostHook"
@echo "Tauri: {{ var_tauri }}"
@echo "Rust: {{ var_tauri }}/src-tauri"
# Print the current app version
[group('general')]
version:
@grep -oP '(?<=<InformationalVersion>).*(?=</InformationalVersion>)' "{{ var_api }}/NetPad.Apps.App.csproj"
# Bump version across all config files (usage: just bump-version 0.13.0)
[group('general')]
bump-version version:
#!/usr/bin/env bash
set -euo pipefail
echo "Bumping version to {{ version }}..."
# NetPad.Apps.App.csproj
sed -i'' -e 's|<AssemblyVersion>.*</AssemblyVersion>|<AssemblyVersion>{{ version }}</AssemblyVersion>|' "{{ var_api }}/NetPad.Apps.App.csproj"
sed -i'' -e 's|<FileVersion>.*</FileVersion>|<FileVersion>{{ version }}</FileVersion>|' "{{ var_api }}/NetPad.Apps.App.csproj"
sed -i'' -e 's|<InformationalVersion>.*</InformationalVersion>|<InformationalVersion>{{ version }}</InformationalVersion>|' "{{ var_api }}/NetPad.Apps.App.csproj"
# electron.manifest.js
sed -i'' -e 's|buildVersion: ".*"|buildVersion: "{{ version }}"|' "{{ var_api }}/electron.manifest.js"
# tauri.conf.json5
sed -i'' -e 's|"version": ".*"|"version": "{{ version }}"|' "{{ var_tauri }}/src-tauri/tauri.conf.json5"
# Cargo.toml (only the package version, not dependency versions)
sed -i'' -e '0,/^version = ".*"/s|^version = ".*"|version = "{{ version }}"|' "{{ var_tauri }}/src-tauri/Cargo.toml"
echo "Updated to {{ version }}:"
echo " {{ var_api }}/NetPad.Apps.App.csproj"
echo " {{ var_api }}/electron.manifest.js"
echo " {{ var_tauri }}/src-tauri/tauri.conf.json5"
echo " {{ var_tauri }}/src-tauri/Cargo.toml"
# Verify prerequisites are installed (node, dotnet, cargo, etc.)
[group('general')]
doctor:
#!/usr/bin/env bash
set -euo pipefail
ok=true
check() {
if command -v "$1" &>/dev/null; then
printf " %-14s %s\n" "$1" "$($1 $2 2>&1 | grep -m1 '[0-9]\.[0-9]')"
else
printf " %-14s MISSING\n" "$1"
ok=false
fi
}
echo "Checking prerequisites..."
check node --version
check npm --version
check dotnet --version
check cargo --version
check rustc --version
check just --version
echo ""
echo "Checking .NET tools..."
check dotnet-ef --version
echo ""
if $ok; then
echo "All prerequisites found."
else
echo "Some prerequisites are missing!"
exit 1
fi
# Run `npm install` for all package.json files
[group('general')]
npm-install-all:
cd "{{ var_spa }}" && npm install
cd "{{ var_api }}/ElectronHostHook" && npm install
cd "{{ var_tauri }}" && npm install
# ─── WEB ──────────────────────────────────────────────────────────────
# Web: run the Web backend
[group('web')]
web-run-backend watch="true":
{{ if watch == "true" { "dotnet watch run" } else { "dotnet run" } }} --project "{{ var_api }}"
# Web: run the Web frontend
[group('web')]
web-run-frontend:
npm run start-web --prefix "{{ var_spa }}"
# Web: build a local release version (self-contained, runtime: {{var_rid}})
[group('web')]
web-build-release:
npm run build-web --prefix "{{ var_spa }}"
dotnet publish "{{ var_api }}" -c Release -r "{{ var_rid }}" --self-contained -o "{{ var_api }}/bin/publish"
# Web: run the built release version
[group('web')]
web-run-release *args:
"{{ var_api }}/bin/publish/NetPad.Apps.App" "$@"
# ─── TAURI ────────────────────────────────────────────────────────────
# Tauri: run the Tauri backend
[group('tauri')]
tauri-run-backend watch="true":
{{ if watch == "true" { "dotnet watch run" } else { "dotnet run" } }} --project "{{ var_api }}" -- --tauri
# Tauri: run the Tauri frontend
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-run-frontend:
npx tauri dev
# Tauri: build a release binary for Windows x64
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-build-release-win-x64:
npx tauri build -c src-tauri/tauri.conf.win-x64.json5
# Tauri: build a release binary for Windows ARM64
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-build-release-win-arm64:
npx tauri build -c src-tauri/tauri.conf.win-arm64.json5
# Tauri: build a release binary for Linux x64
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-build-release-linux-x64:
npx tauri build -c src-tauri/tauri.conf.linux-x64.json5
# Tauri: build a release binary for Linux ARM64
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-build-release-linux-arm64:
npx tauri build -c src-tauri/tauri.conf.linux-arm64.json5
# Tauri: build a release binary for macOS x64
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-build-release-mac-x64:
npx tauri build --target x86_64-apple-darwin -c src-tauri/tauri.conf.mac-x64.json5
# Tauri: build a release binary for macOS ARM64
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-build-release-mac-arm64:
npx tauri build --target aarch64-apple-darwin -c src-tauri/tauri.conf.mac-arm64.json5
# Tauri: print Tauri environment info
[group('tauri')]
[working-directory('src/Apps/NetPad.Apps.Shells.Tauri/TauriApp')]
tauri-info:
npx tauri info
# ─── ELECTRON ─────────────────────────────────────────────────────────
# Electron: run the Electron backend
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-run-backend watch="true":
MSYS_NO_PATHCONV=1 electron-sharp start {{ if watch == "true" { "/watch" } else { "" } }} /manifest electron.manifest.js
# Electron: run the Electron backend (macOS ARM64)
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-run-backend-mac-arm64 watch="true":
MSYS_NO_PATHCONV=1 electron-sharp start {{ if watch == "true" { "/watch" } else { "" } }} /manifest electron.manifest.js /target custom "osx-arm64;mac" /electron-arch arm64
# Electron: run the Electron backend (Linux ARM64)
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-run-backend-linux-arm64 watch="true":
MSYS_NO_PATHCONV=1 electron-sharp start {{ if watch == "true" { "/watch" } else { "" } }} /manifest electron.manifest.js /target custom "linux-arm64;linux" /electron-arch arm64
# Electron: run the Electron backend (Windows ARM64)
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-run-backend-win-arm64 watch="true":
MSYS_NO_PATHCONV=1 electron-sharp start {{ if watch == "true" { "/watch" } else { "" } }} /manifest electron.manifest.js /target custom "win-arm64;win" /electron-arch arm64
# Electron: run the Electron frontend
[group('electron')]
electron-run-frontend:
npm run start --prefix "{{ var_spa }}"
# Electron: build a release binary for Windows x64
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-build-release-win-x64:
MSYS_NO_PATHCONV=1 electron-sharp build /target win /manifest electron.manifest.js /PublishSingleFile false
# Electron: build a release binary for Windows ARM64
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-build-release-win-arm64:
MSYS_NO_PATHCONV=1 electron-sharp build /target custom "win-arm64;win" /electron-arch arm64 /manifest electron.manifest.js /PublishSingleFile false
# Electron: build a release binary for Linux x64
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-build-release-linux-x64:
MSYS_NO_PATHCONV=1 electron-sharp build /target linux /manifest electron.manifest.js /PublishSingleFile false
# Electron: build a release binary for Linux ARM64
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-build-release-linux-arm64:
MSYS_NO_PATHCONV=1 electron-sharp build /target custom "linux-arm64;linux" /electron-arch arm64 /manifest electron.manifest.js /PublishSingleFile false
# Electron: build a release binary for macOS x64
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-build-release-mac-x64:
MSYS_NO_PATHCONV=1 electron-sharp build /target osx /manifest electron.manifest.js /PublishSingleFile false
# Electron: build a release binary for macOS ARM64
[group('electron')]
[working-directory('src/Apps/NetPad.Apps.App')]
electron-build-release-mac-arm64:
MSYS_NO_PATHCONV=1 electron-sharp build /target custom "osx-arm64;mac" /electron-arch arm64 /manifest electron.manifest.js /PublishSingleFile false
# ─── CLI ──────────────────────────────────────────────────────────────
# CLI: run the npad CLI
[group('cli')]
cli-run *args:
dotnet run --project "{{ var_cli }}" -- "$@"
# CLI: build npad
[group('cli')]
cli-build:
dotnet build "{{ var_cli }}"
# CLI: build a local release version of npad (self-contained, runtime: {{var_rid}})
[group('cli')]
cli-build-release:
dotnet publish "{{ var_cli }}" -c Release -r "{{ var_rid }}" --self-contained -o "{{ var_cli }}/bin/publish"
# CLI: run the built release version of npad
[group('cli')]
cli-run-release *args:
"{{ var_cli }}/bin/publish/npad" "$@"
# CLI: pack npad as a NuGet package
[group('cli')]
cli-nuget-pack:
bash scripts/nuget-pack-npad.sh
# CLI: push npad NuGet package (requires NUGET_API_KEY)
[group('cli')]
cli-nuget-push:
bash scripts/nuget-push-npad.sh
# ─── DOCS ────────────────────────────────────────────────────────────
# Docs: serve documentation site locally with docsify
[group('docs')]
docs-serve port="3000":
npx docsify-cli serve docs --port {{ port }}
# ─── DOTNET ───────────────────────────────────────────────────────────
# .NET: restore NuGet packages
[group('dotnet')]
dotnet-restore:
dotnet restore "{{ var_sln }}"
# .NET: build solution
[group('dotnet')]
dotnet-build:
dotnet build "{{ var_sln }}"
# .NET: build solution in Release configuration
[group('dotnet')]
dotnet-build-release:
dotnet build "{{ var_sln }}" -c Release
# .NET: clean solution
[group('dotnet')]
dotnet-clean:
dotnet clean "{{ var_sln }}"
# .NET: format code
[group('dotnet')]
dotnet-format:
dotnet format "{{ var_sln }}"
# .NET: run tests
[group('dotnet')]
dotnet-test:
dotnet test "{{ var_sln }}" --filter "FullyQualifiedName!~IntegrationTests"
# .NET: run tests including integration tests
[group('dotnet')]
dotnet-test-all:
dotnet test "{{ var_sln }}"
# .NET: generate TypeScript API clients using NSwag
[group('dotnet')]
dotnet-ts-gen:
dotnet run --project "{{ var_api }}" -- --swagger
# .NET: check if generated TypeScript API clients are up to date
[group('dotnet')]
dotnet-ts-gen-check:
#!/usr/bin/env bash
set -euo pipefail
dotnet run --project "{{ var_api }}" -- --swagger
if ! git diff --quiet -- "{{ var_spa }}/src/core/@application/api.ts" "{{ var_spa }}/src/core/@plugins/*/api.ts"; then
echo "Generated API clients are out of date. Run 'just dotnet-ts-gen' and commit the changes."
exit 1
fi
echo "API clients are up to date."
# .NET: list outdated NuGet packages
[group('dotnet')]
dotnet-outdated:
dotnet list "{{ var_sln }}" package --outdated
# ─── JAVASCRIPT ───────────────────────────────────────────────────────
# JavaScript: build SPA (Electron target)
[group('javascript')]
js-build-electron:
npm run build --prefix "{{ var_spa }}"
# JavaScript: build SPA (Web target)
[group('javascript')]
js-build-web:
npm run build-web --prefix "{{ var_spa }}"
# JavaScript: run all linters (eslint, htmlhint, stylelint)
[group('javascript')]
js-lint:
npm run lint --prefix "{{ var_spa }}"
# JavaScript: run tests
[group('javascript')]
js-test:
npm run test --prefix "{{ var_spa }}"
# JavaScript: analyze webpack bundle (interactive server)
[group('javascript')]
js-analyze:
npm run analyze --prefix "{{ var_spa }}"
# JavaScript: analyze webpack bundle (static HTML report)
[group('javascript')]
js-analyze-static:
npm run analyze --prefix "{{ var_spa }}" -- --env analyzeStatic
# JavaScript: update browserslist database
[group('javascript')]
js-update-browsers:
cd "{{ var_spa }}" && npx update-browserslist-db@latest
# JavaScript: list outdated npm packages
[group('javascript')]
js-outdated:
npm outdated --prefix "{{ var_spa }}" || true
# ─── RUST ─────────────────────────────────────────────────────────────
# Rust: check rust code
[group('rust')]
rust-check:
cargo check --manifest-path "{{ var_tauri }}/src-tauri/Cargo.toml"
# Rust: build rust code
[group('rust')]
rust-build:
cargo build --manifest-path "{{ var_tauri }}/src-tauri/Cargo.toml"
# Rust: run rust tests
[group('rust')]
rust-test:
cargo test --manifest-path "{{ var_tauri }}/src-tauri/Cargo.toml"
# Rust: format rust code
[group('rust')]
rust-format:
cargo fmt --all --manifest-path "{{ var_tauri }}/src-tauri/Cargo.toml"
# Rust: check rust code formatting and run clippy
[group('rust')]
rust-lint:
cargo fmt --all --check --manifest-path "{{ var_tauri }}/src-tauri/Cargo.toml"
cargo clippy --all-targets --manifest-path "{{ var_tauri }}/src-tauri/Cargo.toml"
# ─── ALL ──────────────────────────────────────────────────────────────
# Clean all build artifacts (bin, obj, dist, node_modules/.cache)
[group('all')]
[confirm("This will delete all build artifacts. Continue?")]
clean-all:
dotnet clean "{{ var_sln }}"
rm -rf "{{ var_spa }}/dist"
rm -rf "{{ var_spa }}/node_modules/.cache"
find "{{ var_sln }}" -type d \( -name bin -o -name obj \) -exec rm -rf {} + 2>/dev/null || true
# Run all tests
[group('all')]
test-all: dotnet-test js-test rust-test
# Run all tests, lints, and checks
[group('all')]
check-all: dotnet-test js-test js-lint rust-test rust-lint