diff --git a/packages/cli/build.js b/packages/cli/build.js new file mode 100644 index 0000000..a640484 --- /dev/null +++ b/packages/cli/build.js @@ -0,0 +1,14 @@ +import pkg from './package.json' assert { type: 'json' } +import { build } from 'tsup' + +const watch = process.argv.slice(2)[0] === '--watch' + +await build({ + entry: ['src/index.ts', 'src/cli.ts'], + dts: true, + minify: true, + format: ['esm', 'cjs'], + clean: true, + define: { VERSION: `"${pkg.version}"` }, + watch, +}) diff --git a/packages/cli/package.json b/packages/cli/package.json index ae8f6f5..c2f7262 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -20,7 +20,8 @@ ], "scripts": { "bin": "run-s build package", - "build": "rm -rf dist && tsc && tsup ./src/index.ts ./src/cli.ts --dts --format esm,cjs --minify", + "build": "tsc && node build.js", + "dev": "node build.js --watch", "prepublishOnly": "run-s build" }, "devDependencies": {