Skip to content

Commit 4122ca9

Browse files
committed
Add build system; remove BigNumber.DEBUG; add toObject method
- Implement targeted builds (build.js) for ESM (.mjs), CommonJS (.cjs), and browser (.js) distributables in dist/, with matching type declarations (.d.mts, .d.cts, .d.ts). - Remove BigNumber.DEBUG. The constructor now always throws on invalid input instead of returning NaN. isBigNumber always validates structure. - Don't call toString on arbitrary objects passed to the constructor. - Require value to be a string when a base is also passed. - Add toObject prototype method. - Add CI workflow and TypeScript type declaration import tests. - Add .gitignore and .gitattributes; normalise line endings. - Remove .npmignore; use 'files' field in package.json. - Add typescript to devDependencies. - Update README, API docs, and type declarations.
1 parent a7bc1f1 commit 4122ca9

39 files changed

Lines changed: 5805 additions & 8410 deletions

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Enforce LF normalization for all text files
2+
* text=auto

.github/workflows/ci.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
strategy:
15+
# Build script requires Node.js >= 14.14.0.
1516
matrix:
16-
node-version: ['8', '18', '20', '22']
17+
node-version: ['14', '20', 'lts/*', 'node']
1718
fail-fast: false
1819

1920
steps:
@@ -24,5 +25,31 @@ jobs:
2425
with:
2526
node-version: ${{ matrix.node-version }}
2627

27-
- name: Run Tests
28-
run: node test/test
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Run JS tests
32+
run: npm test
33+
34+
typecheck:
35+
name: Type-check
36+
needs: test
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Use Node.js node
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: 'node'
46+
47+
- name: Install dependencies
48+
run: npm install
49+
50+
- name: Build
51+
run: npm run build
52+
53+
- name: Type-check
54+
run: npm run typecheck
55+

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
dist/
2+
node_modules/
3+
coverage/
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
package-lock.json
8+
npm-shrinkwrap.json
9+
.env
10+
.vscode/
11+
.idea/
12+
.DS_Store
13+
*.log

.npmignore

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

0 commit comments

Comments
 (0)