-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
39 lines (30 loc) · 1.15 KB
/
Makefile
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
CARGO := cargo
RUSTUP := rustup
YARN := yarn
NPX := npx
ENTRY_POINT := src/index.html
WASM_OPT := wasm-opt
WASM_STRIP := wasm-strip
help:
@grep -E '^[a-zA-Z\._-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
build: ## builds the graph component
@$(CARGO) component build --release -p graph --target wasm32-unknown-unknown
bindgen: build ## generates bindings for the graph component
@$(NPX) jco transpile target/wasm32-unknown-unknown/release/graph.wasm --tla-compat -o src
opt: bindgen # optimizes the graph wasm module
@$(WASM_OPT) -Os src/graph.core.wasm -o src/graph.core.wasm
@$(WASM_STRIP) src/graph.core.wasm
bundle: opt ## bundles the application
@$(NPX) parcel build $(ENTRY_POINT) --no-scope-hoist
format: ## formats source code
@$(CARGO) fmt
@$(YARN) run prettier -w .
lint: ## runs linting
@$(CARGO) component clippy --release --target wasm32-unknown-unknown
@$(NPX) eslint src
run: bindgen ## runs development
@$(NPX) parcel $(ENTRY_POINT) -p 3000
setup: ## installs build dependencies
@$(YARN)
@$(CARGO) install cargo-component
@$(RUSTUP) target add wasm32-unknown-unknown