Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(*): migrate rollup to tsup, support esm correctly, remove *.spec.* for dist #21

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
node_modules
coverage
dist
esm
.junit
out
*.d.ts
Expand Down
88 changes: 61 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,84 @@
"./package.json": "./package.json"
},
"files": [
"dist/**/*",
"esm/**/*",
"dist",
"*.d.ts"
],
"publishConfig": {
"access": "public",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./esm/index.mjs",
"require": "./dist/index.js"
"import": {
"types": "./dist/index.d.mts",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.d.mts is generated by tsup default

#16 (comment)

"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./array": {
"types": "./dist/array/index.d.ts",
"import": "./esm/array/index.mjs",
"require": "./dist/array/index.js"
"import": {
"types": "./dist/array/index.d.mts",
"default": "./dist/array/index.mjs"
},
"require": {
"types": "./dist/array/index.d.ts",
"default": "./dist/array/index.js"
}
},
"./function": {
"types": "./dist/function/index.d.ts",
"import": "./esm/function/index.mjs",
"require": "./dist/function/index.js"
"import": {
"types": "./dist/function/index.d.mts",
"default": "./dist/function/index.mjs"
},
"require": {
"types": "./dist/function/index.d.ts",
"default": "./dist/function/index.js"
}
},
"./math": {
"types": "./dist/math/index.d.ts",
"import": "./esm/math/index.mjs",
"require": "./dist/math/index.js"
"import": {
"types": "./dist/math/index.d.mts",
"default": "./dist/math/index.mjs"
},
"require": {
"types": "./dist/math/index.d.ts",
"default": "./dist/math/index.js"
}
},
"./object": {
"types": "./dist/object/index.d.ts",
"import": "./esm/object/index.mjs",
"require": "./dist/object/index.js"
"import": {
"types": "./dist/object/index.d.mts",
"default": "./dist/object/index.mjs"
},
"require": {
"types": "./dist/object/index.d.ts",
"default": "./dist/object/index.js"
}
},
"./predicate": {
"types": "./dist/predicate/index.d.ts",
"import": "./esm/predicate/index.mjs",
"require": "./dist/predicate/index.js"
"import": {
"types": "./dist/predicate/index.d.mts",
"default": "./dist/predicate/index.mjs"
},
"require": {
"types": "./dist/predicate/index.d.ts",
"default": "./dist/predicate/index.js"
}
},
"./promise": {
"types": "./dist/promise/index.d.ts",
"import": "./esm/promise/index.mjs",
"require": "./dist/promise/index.js"
"import": {
"types": "./dist/promise/index.d.mts",
"default": "./dist/promise/index.mjs"
},
"require": {
"types": "./dist/promise/index.d.ts",
"default": "./dist/promise/index.js"
}
},
"./package.json": "./package.json"
}
Expand All @@ -70,7 +105,6 @@
"@babel/preset-typescript": "^7.24.1",
"@changesets/changelog-github": "^0.5.0",
"@changesets/cli": "^2.27.1",
"@toss/rollup-config": "0.2.0-canary.0",
"@types/babel__core": "^7",
"@types/babel__preset-env": "^7",
"@types/broken-link-checker": "^0",
Expand All @@ -84,14 +118,14 @@
"eslint-config-prettier": "^8.5.0",
"lodash": "^4.17.21",
"prettier": "^3.2.5",
"rollup": "^2.78.0",
"tsup": "^8.1.0",
"typescript": "^5.4.5",
"vitest": "^1.5.2"
},
"sideEffects": false,
"scripts": {
"prepack": "yarn build",
"build": "rm -rf dist esm && tsc -p tsconfig.json --declaration --emitDeclarationOnly --declarationDir dist && rollup -c rollup.config.js && ./.scripts/postbuild.sh",
"build": "tsup && ./.scripts/postbuild.sh",
"test": "vitest run --coverage --typecheck"
}
}
}
5 changes: 0 additions & 5 deletions rollup.config.js

This file was deleted.

9 changes: 9 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from 'tsup'

export default defineConfig({
format: ['cjs', 'esm'],
entry: ['src/*.ts', 'src/*/*.ts', '!**/*.{spec,test,test-d}.*'],
Copy link
Member Author

@manudeli manudeli Jun 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#19 !**/*.{spec,test,test-d}.*: This prevent that dist contain test files

sourcemap: true,
dts: true,
clean: true,
})
Loading