Skip to content

Commit 94f6f62

Browse files
Port library to typescript and modernize tooling
* Copy not in operator from msironi * Throw error when indexing using a number * Add json function * Update packages * Conversion to typescript * Use ESM instead of CommonJS * Update linter * Replace Rollup by Vite * Replace Travis CI with GitHub Actions * Optimize exports for tree-shaking * Typechecking using tsgo * Increase test coverage
1 parent db78c0b commit 94f6f62

128 files changed

Lines changed: 22891 additions & 8928 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

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

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18, 20, 22]
16+
# Testing on LTS and current versions
17+
# Note: Removed older versions (6-12) as they are EOL
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Run lint
33+
run: npm run lint
34+
35+
- name: Run type check
36+
run: npm run type-check
37+
38+
- name: Run tests
39+
run: npm test
40+
41+
- name: Run coverage
42+
if: matrix.node-version == 20 # Only run coverage on Node 20
43+
run: npm run coverage
44+
45+
- name: Upload coverage to Codecov
46+
if: matrix.node-version == 20
47+
uses: codecov/codecov-action@v4
48+
with:
49+
file: ./coverage/lcov.info
50+
fail_ci_if_error: false
51+
52+
build:
53+
runs-on: ubuntu-latest
54+
needs: test
55+
56+
steps:
57+
- name: Checkout code
58+
uses: actions/checkout@v4
59+
60+
- name: Setup Node.js
61+
uses: actions/setup-node@v4
62+
with:
63+
node-version: 20
64+
cache: 'npm'
65+
66+
- name: Install dependencies
67+
run: npm ci
68+
69+
- name: Build
70+
run: npm run build
71+
72+
- name: Upload build artifacts
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: dist
76+
path: dist/

.github/workflows/publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
registry-url: https://registry.npmjs.org/
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests
26+
run: npm test
27+
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Publish to npm
32+
run: npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@ dist
33
coverage
44
.idea
55
.nyc_output
6-
package-lock.json
6+
7+
# TypeScript
8+
*.tsbuildinfo
9+
*.d.ts.map
10+
.tscache/
11+

.travis.yml

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

.vscode/settings.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"@/*": ["src/*"]
6+
}
7+
},
8+
"typescript.preferences.importModuleSpecifier": "relative",
9+
"typescript.suggest.autoImports": true,
10+
"typescript.preferences.includePackageJsonAutoImports": "auto",
11+
"typescript.experimental.useTsgo": true,
12+
"editor.formatOnSave": true,
13+
"editor.codeActionsOnSave": {
14+
"source.fixAll.eslint": "explicit"
15+
},
16+
"files.eol": "\n",
17+
"typescript.format.semicolons": "insert",
18+
"typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": true,
19+
"typescript.format.insertSpaceBeforeFunctionParenthesis": false
20+
}

CHANGELOG.md

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

0 commit comments

Comments
 (0)