-
Notifications
You must be signed in to change notification settings - Fork 4
/
justfile
101 lines (75 loc) · 2.92 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/env just --justfile
set dotenv-load := true
tesseractWasmUrl := "https://github.com/wydengyre/tesseract-wasm/releases/download/wydengyre-release-1/tesseract-wasm.zip"
tesseractWasmZipPath := "build/tesseract-wasm.zip"
tesseractWasmFilesPath := "deps/tesseract-wasm"
picoCssUrl := "https://github.com/picocss/pico/archive/refs/tags/v1.5.13.zip"
picoCssZipPath := "build/picocss.zip"
picoCssFilesPath := "deps/picocss"
default:
just --list --justfile {{justfile()}}
clean:
rm -rf deps build dist web/node_modules
# install dependencies
deps:
mkdir -p {{tesseractWasmFilesPath}} {{picoCssFilesPath}} build
curl --show-error --location --fail {{tesseractWasmUrl}} --output {{tesseractWasmZipPath}}
curl --show-error --location --fail {{picoCssUrl}} --output {{picoCssZipPath}}
unzip -q -o -d {{tesseractWasmFilesPath}} {{tesseractWasmZipPath}}
unzip -q -o -d {{picoCssFilesPath}} {{picoCssZipPath}}
# run all ci checks
ci: ci-fmt lint deps build test web-check-lib web-build-lib web-install-deps web-check-main web-build
# ci formatting check
ci-fmt:
deno fmt --check deno deno-test test web
# reformat all files
fmt:
deno fmt deno deno-test test web
lint:
deno lint deno test deno-test
# check web types
web-check-lib:
deno check --config web/deno.json web/lib.ts
# build web libs
web-build-lib:
deno run --allow-env --allow-net --allow-read --allow-write --allow-run web/build-lib.ts
web-check-main:
cd web && npx tsc
# install web deps
web-install-deps:
cd web && npm install
# build for the web
web-build:
deno run --check=all --allow-env --allow-net --allow-read --allow-write --allow-run web/build.ts
# run development web server for local QA
web-serve:
deno run --allow-net --allow-read=. web/serve.ts
# for faster iteration when running locally
web-build-and-serve: web-build-lib web-build web-serve
web-deploy: web-check-lib web-build web-s3-sync web-cloudflare-cache-purge
# deploy web to s3
web-s3-sync:
aws s3 sync ./dist/web "$S3_BUCKET"
# show what s3 deployment would do
web-s3-sync-dryrun:
aws s3 sync --dryrun ./dist/web "$S3_BUCKET"
# reset cloudflare cache
web-cloudflare-cache-purge:
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $CLOUDFLARE_TOKEN" \
--data '{"purge_everything":true}'
# update dependencies to latest versions
update-deps:
deno run -A https://deno.land/x/udd/main.ts import_map.json
# run all tests
test: unit-test end-to-end-test
# run unit tests
unit-test:
deno test --check=all --allow-read --allow-write --allow-run --parallel deno
# run end-to-end deno testing
end-to-end-test:
deno test --check=all --allow-read --allow-write --allow-run deno-test
# build for deno distribution
build:
deno run --check=all --allow-env --allow-net --allow-read --allow-run --allow-write deno/build.ts