Skip to content

Commit

Permalink
Use tsup for bundling
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeasday committed Jun 5, 2023
1 parent 21ba085 commit c5499e6
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 261 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ subdir-static
test-storybook
chromatic-build-*.xml
chromatic-diagnostics.json
# the dist folder IS included so we can test every version in the CI without publishing
dist
bin
action
node
25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,27 @@
"import": "./isChromatic.mjs"
},
"./node": {
"require": "./node/index.js"
"require": "./dist/node.js",
"types": "./dist/index.d.ts"
}
},
"main": "isChromatic.js",
"module": "isChromatic.mjs",
"bin": {
"chroma": "bin/main.cjs",
"chromatic": "bin/main.cjs",
"chromatic-cli": "bin/main.cjs"
"chroma": "dist/bin.js",
"chromatic": "dist/bin.js",
"chromatic-cli": "dist/bin.js"
},
"files": [
"bin",
"dist/bin.js",
"dist/node.js",
"dist/node.d.ts",
"isChromatic.js",
"isChromatic.mjs",
"isChromatic.d.ts"
],
"scripts": {
"build": "npm-run-all --serial -l bundle:**",
"build": "tsup",
"build-storybook": "build-storybook -s static",
"build-test-storybook": "cross-env SMOKE_TEST=true build-storybook -o test-storybook",
"build-subdir": "cd subdir ; yarn build ; cd ..",
Expand All @@ -59,10 +62,7 @@
"storybook": "start-storybook -p 9009 -s static",
"test": "jest",
"prepare": "husky install && npm run build",
"bundle:bin": "webpack --config=webpack-bin.config.js && chmod +x ./bin/main.cjs",
"bundle:action": "webpack --config=webpack-action.config.js",
"bundle:node": "tsup",
"dev": "webpack --config=webpack-bin.config.js --watch --progress --mode=development",
"dev": "tsup --watch",
"lint-staged": "lint-staged"
},
"lint-staged": {
Expand All @@ -85,7 +85,6 @@
"dependencies": {
"@discoveryjs/json-ext": "^0.5.7",
"@storybook/csf-tools": "^7.0.12",
"@types/webpack-env": "^1.17.0",
"snyk-nodejs-lockfile-parser": "^1.49.0"
},
"devDependencies": {
Expand Down Expand Up @@ -165,7 +164,6 @@
"sort-package-json": "1.50.0",
"string-argv": "^0.3.1",
"strip-ansi": "6.0.0",
"terser-webpack-plugin": "^5.3.6",
"tmp-promise": "3.0.2",
"tree-kill": "^1.2.2",
"ts-dedent": "^1.0.0",
Expand All @@ -174,9 +172,6 @@
"typescript": "^4.3.5",
"util-deprecate": "^1.0.2",
"uuid": "^8.3.2",
"webpack": "^5.72.1",
"webpack-cli": "^4.8.0",
"webpack-license-plugin": "^4.2.2",
"why-is-node-running": "^2.1.2",
"yarn-or-npm": "^3.0.1",
"zen-observable": "^0.8.15"
Expand Down
10 changes: 7 additions & 3 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
import { defineConfig } from 'tsup';

export default defineConfig((options) => ({
entry: ['node-src/index.ts'],
outDir: 'node',
entry: {
action: 'action-src/register.js',
bin: 'bin-src/register.js',
node: 'node-src/index.ts',
},
splitting: false,
minify: !options.watch,
format: ['cjs'],
dts: {
entry: ['node-src/index.ts'],
resolve: true,
},
treeshake: true,
sourcemap: true,
sourcemap: false,
clean: true,
platform: 'node',
target: 'node16',
Expand Down
59 changes: 0 additions & 59 deletions webpack-action.config.js

This file was deleted.

61 changes: 0 additions & 61 deletions webpack-bin.config.js

This file was deleted.

Loading

0 comments on commit c5499e6

Please sign in to comment.