From 409914259c467e8d65c94020dfe4ab7382de8ecc Mon Sep 17 00:00:00 2001 From: pooya parsa Date: Tue, 18 Jul 2023 19:42:47 +0200 Subject: [PATCH] feat(cli): support `--minify` (#285) --- src/cli.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 233e36dc..c107589d 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,5 +1,6 @@ #!/usr/bin/env node import { defineCommand, runMain } from "citty"; +import consola from "consola"; import { resolve } from "pathe"; import { name, version, description } from "../package.json"; import { build } from "./build"; @@ -20,11 +21,21 @@ const main = defineCommand({ type: "boolean", description: "Stub build", }, + minify: { + type: "boolean", + description: "Minify build", + }, }, async run({ args }) { const rootDir = resolve(process.cwd(), args.dir || "."); - await build(rootDir, args.stub).catch((error) => { - console.error(`Error building ${rootDir}: ${error}`); + await build(rootDir, args.stub, { + rollup: { + esbuild: { + minify: args.minify, + }, + }, + }).catch((error) => { + consola.error(`Error building ${rootDir}: ${error}`); throw error; }); },