Skip to content

Commit

Permalink
feat: drop node12, minify package
Browse files Browse the repository at this point in the history
  • Loading branch information
ruicsh committed Jul 15, 2022
1 parent fd4c2b5 commit 50fe5fe
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 27 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ jobs:
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: yarn install --frozen-lockfile
- run: yarn build
- run: |
yarn install --frozen-lockfile
yarn build
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
branch: main
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/.nyc_output
/coverage
/node_modules
/cjs
/dist
/coverage
/e2e/node_modules
/e2e/yarn.lock
35 changes: 21 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,27 @@
"license": "MIT",
"keywords": [
"numbers",
"formatting"
"formatting",
"Intl.NumberFormat"
],
"types": "dist/index.d.ts",
"module": "./dist/index.esm.js",
"main": "./dist/index.cjs.js",
"exports": {
".": [
{
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"default": "./dist/index.esm.js"
},
"./dist/index.esm.js"
]
},
"files": [
"cjs/index.js",
"dist/index.mjs",
"dist/index.esm.js",
"dist/index.cjs.js",
"dist/index.d.ts"
],
"main": "./cjs/index.js",
"module": "./dist/index.mjs",
"types": "dist/index.d.ts",
"engines": {
"node": ">=12"
},
"devDependencies": {
"@types/jest": "28.1.4",
"@types/node": "18.0.0",
Expand All @@ -46,11 +54,6 @@
"test:ci": "LANG=en-GB jest --ci",
"test": "LANG=en-GB jest --watch"
},
"release": {
"branches": [
"main"
]
},
"jest": {
"roots": [
"<rootDir>/src"
Expand Down Expand Up @@ -106,5 +109,9 @@
"trailingComma": "es5",
"printWidth": 80,
"useTabs": true
},
"volta": {
"node": "18.6.0",
"yarn": "1.22.19"
}
}
17 changes: 12 additions & 5 deletions sh/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@ set -euo pipefail

main() {
rm -rf dist
rm -rf cjs
tsc --build tsconfig.build.json

esbuild src/cjs/index.cjs --bundle --platform=node --outfile=dist/index.cjs
esbuild src/index.ts --bundle --platform=node --format=esm --outfile=dist/index.mjs
esbuild src/index.ts \
--bundle \
--minify \
--outfile=dist/index.cjs.js

# node12 compatibility
mkdir cjs && cp dist/index.cjs cjs/index.js
esbuild src/index.ts \
--bundle \
--format=esm \
--minify \
--outfile=dist/index.esm.js

rm dist/index.js
rm -rf dist/formats dist/helpers dist/options
}

main
3 changes: 0 additions & 3 deletions src/cjs/index.cjs

This file was deleted.

0 comments on commit 50fe5fe

Please sign in to comment.