Skip to content

Commit 6827057

Browse files
committed
refactor: migrate to Just
1 parent a60896f commit 6827057

File tree

5 files changed

+51
-45
lines changed

5 files changed

+51
-45
lines changed

Dockerfile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ FROM ubuntu:24.04 AS builder
77
RUN apt-get update && apt-get install -y \
88
curl \
99
git \
10-
make \
1110
ca-certificates \
1211
&& rm -rf /var/lib/apt/lists/*
1312

@@ -25,8 +24,8 @@ ENV CGO_ENABLED=0
2524
ENV GOOS=linux
2625
ENV GOARCH=amd64
2726

28-
# Build the application using make
29-
RUN make build/chromad
27+
# Build the application using just
28+
RUN just chromad
3029

3130
# Runtime stage
3231
FROM alpine:3.23 AS runtime

Justfile

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
set positional-arguments := true
2+
set shell := ["bash", "-c"]
3+
4+
version := `git describe --tags --dirty --always`
5+
6+
_help:
7+
@just -l
8+
9+
# Generate README.md from lexer definitions
10+
readme:
11+
#!/usr/bin/env sh
12+
GOOS= GOARCH= ./table.py
13+
14+
# Generate tokentype_string.go
15+
tokentype-string:
16+
go generate
17+
18+
# Format JavaScript files
19+
format-js:
20+
biome format --write cmd/chromad/static/index.js cmd/chromad/static/chroma.js
21+
22+
# Build chromad binary
23+
chromad: wasm-exec chroma-wasm
24+
rm -rf build
25+
esbuild --platform=node --bundle cmd/chromad/static/index.js --minify --outfile=cmd/chromad/static/index.min.js
26+
esbuild --bundle cmd/chromad/static/index.css --minify --outfile=cmd/chromad/static/index.min.css
27+
cd cmd/chromad && CGOENABLED=0 go build -ldflags="-X 'main.version={{ version }}'" -o ../../build/chromad .
28+
29+
# Copy wasm_exec.js from TinyGo
30+
wasm-exec:
31+
#!/usr/bin/env sh
32+
tinygoroot=$(tinygo env TINYGOROOT)
33+
install -m644 "$tinygoroot/targets/wasm_exec.js" cmd/chromad/static/wasm_exec.js
34+
35+
# Build WASM binary
36+
chroma-wasm:
37+
#!/usr/bin/env sh
38+
if type tinygo > /dev/null 2>&1; then
39+
tinygo build -no-debug -target wasm -o cmd/chromad/static/chroma.wasm cmd/libchromawasm/main.go
40+
else
41+
GOOS=js GOARCH=wasm go build -o cmd/chromad/static/chroma.wasm cmd/libchromawasm/main.go
42+
fi
43+
44+
# Upload chromad to server
45+
upload: chromad
46+
scp build/chromad root@swapoff.org:
47+
ssh root@swapoff.org 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'

Makefile

Lines changed: 0 additions & 42 deletions
This file was deleted.

bin/.just-1.46.0.pkg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hermit

bin/just

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.just-1.46.0.pkg

0 commit comments

Comments
 (0)