fix(package.json): Provide correct types for moduleResolution: node, node10, and node16 (#16)

* fix: remove unnecessary exports overriding

* Revert "fix: remove unnecessary exports overriding"

This reverts commit f8534a14c1.

* chore(package.json): add types field in publishConfig.exports

* build: Support moduleResolution: node10 and node16 (nodenext)

* build: Support moduleResolution: node10 and node16 (nodenext)

* build: Support moduleResolution: node10 and node16 (nodenext)

* fix delay

* Update .gitignore

Co-authored-by: Jonghyeon Ko <jonghyeon@toss.im>

* Update .scripts/postbuild.sh

Co-authored-by: Jonghyeon Ko <jonghyeon@toss.im>

---------

Co-authored-by: raon0211 <raon0211@toss.im>
This commit is contained in:
Jonghyeon Ko 2024-06-03 22:30:32 +09:00 committed by GitHub
parent 17096774e7
commit 848f2c66ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 22 additions and 4 deletions

2
.gitignore vendored
View File

@ -16,3 +16,5 @@ dist
esm
.junit
out
*.d.ts
*.tgz

6
.scripts/postbuild.sh Executable file
View File

@ -0,0 +1,6 @@
echo "export * from './dist/array';" > array.d.ts
echo "export * from './dist/function';" > function.d.ts
echo "export * from './dist/math';" > math.d.ts
echo "export * from './dist/object';" > object.d.ts
echo "export * from './dist/predicate';" > predicate.d.ts
echo "export * from './dist/promise';" > promise.d.ts

View File

@ -18,36 +18,46 @@
},
"files": [
"dist/**/*",
"esm/**/*"
"esm/**/*",
"*.d.ts"
],
"publishConfig": {
"access": "public",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./esm/index.mjs",
"require": "./dist/index.js"
},
"./array": {
"types": "./dist/array/index.d.ts",
"import": "./esm/array/index.mjs",
"require": "./dist/array/index.js"
},
"./function": {
"types": "./dist/function/index.d.ts",
"import": "./esm/function/index.mjs",
"require": "./dist/function/index.js"
},
"./math": {
"types": "./dist/math/index.d.ts",
"import": "./esm/math/index.mjs",
"require": "./dist/math/index.js"
},
"./object": {
"types": "./dist/object/index.d.ts",
"import": "./esm/object/index.mjs",
"require": "./dist/object/index.js"
},
"./predicate": {
"types": "./dist/predicate/index.d.ts",
"import": "./esm/predicate/index.mjs",
"require": "./dist/predicate/index.js"
},
"./promise": {
"types": "./dist/promise/index.d.ts",
"import": "./esm/promise/index.mjs",
"require": "./dist/promise/index.js"
},
@ -81,7 +91,7 @@
"sideEffects": false,
"scripts": {
"prepack": "yarn build",
"build": "rm -rf dist esm && tsc -p tsconfig.json --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js",
"build": "rm -rf dist esm && tsc -p tsconfig.json --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js && ./.scripts/postbuild.sh",
"test": "vitest run --coverage --typecheck"
}
}

View File

@ -8,6 +8,6 @@ describe('delay', () => {
await delay(100);
const end = performance.now()
expect(end - start).greaterThanOrEqual(100)
expect(end - start).greaterThanOrEqual(99)
});
})