-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtaskfile.yml
More file actions
167 lines (146 loc) · 5.62 KB
/
Copy pathtaskfile.yml
File metadata and controls
167 lines (146 loc) · 5.62 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# Copyright (c) 2025-2026 Ryan Johnson
# SPDX-License-Identifier: MIT
# Taskfile for running development tasks, tests, linting, and build operations.
version: '3'
vars:
NODE_MEM: 4096
tasks:
default:
desc: Show Tasks
cmds:
- task --list
silent: true
clean:
desc: Clean build artifacts.
cmds:
- echo "==> Cleaning build artifacts..."
- rm -rf dist coverage
build:
desc: Build the TypeScript source.
cmds:
- echo "==> Building TypeScript source..."
- npx tsc
lint:
desc: Run ESLint checks.
cmds:
- echo "==> Running ESLint checks..."
- npx eslint 'src/**/*.ts' '__tests__/**/*.ts'
lint:fix:
desc: Fix ESLint issue detections.
cmds:
- echo "==> Fixing ESLint issue detections..."
- npx eslint --fix 'src/**/*.ts' '__tests__/**/*.ts'
format:
desc: Format code.
cmds:
- echo "==> Formatting code..."
- npx prettier --write .
# Testing tasks.
test:
desc: Run all tests with memory optimization.
vars:
JEST_OPTS: --runInBand --detectOpenHandles --forceExit
cmds:
- echo "==> Running all tests with memory optimization..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}}
test:unit:
desc: Run unit tests.
vars:
JEST_OPTS: --runInBand --detectOpenHandles --forceExit
cmds:
- echo "==> Running unit tests..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/cache.test.ts __tests__/installer.test.ts __tests__/utils-basic.test.ts __tests__/utils-file.test.ts
test:components:
desc: Run component tests.
vars:
JEST_OPTS: --runInBand --detectOpenHandles --forceExit
cmds:
- echo "==> Running cache tests..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/cache.test.ts
- echo "==> Running installer tests..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/installer.test.ts
- echo "==> Running basic utility tests..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/utils-basic.test.ts
- echo "==> Running file operation tests..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/utils-file.test.ts
- echo "==> Running network operation tests..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/utils-network.test.ts
test:mem-light:
desc: Run lightweight tests.
vars:
JEST_OPTS: --runInBand
cmds:
- echo "==> Running lightweight tests..."
- node --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}} __tests__/cache.test.ts __tests__/installer.test.ts
test:coverage:
desc: Run tests with coverage reporting.
vars:
JEST_OPTS: --runInBand --detectOpenHandles --forceExit --coverage
cmds:
- echo "==> Running tests with coverage reporting..."
- node --expose-gc --max-old-space-size={{.NODE_MEM}} node_modules/.bin/jest {{.JEST_OPTS}}
# Development tasks.
dev:all:
desc: Run the full development workflow.
cmds:
- task: clean
- task: build
- task: lint
- task: test:unit
ci:preflight:
desc: Run all checks that CI would run, useful before pushing changes.
cmds:
- task: clean
- task: build
- task: lint
- task: test:components
# Release helpers.
generate-notice:
desc: Add third-party licenses in NOTICE.md.
cmds:
- echo "==> Adding third-party licenses to NOTICE.md..."
- mkdir -p .licenses
- npx license-checker --json > .licenses/licenses.json
- node scripts/generate-notice.js
release:prepare:
desc: Prepare the code for a release (build, test, lint, bundle).
cmds:
- npm ci
- task: clean
- npm run build
- task: lint
- task: test:components
- task: generate-notice
- task: format
- git add dist
- echo "==> Ready for release!"
check:dependencies:
desc: Check for outdated or unused dependencies.
cmds:
- echo "==> Checking for outdated dependencies..."
- npx npm-check-updates || true
- echo "==> Checking for unused dependencies..."
- npx depcheck || true
- echo "==> Run 'task update:dependencies' to update packages"
update:dependencies:
desc: Update all dependencies to their latest versions.
cmds:
- echo "==> Creating backup of package files..."
- cp package.json package.json.bak || true
- cp package-lock.json package-lock.json.bak || true
- echo "==> Updating dependencies to latest versions..."
- npx npm-check-updates -u --peer
- echo "==> Installing updated packages..."
- npm install
- echo "==> Running tests to verify updates..."
- npm test || { echo "Tests failed after update, consider reverting with 'task update:dependencies:revert'"; exit 1; }
- echo "==> Dependencies updated successfully!"
update:dependencies:revert:
desc: Revert to backup package files if update fails.
cmds:
- echo "==> Reverting to backup package files..."
- test -f package.json.bak && mv package.json.bak package.json || echo "No package.json backup found"
- test -f package-lock.json.bak && mv package-lock.json.bak package-lock.json || echo "No package-lock.json backup found"
- echo "==> Reinstalling original dependencies..."
- npm install
- echo "==> Reverted to previous dependency state"