Repository navigation
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
141 lines (121 loc) · 4.01 KB
/
Copy pathTaskfile.yaml
File metadata and controls
141 lines (121 loc) · 4.01 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# https://taskfile.dev
version: "3"
set: [pipefail]
vars:
SWITCHBOARD_DB: "{{.HOME}}/.switchboard/switchboard.db"
SWITCHBOARD_DEV_DATA_DIR: "{{.HOME}}/.switchboard-dev"
tasks:
default:
desc: List all available tasks
silent: true
cmds:
- task --list
install:
desc: Install npm dependencies
cmds:
- npm install
dev:
desc: Launch Switchboard in development mode (Electron, no-sandbox, isolated DB)
silent: true
env:
# Force a separate SQLite DB so a running AppImage isn't disturbed by the
# dev electron sharing session_cache. Override per-run with
# `SWITCHBOARD_DATA_DIR=/some/other/dir task dev`.
SWITCHBOARD_DATA_DIR: "{{.SWITCHBOARD_DEV_DATA_DIR}}"
cmds:
- npx electron . --no-sandbox
"db:reset:dev":
desc: Wipe just the dev SQLite database
cmds:
- rm -f "{{.SWITCHBOARD_DEV_DATA_DIR}}/switchboard.db" "{{.SWITCHBOARD_DEV_DATA_DIR}}/switchboard.db-wal" "{{.SWITCHBOARD_DEV_DATA_DIR}}/switchboard.db-shm"
- echo "Removed {{.SWITCHBOARD_DEV_DATA_DIR}}/switchboard.db"
build:
desc: Build Linux distribution packages (AppImage + deb)
silent: true
cmds:
- npm run build:linux
test:
desc: Run the node:test suite (24 tests)
cmds:
- npm test
coverage:
desc: Run the test suite under c8 (text + lcov in ./coverage)
cmds:
- npm run coverage
e2e:
desc: Run the Playwright journeys against the real Electron app (Linux; see docs/e2e.md)
cmds:
- npm run bundle:codemirror
- npm run bundle:mermaid
- |
if [ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] && command -v xvfb-run >/dev/null 2>&1; then
xvfb-run -a -s "-screen 0 1920x1080x24" npm run e2e
else
npm run e2e
fi
lint:
desc: Run ESLint across the codebase
cmds:
- |
if [ ! -f eslint.config.js ] && [ ! -f .eslintrc.js ] && [ ! -f .eslintrc.json ] && [ ! -f .eslintrc.yaml ] && [ ! -f .eslintrc.yml ]; then
echo "ESLint not yet configured; run \`task install:lint\` first"
exit 1
fi
npx eslint .
"install:lint":
desc: Install ESLint + jsdom dev deps (idempotent)
cmds:
- |
MISSING=""
node -e "require('eslint')" 2>/dev/null || MISSING="$MISSING eslint"
node -e "require('jsdom')" 2>/dev/null || MISSING="$MISSING jsdom"
if [ -n "$MISSING" ]; then
npm install --save-dev $MISSING
else
echo "ESLint and jsdom already installed — nothing to do."
fi
"check:fast":
desc: Lint staged JS and run matching tests
cmds:
- node scripts/check-fast.js
check:
desc: Run tests + lint (pre-commit / pre-push gate)
deps: [test, lint]
ci:
desc: CI gate — runs test then lint, verbose, exits on first failure
cmds:
- npm test
- npx eslint .
clean:
desc: Remove dist/, viewer bundles, and local DB (asks for confirmation)
interactive: true
cmds:
- |
read -p "This will delete dist/, public/codemirror-bundle.js, public/mermaid-bundle.js, and {{.SWITCHBOARD_DB}}. Type YES to confirm: " ans
[ "$ans" = "YES" ]
- rm -rf dist/
- rm -f public/codemirror-bundle.js public/mermaid-bundle.js
- rm -f "{{.SWITCHBOARD_DB}}"
- echo "Clean complete."
"db:reset":
desc: Wipe the local Switchboard SQLite database (no confirmation)
cmds:
- rm -f "{{.SWITCHBOARD_DB}}"
- echo "Removed {{.SWITCHBOARD_DB}}"
test-pr:
desc: "Run a PR alongside the live app; ISOLATED=1 uses fixtures. See docs/testing-a-pr.md"
silent: true
env:
PR: "{{.PR}}"
ISOLATED: '{{.ISOLATED | default "0"}}'
ALLOW_CLAUDE: '{{.ALLOW_CLAUDE | default "0"}}'
DEBUG_PORT: '{{.DEBUG_PORT | default "9223"}}'
cmds:
- node scripts/test-pr.js
"test-pr:clean":
desc: "Remove the test-pr dependency link, worktree and data dir; requires PR=<number>"
silent: true
env:
PR: "{{.PR}}"
cmds:
- node scripts/test-pr.js --clean