mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
- Bump Go from 1.19 to 1.26 and update all dependencies - Rewrite CI workflow with matrix strategy (Linux, macOS, Windows) - Update GitHub Actions to current versions (checkout@v4, setup-go@v5) - Update CodeQL actions from v1 to v3 - Fix cross-platform bug in mock/path.go (path.Join -> filepath.Join) - Clean up dependabot config (weekly schedule, remove stale ignore) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
56 lines
2.0 KiB
Makefile
56 lines
2.0 KiB
Makefile
set positional-arguments := true
|
|
set shell := ["bash", "-c"]
|
|
|
|
version := `git describe --tags --dirty --always`
|
|
export GOOS := env("GOOS", "linux")
|
|
export GOARCH := env("GOARCH", "amd64")
|
|
|
|
_help:
|
|
@just -l
|
|
|
|
# Generate README.md from lexer definitions
|
|
readme:
|
|
#!/usr/bin/env bash
|
|
GOOS= GOARCH= ./table.py
|
|
|
|
# Generate tokentype_string.go
|
|
tokentype-string:
|
|
go generate
|
|
|
|
# Format JavaScript files
|
|
format-js:
|
|
biome format --write cmd/chromad/static/index.js cmd/chromad/static/chroma.js
|
|
|
|
# Build chromad binary
|
|
chromad: wasm-exec chroma-wasm
|
|
#!/usr/bin/env bash
|
|
rm -rf build
|
|
mk cmd/chromad/static/index.min.js : cmd/chromad/static/{index,chroma}.js -- \
|
|
esbuild --platform=browser --format=esm --bundle cmd/chromad/static/index.js --minify --external:./wasm_exec.js --outfile=cmd/chromad/static/index.min.js
|
|
mk cmd/chromad/static/index.min.css : cmd/chromad/static/index.css -- \
|
|
esbuild --bundle cmd/chromad/static/index.css --minify --outfile=cmd/chromad/static/index.min.css
|
|
cd cmd/chromad && CGOENABLED=0 go build -ldflags="-X 'main.version={{ version }}'" -o ../../build/chromad .
|
|
|
|
# Copy wasm_exec.js from TinyGo
|
|
wasm-exec:
|
|
#!/usr/bin/env bash
|
|
tinygoroot=$(tinygo env TINYGOROOT)
|
|
mk cmd/chromad/static/wasm_exec.js : "$tinygoroot/targets/wasm_exec.js" -- \
|
|
install -m644 "$tinygoroot/targets/wasm_exec.js" cmd/chromad/static/wasm_exec.js
|
|
|
|
# Build WASM binary
|
|
chroma-wasm:
|
|
#!/usr/bin/env bash
|
|
if type tinygo > /dev/null 2>&1; then
|
|
mk cmd/chromad/static/chroma.wasm : cmd/libchromawasm/main.go -- \
|
|
tinygo build -no-debug -target wasm -o cmd/chromad/static/chroma.wasm cmd/libchromawasm/main.go
|
|
else
|
|
mk cmd/chromad/static/chroma.wasm : cmd/libchromawasm/main.go -- \
|
|
GOOS=js GOARCH=wasm go build -o cmd/chromad/static/chroma.wasm cmd/libchromawasm/main.go
|
|
fi
|
|
|
|
# Upload chromad to server
|
|
upload: chromad
|
|
scp build/chromad root@swapoff.org:
|
|
ssh root@swapoff.org 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'
|