Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (46 loc) · 1.44 KB
/
Copy pathMakefile
File metadata and controls
60 lines (46 loc) · 1.44 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
PLUGIN_NAME = files
CRATE_WASM = target/wasm32-wasip1/release/files.wasm
WASM_OUT = $(PLUGIN_NAME).wasm
.PHONY: all build frontend wasm test lint clean sign verify release info e2e-deps e2e
all: build
build: frontend wasm
frontend:
cd frontend && npm ci && npm run build
wasm:
cargo build --target wasm32-wasip1 --release
@if command -v wasm-opt >/dev/null 2>&1; then \
wasm-opt -Oz --enable-bulk-memory --enable-sign-ext --enable-mutable-globals \
--enable-nontrapping-float-to-int -o $(WASM_OUT) $(CRATE_WASM); \
else \
echo "wasm-opt not found; install binaryen for smaller output"; \
cp $(CRATE_WASM) $(WASM_OUT); \
fi
test:
cargo test
cd frontend && npm test
lint:
cargo clippy --target wasm32-wasip1 -- -D warnings
cargo clippy --all-targets -- -D warnings
cd frontend && npm run typecheck
e2e-deps:
cd e2e && npm ci && npx playwright install --with-deps chromium
# Needs a running panel and a provisioned node; see e2e/README.md.
e2e:
cd e2e && npx playwright test
sign:
@if [ -n "$(GPG_KEY)" ]; then \
gpg --detach-sign --armor --local-user $(GPG_KEY) $(WASM_OUT); \
else \
gpg --detach-sign --armor $(WASM_OUT); \
fi
verify:
gpg --verify $(WASM_OUT).asc $(WASM_OUT)
release: build sign
clean:
cargo clean
rm -f $(WASM_OUT) $(WASM_OUT).asc
rm -rf frontend/dist
rm -rf e2e/playwright-report e2e/test-results
info:
@echo "Plugin: $(PLUGIN_NAME)"
@echo "Version: $$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)"