Skip to content

Commit 9bab0eb

Browse files
shrujalshah2812wrigja
authored andcommitted
add script to copy types for commonjs module system
1 parent 92569be commit 9bab0eb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

copy-types.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { cp } from 'node:fs/promises';
2+
3+
await cp('index.d.ts', 'index.d.cts');

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"types": "./index.d.ts",
1414
"default": "./dist/index.esm.js"
1515
},
16+
"require": {
17+
"types": "./index.d.cts",
18+
"default": "./dist/index.cjs"
19+
},
1620
"default": "./dist/index.cjs"
1721
},
1822
"./dist/index.cjs"
@@ -25,7 +29,7 @@
2529
"testValidStrings": "npm run build && node --experimental-modules --experimental-specifier-resolution=node --no-warnings --icu-data-dir ./node_modules/full-icu/ --loader ./test/resolve.source.mjs test/validStrings.mjs",
2630
"build": "rm -rf dist/* tsc-out/* && tsc && rollup -c rollup.config.js",
2731
"prepare": "npm run build",
28-
"prepublishOnly": "npm run build",
32+
"prepublishOnly": "node copy-types.mjs && npm run build",
2933
"update": "npx npm-check-updates -u -x @pipobscure/demitasse && npm install",
3034
"playground": "TEMPORAL_PLAYGROUND=1 npm run build && node --experimental-modules --no-warnings --icu-data-dir node_modules/full-icu -r ./dist/playground.cjs",
3135
"lint": "eslint . --ext ts,js,mjs,.d.ts --max-warnings 0 --cache \"$@\" && npm run prettier",
@@ -69,6 +73,7 @@
6973
"license": "ISC",
7074
"files": [
7175
"index.d.ts",
76+
"index.d.cts",
7277
"dist",
7378
"lib",
7479
"CHANGELOG.md"

0 commit comments

Comments
 (0)