Skip to content

Commit

Permalink
feat(cli): support --minify (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 authored Jul 18, 2023
1 parent 607fee9 commit 4099142
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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;
});
},
Expand Down

0 comments on commit 4099142

Please sign in to comment.