diff --git a/.github/funding.yml b/.github/funding.yml index 43f16ab..09d9be7 100644 --- a/.github/funding.yml +++ b/.github/funding.yml @@ -1,2 +1 @@ github: paulmillr -# custom: https://paulmillr.com/funding/ \ No newline at end of file diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 9b2c2c0..81bf353 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -1,4 +1,4 @@ -name: Node CI +name: Run node.js tests on: - push - pull_request diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 339e831..cd57db8 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,4 +1,4 @@ -name: Publish Package to npm +name: Publish package to npm on: release: types: [created] diff --git a/.github/workflows/upload-release.yml b/.github/workflows/upload-release.yml index 7d63543..b8c2ca9 100644 --- a/.github/workflows/upload-release.yml +++ b/.github/workflows/upload-release.yml @@ -15,13 +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 - npm ci - npm run build cd build npm ci - npm run build - gh release upload ${{ github.event.release.tag_name }} noble-curves.js + npm run build:release + cd .. + - run: gh release upload ${{ github.event.release.tag_name }} build/`npx jsbt outfile` env: GH_TOKEN: ${{ github.token }} diff --git a/build/README.md b/build/README.md index 2c30e68..c1752b2 100644 --- a/build/README.md +++ b/build/README.md @@ -1,7 +1,7 @@ # build -The directory is used to build a single file `noble-curves.js` which contains everything. +The directory is used to build a single file which contains everything. -The output file uses iife wrapper and can be used in browsers as-is. +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. diff --git a/build/package-lock.json b/build/package-lock.json index 8761c1b..d6d43b9 100644 --- a/build/package-lock.json +++ b/build/package-lock.json @@ -7,14 +7,12 @@ "": { "name": "build", "version": "1.0.0", - "license": "MIT", "devDependencies": { "@noble/curves": "file:..", "esbuild": "0.20.1" } }, "..": { - "name": "@noble/curves", "version": "1.4.0", "dev": true, "license": "MIT", @@ -22,6 +20,7 @@ "@noble/hashes": "1.4.0" }, "devDependencies": { + "@paulmillr/jsbt": "0.1.0", "fast-check": "3.0.0", "micro-bmark": "0.3.1", "micro-should": "0.4.0", diff --git a/build/package.json b/build/package.json index fa4caf8..8cc0e35 100644 --- a/build/package.json +++ b/build/package.json @@ -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": { "@noble/curves": "file:..", "esbuild": "0.20.1" }, "scripts": { - "build": "npx esbuild --bundle input.js --outfile=noble-curves.js --global-name=nobleCurves" + "build:release": "npx esbuild --bundle input.js --outfile=`npx jsbt outfile` --global-name=`npx jsbt global`" } } diff --git a/package-lock.json b/package-lock.json index ac4e80d..94cd854 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,17 +1,18 @@ { "name": "@noble/curves", - "version": "1.3.0", + "version": "1.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@noble/curves", - "version": "1.3.0", + "version": "1.4.0", "license": "MIT", "dependencies": { "@noble/hashes": "1.4.0" }, "devDependencies": { + "@paulmillr/jsbt": "0.1.0", "fast-check": "3.0.0", "micro-bmark": "0.3.1", "micro-should": "0.4.0", @@ -33,6 +34,15 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@paulmillr/jsbt": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@paulmillr/jsbt/-/jsbt-0.1.0.tgz", + "integrity": "sha512-TdowoHD36hkZARv6LW4jenkVTdK2vP0sy4ZM8E9MxaqAAIRdwmn3RlB+zWkEHi4hKTgLqMGkURfNkFtt0STX2Q==", + "dev": true, + "bin": { + "jsbt": "jsbt.js" + } + }, "node_modules/fast-check": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.0.0.tgz", diff --git a/package.json b/package.json index 0d2c118..04b11dc 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "@noble/hashes": "1.4.0" }, "devDependencies": { + "@paulmillr/jsbt": "0.1.0", "fast-check": "3.0.0", "micro-bmark": "0.3.1", "micro-should": "0.4.0", diff --git a/tsconfig.esm.json b/tsconfig.esm.json index ec6b547..2ba82da 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -1,25 +1,8 @@ { + "extends": "@paulmillr/jsbt/tsconfigs/esm.json", "compilerOptions": { - "target": "es2020", - "lib": ["es2020"], - "strict": true, - "sourceMap": true, - "allowSyntheticDefaultImports": false, - "allowUnreachableCode": false, - "esModuleInterop": false, - "noFallthroughCasesInSwitch": true, - "noImplicitReturns": true, - "noUncheckedIndexedAccess": false, - "noUnusedLocals": true, - "noUnusedParameters": true, - "baseUrl": ".", - "paths": { - "@noble/hashes/crypto": ["src/crypto.ts"] - }, - "module": "Node16", - "outDir": "esm", - "moduleResolution": "Node16" + "outDir": "esm" }, - "include": ["src"], + "include": ["index.ts", "src"], "exclude": ["node_modules", "lib"] } diff --git a/tsconfig.json b/tsconfig.json index 763639d..19d555e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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": "." + }, + "include": ["index.ts", "src"], + "exclude": ["node_modules", "lib"] }