this_algorithm/justfile
2023-04-17 19:41:08 -04:00

65 lines
1.9 KiB
Makefile

build: fmt docs-build rust-test rust-build
push:
podman push gitea.austen-wares.com/public/xpin-server
rust-test:
cargo test --all
cargo fmt --all --check
rust-build: docs-build output-clean
cargo build --all
cargo build -p web --release --target x86_64-unknown-linux-musl
earthly +rust-image
wasm-build:
wasm-pack build --target web xpin-wasm
# wasm2js xpin-wasm/pkg/xpin_wasm_bg.wasm -o xpin-wasm/pkg/xpin_wasm_bg.wasm.js
# sed -i 's/xpin_wasm_bg.wasm/xpin_wasm_bg.wasm.js/' xpin-wasm/pkg/wasm2js.js xpin-wasm/pkg/wasm2js_bg.js
wordlist-build:
. wordlist/venv/bin/activate && cd wordlist && for i in *.py; do "./${i}"; done
js-build: output-clean wasm-build docs-build
yarn --cwd ./web-frontend/ build
# rsync -ha ./web-frontend/build/ ./build/
output-clean:
rm -vrf ./web-frontend/build/ ./web-frontend/src/lib/docs/
mkdir -p ./web-frontend/src/lib/docs/
docs-build: output-clean
earthly +docs
rsync --stats -ha ./build/docs/ ./web-frontend/src/lib/docs/
for f in "${PWD}/web-frontend/src/lib/docs/"*.html; do ./web-frontend/node_modules/.bin/inliner "${f}" >"${f}-2" && mv -v -- "${f}-2" "${f}"; done
# cargo doc --all
# TODO: Clippy
rust-watch:
cargo watch -x fmt -x check -x build
js-dev:
yarn --cwd ./web-frontend/ dev
fmt:
# just --fmt --unstable
cargo fmt --all
yarn --cwd ./web-frontend/ format
serve:
http-server --verbose ./web-frontend/build/
init:
yarn --cwd ./web-frontend/
cargo fetch
cargo install wasm-pack
earthly +docs-builder
earthly +minify
clean: output-clean
cargo clean
init-python:
if [ ! -d "wordlist/venv" ]; then python3 -m virtualenv wordlist/venv -p "$(which python3)"; fi; export OSTYPE=linux-gnu && . wordlist/venv/bin/activate
export OSTYPE=linux-gnu && . wordlist/venv/bin/activate && pip install -r wordlist/requirements.txt && python -c 'import nltk; nltk.download('wordnet')'