Skip to content

Commit

Permalink
⚙️ Chore(packages/myplop): change bundler webpack to tsup
Browse files Browse the repository at this point in the history
  • Loading branch information
INeedJobToStartWork committed Jun 14, 2024
1 parent 5904165 commit ae2fc61
Show file tree
Hide file tree
Showing 15 changed files with 748 additions and 1,717 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ out/

# production
build
**/build/**
dist
**/dist/**
lib
**/lib/**

# misc
.DS_Store
Expand All @@ -47,3 +49,4 @@ next-env.d.ts
.turbo
.gitignore
.vscode/settings.json
packages/myplop/dist/index.cjs
1 change: 0 additions & 1 deletion config/webpackrc/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions config/webpackrc/package.json

This file was deleted.

40 changes: 0 additions & 40 deletions config/webpackrc/webpack.base.js

This file was deleted.

10 changes: 0 additions & 10 deletions config/webpackrc/webpack.dev.js

This file was deleted.

21 changes: 0 additions & 21 deletions config/webpackrc/webpack.prod.js

This file was deleted.

10 changes: 10 additions & 0 deletions packages/myplop/config/tsuprc/tsup.base.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { copy } from "esbuild-plugin-copy";
import { defineConfig } from "tsup";

export default defineConfig({
entry: ["src/index.ts"],
target: "es2020",
clean: true,
format: ["esm"],
esbuildPlugins: [copy({ assets: [{ from: "./src/templates/configs/*", to: "./templates/configs" }] })]
});
8 changes: 8 additions & 0 deletions packages/myplop/config/tsuprc/tsup.dev.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import config from "./tsup.base";
import { defineConfig } from "tsup";

export default defineConfig({
...config,
outDir: "lib",
watch: ["src"]
});
24 changes: 24 additions & 0 deletions packages/myplop/config/tsuprc/tsup.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import config from "./tsup.base";
import { copy } from "esbuild-plugin-copy";
import { defineConfig } from "tsup";

export default defineConfig({
...config,
splitting: true,
minify: true,
shims: true,
outDir: "dist",

format: ["cjs"],
esbuildPlugins: [
copy({
assets: [
{ from: "./package.json", to: "./package.json" },
{ from: "./.npmrc", to: "./.npmrc" },
{ from: "./.npmignore", to: "./.npmignore" },
{ from: "./README.md", to: "./README.md" },
{ from: "./src/templates/configs/*", to: "./templates/configs" }
]
})
]
});
15 changes: 0 additions & 15 deletions packages/myplop/config/webpack/webpack.base.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/myplop/config/webpack/webpack.dev.js

This file was deleted.

9 changes: 0 additions & 9 deletions packages/myplop/config/webpack/webpack.prod.js

This file was deleted.

25 changes: 24 additions & 1 deletion packages/myplop/dist/index.cjs

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions packages/myplop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"myplopPROD": "./dist/index.cjs"
},
"scripts": {
"build": "webpack --config ./config/webpack/webpack.prod.js",
"build:npm": "pnpm npm:prepack && webpack --config ./config/webpack/webpack.prod.js && pnpm npm:postpack ",
"dev": "webpack --config ./config/webpack/webpack.dev.js",
"build": "pnpm tsup --config ./config/tsuprc/tsup.prod.ts",
"build:npm": "pnpm npm:prepack && pnpm tsup --config ./config/tsuprc/tsup.prod.ts && pnpm dts-bundle-generator --config ./config/dts-bundle-generator/dts-bundle-generator.cjs && pnpm npm:postpack",
"dev": "pnpm tsup --config ./config/tsuprc/tsup.dev.ts",
"format": "pnpm prettier . --write && pnpm prettier . --check",
"link-cli": "pnpm unlink --global && pnpm link --global",
"link-cli:dev": "cd lib && pnpm unlink --global && pnpm link --global",
Expand All @@ -38,19 +38,15 @@
"zod": "^3.23.8"
},
"devDependencies": {
"bundle-declarations-webpack-plugin": "^5.0.0",
"clean-package": "^2.2.0",
"commander": "^11.1.0",
"copy-webpack-plugin": "^12.0.2",
"esbuild": "^0.21.5",
"esbuild-plugin-copy": "^2.1.1",
"eslintrc": "workspace:*",
"prettier": "^3.1.1",
"prettierrc": "workspace:*",
"swc-loader": "^0.2.3",
"tsconfig": "workspace:*",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-merge": "^5.10.0",
"webpackrc": "workspace:*"
"tsup": "^8.1.0",
"typescript": "^5.3.3"
}
}
Loading

0 comments on commit ae2fc61

Please sign in to comment.