-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yml
91 lines (77 loc) · 2.01 KB
/
Taskfile.yml
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
version: '3'
tasks:
install:
desc: Install dependencies
cmds:
- bun install
ci:
cmds:
- bun install --frozen-lockfile
test:
desc: Run tests
cmds:
- bun test
- task: test:code
dev:
desc: Run tests in watch mode
cmds:
- bun test --watch
check:
desc: Check for issues
cmds:
- bunx --bun tsc
- task: prettier
vars:
PRETTIER_ARGS: --check
fix:
desc: Fix issues
cmds:
- task: prettier
vars:
PRETTIER_ARGS: --write
prettier:
cmds:
- bunx --bun prettier "./**/*.{html,ts,tsx,json,js,jsx,cjs,css}" {{.PRETTIER_ARGS}}
build:
desc: Build the distributables
cmds:
- rm -rf dist/*
- task: build:main
- task: build:dist
- task: build:code
build:main:
desc: Build the main web app
cmds:
- mkdir -p dist
- cp src/index.html dist/index.html
- bun build ./src/main.ts --outfile=dist/main.js --minify
build:dist:
desc: Build the distributable TS source
cmds:
- mkdir -p dist
- echo '/* eslint-disable */' > dist/dist.ts
- echo '// @ts-nocheck' >> dist/dist.ts
- echo '//! https://github.com/Pistonite/addtime' >> dist/dist.ts
- echo '' >> dist/dist.ts
- cat src/time.ts >> dist/dist.ts
build:code:
desc: Build the distributable Google Apps Script
cmds:
- mkdir -p dist temp
- bun build ./src/code.ts --outfile=temp/code.ts --minify
- sed -i -e '1s/^/var AdderOfTime=(function(){ /' temp/code.ts
- sed -i -e 's/window\.__export=/;return /' temp/code.ts
- cp src/code.gs dist/appscript.txt
- cat temp/code.ts >> dist/appscript.txt
- echo '})()' >> dist/appscript.txt
test:code:
desc: Test the Google Apps Script
cmds:
- task: build:code
- cp dist/appscript.txt temp/appscript.e2e.js
- cat src/code.e2e.js >> temp/appscript.e2e.js
- bun temp/appscript.e2e.js
serve:
desc: Serve /dist
cmds:
- bunx --bun serve dist