Skip to content

Commit 4cc0ffc

Browse files
authored
v2.0.0: Full TypeScript modernization (#10)
* chore: setup modern toolchain Replace Gulp/Browserify/Mocha with tsup/Vitest/Biome. package.json v2.0.0, ESM+CJS dual exports, Node 20+. tsconfig.json strict, ES2022 target. Assisted-by: 🤖 claude-opus-4-6@default * refactor: migrate source to TypeScript Eid, exceptions, preconditions rewritten as typed classes. ES2022 Error.cause support in all exception constructors. tryToExecute preserves original error as cause. Assisted-by: 🤖 claude-opus-4-6@default * refactor: migrate tests to Vitest 59 tests, 100% coverage. Mocha+expect.js replaced with Vitest. Added cause chaining tests for exceptions and tryToExecute. Assisted-by: 🤖 claude-opus-4-6@default * ci: replace Travis with GitHub Actions Node 20+22 matrix, lint/test/build jobs. Concurrency control, timeout protection. Assisted-by: 🤖 claude-opus-4-6@default * chore: remove legacy files Drop gulp/, bower.json, .travis.yml, dist/, gulpfile.js. Drop old lib/ and test/ (replaced by src/). Assisted-by: 🤖 claude-opus-4-6@default * docs: update README for v2 Defensive programming framing, ESM/CJS/browser examples. Error.cause docs, rewritten EidPreconditions section. Drop Bower, update badges to GitHub Actions. Assisted-by: 🤖 claude-opus-4-6@default * fix: address review feedback CI: add permissions: contents: read, persist-credentials: false. package.json: nested types in exports for CJS/ESM, add typecheck script. eid.ts: fix %s injection in JFormatter (single-pass replace). preconditions.ts: fix off-by-one in checkElementIndex (index >= size). index.ts: remove misleading backward compat block. Assisted-by: 🤖 claude-opus-4-6@default * fix: restore Eid.preconditions and Eid.exceptions for backward compat Attach preconditions and exceptions as static properties on Eid class. Legacy consumers using Eid.preconditions.checkNotNull() still work. Assisted-by: 🤖 claude-opus-4-6@default
1 parent e4c8df6 commit 4cc0ffc

36 files changed

Lines changed: 4559 additions & 2615 deletions

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, develop]
6+
pull_request:
7+
branches: [master, develop]
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
lint:
18+
name: Lint
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 5
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
persist-credentials: false
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: 22
28+
cache: npm
29+
- run: npm ci
30+
- run: npx biome check src/
31+
32+
test:
33+
name: Test (Node ${{ matrix.node-version }})
34+
runs-on: ubuntu-latest
35+
timeout-minutes: 10
36+
strategy:
37+
matrix:
38+
node-version: [20, 22]
39+
steps:
40+
- uses: actions/checkout@v4
41+
with:
42+
persist-credentials: false
43+
- uses: actions/setup-node@v4
44+
with:
45+
node-version: ${{ matrix.node-version }}
46+
cache: npm
47+
- run: npm ci
48+
- run: npm run test:coverage
49+
50+
build:
51+
name: Build
52+
runs-on: ubuntu-latest
53+
timeout-minutes: 5
54+
needs: [lint, test]
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
persist-credentials: false
59+
- uses: actions/setup-node@v4
60+
with:
61+
node-version: 22
62+
cache: npm
63+
- run: npm ci
64+
- run: npm run build

.gitignore

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Build output
5+
dist/
6+
7+
# Coverage
8+
coverage/
9+
110
# Logs
2-
logs
311
*.log
412

513
# Runtime data
6-
pids
714
*.pid
815
*.seed
916

10-
# Directory for instrumented libs generated by jscoverage/JSCover
11-
lib-cov
12-
13-
# Coverage directory used by tools like istanbul
14-
coverage
15-
16-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17-
.grunt
18-
19-
# node-waf configuration
20-
.lock-wscript
17+
# OS files
18+
.DS_Store
19+
Thumbs.db
2120

22-
# Compiled binary addons (http://nodejs.org/api/addons.html)
23-
build/Release
21+
# IDE
22+
.idea/
23+
.vscode/
24+
*.swp
25+
*.swo
2426

25-
# Dependency directory
26-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
27-
node_modules
28-
target/
27+
# Temp
28+
.ai/

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)