Skip to content

Commit 4bf11fe

Browse files
fix: TS node16 from CJS usage
1 parent 465a5ce commit 4bf11fe

File tree

4 files changed

+246
-14
lines changed

4 files changed

+246
-14
lines changed

.github/workflows/test.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,58 @@ jobs:
2727
- run: yarn install --frozen-lockfile
2828
- run: yarn ci
2929

30+
test-commonjs-example:
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v4
34+
- uses: actions/setup-node@v4
35+
with:
36+
node-version: 20
37+
- run: yarn install --frozen-lockfile
38+
- run: yarn install --frozen-lockfile
39+
working-directory: ./examples/commonjs
40+
- run: yarn test
41+
working-directory: ./examples/commonjs
42+
43+
test-typescript-bundler-example:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
- uses: actions/setup-node@v4
48+
with:
49+
node-version: 20
50+
- run: yarn install --frozen-lockfile
51+
- run: yarn install --frozen-lockfile
52+
working-directory: ./examples/typescript-bundler
53+
- run: yarn test
54+
working-directory: ./examples/typescript-bundler
55+
56+
test-typescript-legacy-example:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: actions/setup-node@v4
61+
with:
62+
node-version: 20
63+
- run: yarn install --frozen-lockfile
64+
- run: yarn install --frozen-lockfile
65+
working-directory: ./examples/typescript-legacy
66+
- run: yarn test
67+
working-directory: ./examples/typescript-legacy
68+
69+
test-typescript-nodenext-example:
70+
runs-on: ubuntu-latest
71+
steps:
72+
- uses: actions/checkout@v4
73+
- uses: actions/setup-node@v4
74+
with:
75+
node-version: 20
76+
- run: yarn install --frozen-lockfile
77+
- run: yarn install --frozen-lockfile
78+
working-directory: ./examples/typescript-nodenext
79+
- run: yarn test
80+
working-directory: ./examples/typescript-nodenext
81+
3082
test-vue-example:
3183
runs-on: ubuntu-latest
3284
steps:

package.json

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@guidepup/virtual-screen-reader",
3-
"version": "0.26.0",
3+
"version": "0.26.1",
44
"description": "Virtual Screen Reader driver for unit test automation.",
55
"author": "Craig Morten <[email protected]>",
66
"license": "MIT",
@@ -19,18 +19,27 @@
1919
"a11y",
2020
"guidepup"
2121
],
22-
"main": "./lib/cjs/index.cjs",
22+
"main": "./lib/cjs/index.js",
2323
"types": "./lib/cjs/index.d.ts",
2424
"module": "./lib/esm/index.legacy-esm.js",
2525
"exports": {
2626
"./package.json": "./package.json",
2727
".": {
28-
"types": "./lib/esm/index.d.mts",
29-
"import": "./lib/esm/index.mjs",
30-
"require": "./lib/cjs/index.cjs",
31-
"default": "./lib/cjs/index.cjs"
28+
"import": {
29+
"types": "./lib/esm/index.d.mts",
30+
"default": "./lib/esm/index.mjs"
31+
},
32+
"require": {
33+
"types": "./lib/cjs/index.d.ts",
34+
"default": "./lib/cjs/index.cjs"
35+
},
36+
"default": {
37+
"types": "./lib/cjs/index.d.ts",
38+
"default": "./lib/cjs/index.cjs"
39+
}
3240
},
3341
"./browser.js": {
42+
"unpkg": "./lib/esm/index.browser.js",
3443
"browser": "./lib/esm/index.browser.js",
3544
"import": "./lib/esm/index.browser.js",
3645
"default": "./lib/esm/index.browser.js"
@@ -39,14 +48,15 @@
3948
"sideEffects": false,
4049
"scripts": {
4150
"build": "yarn clean && yarn compile",
42-
"ci": "yarn clean && yarn lint && yarn test:coverage && yarn build",
51+
"ci": "yarn clean && yarn lint && yarn test:coverage && yarn build && yarn types:test",
4352
"clean": "rimraf lib",
4453
"compile": "tsup",
4554
"lint": "eslint src test --cache",
4655
"lint:fix": "yarn lint --fix",
4756
"prepublish": "yarn build",
4857
"test": "jest",
4958
"test:coverage": "yarn test --coverage",
59+
"types:test": "attw --pack . --exclude-entrypoints browser.js",
5060
"wpt:hosts": "./test/wpt/wpt make-hosts-file | sudo tee -a /etc/hosts",
5161
"wpt:init": "git submodule update --init --recursive",
5262
"wpt:reset": "rimraf ./test/wpt && yarn wpt:init",
@@ -61,6 +71,7 @@
6171
"dom-accessibility-api": "^0.6.3"
6272
},
6373
"devDependencies": {
74+
"@arethetypeswrong/cli": "^0.15.3",
6475
"@testing-library/jest-dom": "^6.4.6",
6576
"@testing-library/react": "^16.0.0",
6677
"@types/expect": "^24.3.0",

tsup.config.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { dependencies } from "./package.json";
33

44
export default defineConfig((options) => {
55
const commonOptions: Partial<Options> = {
6+
clean: true,
67
entry: {
78
index: "src/index.ts",
89
},
@@ -17,7 +18,6 @@ export default defineConfig((options) => {
1718
format: ["esm"],
1819
outExtension: () => ({ js: ".mjs" }),
1920
dts: true,
20-
clean: true,
2121
outDir: "./lib/esm/",
2222
},
2323
// Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
@@ -42,6 +42,7 @@ export default defineConfig((options) => {
4242
},
4343
format: ["esm"],
4444
outExtension: () => ({ js: ".js" }),
45+
dts: true,
4546
minify: true,
4647
noExternal: Object.keys(dependencies),
4748
skipNodeModulesBundle: false,
@@ -54,15 +55,13 @@ export default defineConfig((options) => {
5455
format: ["cjs"],
5556
outExtension: () => ({ js: ".cjs" }),
5657
dts: true,
57-
clean: true,
5858
outDir: "./lib/cjs/",
5959
},
6060
// CJS old extension
6161
{
6262
...commonOptions,
6363
format: ["cjs"],
6464
outExtension: () => ({ js: ".js" }),
65-
clean: true,
6665
outDir: "./lib/cjs/",
6766
},
6867
] as Options[];

0 commit comments

Comments
 (0)