Skip to content

Commit

Permalink
Use jsbt for tsconfig and building
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmillr committed Mar 17, 2024
1 parent 484250f commit 64a4f91
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 54 deletions.
1 change: 0 additions & 1 deletion .github/funding.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
github: paulmillr
# custom: https://paulmillr.com/funding/
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Node CI
name: Run node.js tests
on:
- push
- pull_request
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish Package to npm
name: Publish package to npm
on:
release:
types: [created]
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/upload-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ jobs:
node-version: 20
registry-url: 'https://registry.npmjs.org'
cache: npm
- run: npm install -g npm
- run: npm ci
- run: npm run build
- run: |
npm install -g npm
cd build
npm ci
npm run build
npm run build:release
gh release upload ${{ github.event.release.tag_name }} scure-bip39.js
cd ..
- run: gh release upload ${{ github.event.release.tag_name }} build/`npx jsbt outfile`
env:
GH_TOKEN: ${{ github.token }}
7 changes: 7 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# build

The directory is used to build a single file which contains everything.

The single file uses iife wrapper and can be used in browsers as-is.

Don't use it unless you can't use NPM/ESM, which support tree shaking.
22 changes: 11 additions & 11 deletions build/input.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
export * as bip39 from '@scure/bip39';
export { wordlist as czech } from '@scure/bip39/wordlists/czech';
export { wordlist as english } from '@scure/bip39/wordlists/english';
export { wordlist as french } from '@scure/bip39/wordlists/french';
export { wordlist as italian } from '@scure/bip39/wordlists/italian';
export { wordlist as japanese } from '@scure/bip39/wordlists/japanese';
export { wordlist as korean } from '@scure/bip39/wordlists/korean';
export { wordlist as portuguese } from '@scure/bip39/wordlists/portuguese';
export { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese';
export { wordlist as spanish } from '@scure/bip39/wordlists/spanish';
export { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese';
export * as bip39 from 'lib';
export { wordlist as czech } from 'lib/wordlists/czech';
export { wordlist as english } from 'lib/wordlists/english';
export { wordlist as french } from 'lib/wordlists/french';
export { wordlist as italian } from 'lib/wordlists/italian';
export { wordlist as japanese } from 'lib/wordlists/japanese';
export { wordlist as korean } from 'lib/wordlists/korean';
export { wordlist as portuguese } from 'lib/wordlists/portuguese';
export { wordlist as simplifiedChinese } from 'lib/wordlists/simplified-chinese';
export { wordlist as spanish } from 'lib/wordlists/spanish';
export { wordlist as traditionalChinese } from 'lib/wordlists/traditional-chinese';
14 changes: 7 additions & 7 deletions build/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
"name": "build",
"private": true,
"version": "1.0.0",
"description": "Used to build a single file",
"main": "input.js",
"keywords": [],
"type": "module",
"author": "",
"license": "MIT",
"devDependencies": {
"@scure/bip39": "..",
"lib": "file:..",
"esbuild": "0.20.1"
},
"scripts": {
"build": "npx esbuild --bundle input.js --outfile=scure-bip39.js --global-name=scureBip39"
"build:release": "npx esbuild --bundle input.js --outfile=`npx jsbt outfile` --global-name=`npx jsbt global`"
}
}
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@scure/base": "~1.1.4"
},
"devDependencies": {
"@paulmillr/jsbt": "0.1.0",
"micro-should": "0.4.0",
"prettier": "3.1.1",
"typescript": "5.3.2"
Expand Down
21 changes: 4 additions & 17 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
{
"extends": "@paulmillr/jsbt/tsconfigs/esm.json",
"compilerOptions": {
"target": "es2020",
"lib": ["es2020"],
"strict": true,
"sourceMap": false,
"allowSyntheticDefaultImports": false,
"allowUnreachableCode": false,
"esModuleInterop": false,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"baseUrl": ".",

"module": "es2020",
"outDir": "esm",
"moduleResolution": "bundler"
"moduleResolution": "bundler",
"outDir": "lib/esm"
},
"include": ["src"],
"include": ["index.ts", "src"],
"exclude": ["node_modules", "lib"]
}
12 changes: 5 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{
"extends": "./tsconfig.esm.json",
"extends": "@paulmillr/jsbt/tsconfigs/cjs.json",
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node10",
"outDir": ".",
"declaration": true,
"declarationMap": true
}
"outDir": "lib"
},
"include": ["index.ts", "src"],
"exclude": ["node_modules", "lib"]
}

0 comments on commit 64a4f91

Please sign in to comment.