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
build: use pkgroll #28
base: main
Are you sure you want to change the base?
Conversation
|
"scripts": { | ||
"test": "mocha -r @esbuild-kit/cjs-loader --extension ts,js src/*.test.ts", | ||
"build": "rimraf dist/ && tsc && tsc -p tsconfig.module.json && tsc -p tsconfig.esm.json && node tools/post-build.js", | ||
"type-check": "tsc --noEmit", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're no longer using tsc
to build, this is just a convenience to use tsc
only for type-checking during development. Can be removed if you rely on the IDE for type-checking.
For building, npm run build
still type-checks because it uses TypeScript to generate the .d.ts
file.
@@ -2,11 +2,7 @@ | |||
"compilerOptions": { | |||
"strict": true, | |||
"target": "ES2019", | |||
"module": "CommonJS", | |||
"moduleResolution": "node", | |||
"outDir": "dist/cjs/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer used. Building is now handled by pkgroll.
@@ -2,11 +2,7 @@ | |||
"compilerOptions": { | |||
"strict": true, | |||
"target": "ES2019", | |||
"module": "CommonJS", | |||
"moduleResolution": "node", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kolorist doesn't import anything so not really relevant.
"outDir": "dist/cjs/", | ||
"sourceMap": true, | ||
"allowJs": true | ||
"skipLibCheck": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Faster type-checking.
Problem
Changes
Use pkgroll for a simpler & faster build step
Restructure
dist
directory to be simplerRemove
tools/post-build.js
as pkgroll automatically outputs.mjs
fileI decided not to output sourcemaps because the distribution file is not very different from the source file. Also, because Node.js is the primary use-case, which can't load source-maps out of the box. I can add it back if you'd like.
Removed unused tsconfig files
Refactored
tsconfig.json
to remove irrelevant properties and speed it upBenchmark: