Skip to content

Commit

Permalink
feat(deadline,chain)!: add ESM support; move scripts to scripty (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-johnson authored Nov 7, 2022
1 parent fe37ad2 commit b999b1a
Show file tree
Hide file tree
Showing 20 changed files with 146 additions and 28 deletions.
6 changes: 6 additions & 0 deletions .changeset/gold-papayas-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"abortcontroller-chain": major
"abortcontroller-deadline": major
---

Add ESM support. CommonJS support is retained, but this is treated as a BREAKING CHANGE since `"main"` is replaced with `"exports"` in `package.json`.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,6 @@ tags
Network Trash Folder
Temporary Items
.apdisk


dist-esm/
1 change: 1 addition & 0 deletions packages/chain/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
dist
dist-esm
.eslintrc.js
coverage
src/global.d.ts
1 change: 1 addition & 0 deletions packages/chain/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
dist-esm/
coverage/
CHANGELOG.md
38 changes: 24 additions & 14 deletions packages/chain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,37 @@
"type": "git",
"url": "https://github.com/kyle-johnson/abortcontroller-utils.git"
},
"main": "dist/index.js",
"exports": {
"import": "./dist-esm/index.mjs",
"require": "./dist/index.js"
},
"types": "dist/index.d.ts",
"files": [
"dist"
"dist",
"dist-esm"
],
"scripts": {
"type-check": "tsc --noEmit",
"lint": "eslint .",
"test": "jest",
"test:web": "jest --env=jsdom",
"test:ci": "jest --coverage --ci",
"build": "rm -rf dist && tsc -p tsconfig.dist.json",
"format": "prettier --write .",
"format:check": "prettier --check ."
"type-check": "scripty",
"lint": "scripty",
"test": "scripty",
"test:web": "scripty",
"test:ci": "scripty",
"build:esm": "scripty",
"build:cjs": "scripty",
"build": "SCRIPTY_PARALLEL=true scripty",
"format": "scripty",
"format:check": "scripty"
},
"config": {
"scripty": {
"logLevel": "warn",
"path": "../../scripts"
}
},
"jest": {
"coverageDirectory": "coverage",
"testEnvironment": "node",
"preset": "ts-jest",
"globals": {
"ts-jest": {}
}
"preset": "ts-jest"
},
"devDependencies": {
"@tsconfig/node14": "1.0.3",
Expand All @@ -52,6 +61,7 @@
"jest": "29.2.2",
"jest-environment-jsdom": "29.2.2",
"prettier": "2.7.1",
"scripty": "2.1.1",
"ts-jest": "29.0.3",
"typescript": "4.8.4"
}
Expand Down
12 changes: 12 additions & 0 deletions packages/chain/tsconfig.dist-esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.dist.json",

"compilerOptions": {
"outDir": "dist-esm",
"module": "es2022",
"sourceMap": false,
"inlineSourceMap": true,
"declaration": false,
"declarationMap": false
}
}
1 change: 1 addition & 0 deletions packages/deadline/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
dist
dist-esm
.eslintrc.js
coverage
src/global.d.ts
1 change: 1 addition & 0 deletions packages/deadline/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist/
dist-esm/
coverage/
CHANGELOG.md
38 changes: 24 additions & 14 deletions packages/deadline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,37 @@
"type": "git",
"url": "https://github.com/kyle-johnson/abortcontroller-utils.git"
},
"main": "dist/index.js",
"exports": {
"require": "./dist/index.js",
"import": "./dist-esm/index.mjs"
},
"types": "dist/index.d.ts",
"files": [
"dist"
"dist",
"dist-esm"
],
"scripts": {
"type-check": "tsc --noEmit",
"lint": "eslint .",
"test": "jest",
"test:web": "jest --env=jsdom",
"test:ci": "jest --coverage --ci",
"build": "rm -rf dist && tsc -p tsconfig.dist.json",
"format": "prettier --write .",
"format:check": "prettier --check ."
"type-check": "scripty",
"lint": "scripty",
"test": "scripty",
"test:web": "scripty",
"test:ci": "scripty",
"build:esm": "scripty",
"build:cjs": "scripty",
"build": "SCRIPTY_PARALLEL=true scripty",
"format": "scripty",
"format:check": "scripty"
},
"config": {
"scripty": {
"logLevel": "warn",
"path": "../../scripts"
}
},
"jest": {
"coverageDirectory": "coverage",
"testEnvironment": "node",
"preset": "ts-jest",
"globals": {
"ts-jest": {}
}
"preset": "ts-jest"
},
"dependencies": {
"abortcontroller-chain": "workspace:^1.0.2"
Expand All @@ -57,6 +66,7 @@
"jest": "29.2.2",
"jest-environment-jsdom": "29.2.2",
"prettier": "2.7.1",
"scripty": "2.1.1",
"ts-jest": "29.0.3",
"typescript": "4.8.4"
}
Expand Down
12 changes: 12 additions & 0 deletions packages/deadline/tsconfig.dist-esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": "./tsconfig.dist.json",

"compilerOptions": {
"outDir": "dist-esm",
"module": "es2022",
"sourceMap": false,
"inlineSourceMap": true,
"declaration": false,
"declarationMap": false
}
}
32 changes: 32 additions & 0 deletions pnpm-lock.yaml

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

3 changes: 3 additions & 0 deletions scripts/build/cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

rm -rf dist && tsc -p tsconfig.dist.json
5 changes: 5 additions & 0 deletions scripts/build/esm
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

rm -rf dist-esm && \
tsc -p tsconfig.dist-esm.json && \
find dist-esm -name '*.js' -exec sh -c 'mv "$0" "${0%.js}.mjs"' {} \;
3 changes: 3 additions & 0 deletions scripts/format/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

prettier --check .
3 changes: 3 additions & 0 deletions scripts/format/index
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

prettier --write .
3 changes: 3 additions & 0 deletions scripts/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

eslint .
3 changes: 3 additions & 0 deletions scripts/test/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

jest --coverage --ci
3 changes: 3 additions & 0 deletions scripts/test/index
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

jest
3 changes: 3 additions & 0 deletions scripts/test/web
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

jest --env=jsdom
3 changes: 3 additions & 0 deletions scripts/type-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

tsc --noEmit

0 comments on commit b999b1a

Please sign in to comment.