-
Notifications
You must be signed in to change notification settings - Fork 27
/
justfile
51 lines (42 loc) · 1.96 KB
/
justfile
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
export PATH := "./node_modules/.bin:" + env_var('PATH')
dev tags='':
fd 'go|templ|base.css' | entr -r bash -c 'templ generate && go build -tags={{tags}} -o /tmp/njump && TAILWIND_DEBUG=true PORT=3001 /tmp/njump'
build: templ tailwind
go build -o ./njump
deploy target: templ tailwind
CGO_CFLAGS="-I$(pwd)/secp256k1-master/musl/include/" CGO_LDFLAGS="-L$(pwd)/secp256k1-master/musl/lib" GOOS=linux GOARCH=amd64 CC=$(which musl-gcc) go build -tags libsecp256k1 -ldflags="-s -w -linkmode external -extldflags '-static' -X main.compileTimeTs=$(date '+%s')" -o ./njump
scp njump {{target}}:njump/njump-new
ssh {{target}} 'systemctl stop njump'
ssh {{target}} 'mv njump/njump-new njump/njump'
ssh {{target}} 'systemctl start njump'
libsecp256k1:
wget https://github.com/bitcoin-core/secp256k1/archive/refs/heads/master.zip
unzip master.zip
rm master.zip
cd secp256k1-master && ./autogen.sh && CC=$(musl-cc) ./configure --enable-module-extrakeys --enable-module-schnorrsig --prefix=$(pwd)/musl && make install
templ:
templ generate
protobuf:
protoc --proto_path=. --go_out=. --go_opt=paths=source_relative internal.proto
prettier:
prettier -w templates/*.html
tailwind:
tailwind -i base.css -o static/tailwind-bundle.min.css --minify
check-samples:
#!/usr/bin/env xonsh
base_url = ${...}.get('SERVICE_URL')
if not base_url:
output = $(netstat -tulpn 2>&1 | grep njump | awk '{print($4)}')
port = output.split(':')[-1].strip()
if not port:
print('njump not running or could not be found, you can set $SERVICE_URL to specify a base url manually')
import sys
sys.exit(4)
base_url = 'http://localhost:' + port
else:
if base_url.endswith('/'):
base_url = base_url[0:-1]
samples = $(cat samples.txt).splitlines()
for code in samples:
$(chromium @(base_url + '/' + code))
$(chromium @(base_url + '/njump/image/' + code))