Skip to content

Commit e7d2885

Browse files
committed
🦕 build js faster
1 parent 6ecf12b commit e7d2885

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed

‎.github/workflows/check.yml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
python-version: 3.12
2525
cache: pip
2626
cache-dependency-path: Pipfile.lock
27+
- uses: extractions/setup-just@v2
28+
with:
29+
just-version: 1.39.0
2730
- name: Setup Deno
2831
uses: denoland/setup-deno@v1
2932
with:
@@ -49,7 +52,7 @@ jobs:
4952
- name: Generate snow
5053
run: sass -s compressed --random-seed 0 style/snow.scss style/snow.css
5154
- name: Build JS & CSS
52-
run: deno task clean && deno task build
55+
run: just clean && just build
5356
- name: Generate humans.txt
5457
run: ./scripts/humans.py
5558
- name: Sort methods

‎Justfile‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,40 @@
11
do-it:
2-
xdg-open https://youtu.be/AkygX8Fncpk
2+
@xdg-open https://youtu.be/AkygX8Fncpk
3+
4+
build:
5+
@just build_js 2> /dev/null ||:
6+
just build_css
7+
just build_js
8+
9+
build_css *args: ( esbuild '--outbase=style' '--outdir=an_website/static/css' '"style/**/*.css"' args )
10+
11+
build_js_debug *args: ( esbuild 'an_website/**/*[!_].ts' '--bundle' '"--external:/static/*"' '--legal-comments=inline' '"--footer:js=// @license-end"' '--format=esm' '--outbase=an_website' '--outdir=an_website/static/js' '"--alias:@utils/utils.js=$(./scripts/fix_static_url_path.py /static/js/utils/utils.js)"' args )
12+
13+
build_js *args: ( build_js_debug '--pure:console.log' '--pure:console.debug' args )
14+
15+
clean: clean_css clean_js
16+
./scripts/compress_static_files.py --clean
17+
18+
clean_css:
19+
rm -fr an_website/static/css
20+
21+
clean_js:
22+
rm -fr an_website/static/js
23+
24+
esbuild *args:
25+
deno run -A https://deno.land/x/esbuild@v0.24.2/mod.js --target=$(just target),chrome103,edge129,firefox115,ios11,opera114,safari15.6 --charset=utf8 --minify --sourcemap --tree-shaking=false {{args}}
26+
27+
target:
28+
#!/usr/bin/env python3
29+
from datetime import datetime, timezone
30+
print(end="es")
31+
print(min((now := datetime.now(timezone.utc)).year - (5 + (now.month < 7)), 2022))
32+
33+
watch_css: ( build_css '--watch' )
34+
35+
watch_js: ( build_js '--watch' )
36+
37+
watch_js_debug: ( build_js_debug '--watch' )
38+
39+
watman:
40+
@deno eval 'console.log(Array(16).join("wat" - 1) + " Batman!")'

‎deno.json‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
{
2-
"tasks": {
3-
"build": "deno task build:js 2> /dev/null ; deno task build:css && deno task build:js",
4-
"build:css": "deno task esbuild --outbase=style --outdir=an_website/static/css 'style/**/*.css'",
5-
"build:js:debug": "deno task esbuild an_website/**/*[!_].ts --bundle '--external:/static/*' --legal-comments=inline '--footer:js=// @license-end' --format=esm --outbase=an_website --outdir=an_website/static/js \"--alias:@utils/utils.js=$(./scripts/fix_static_url_path.py /static/js/utils/utils.js)\"",
6-
"build:js": "deno task build:js:debug --pure:console.log --pure:console.debug",
7-
"clean": "deno task clean:css && deno task clean:js && ./scripts/compress_static_files.py --clean",
8-
"clean:css": "rm -fr an_website/static/css",
9-
"clean:js": "rm -fr an_website/static/js",
10-
"esbuild": "deno run -A https://deno.land/x/[email protected]/mod.js --target=$(deno task target),chrome103,edge129,firefox115,ios11,opera114,safari15.6 --charset=utf8 --minify --sourcemap --tree-shaking=false",
11-
"target": "echo es$(python3 -c 'from datetime import datetime, timezone; print(min((now := datetime.now(timezone.utc)).year - (5 + (now.month < 7)), 2022))')",
12-
"watch:css": "deno task build:css --watch",
13-
"watch:js": "deno task build:js --watch",
14-
"watch:js:debug": "deno task build:js:debug --watch",
15-
"watman": "deno eval 'console.log(Array(16).join(\"wat\" - 1) + \" Batman!\")'"
16-
},
172
"compilerOptions": {
183
"exactOptionalPropertyTypes": true,
194
"noFallthroughCasesInSwitch": true,

0 commit comments

Comments
 (0)