diff --git a/.changeset/tame-ways-prove.md b/.changeset/tame-ways-prove.md new file mode 100644 index 0000000000..4f625d0a05 --- /dev/null +++ b/.changeset/tame-ways-prove.md @@ -0,0 +1,5 @@ +--- +'@backstage/cli': patch +--- + +Add option to build command for minifying the generated code diff --git a/docs/local-dev/cli-commands.md b/docs/local-dev/cli-commands.md index 318b37f34e..412e3c4598 100644 --- a/docs/local-dev/cli-commands.md +++ b/docs/local-dev/cli-commands.md @@ -434,7 +434,8 @@ Usage: backstage-cli build [options] Options: --outputs <formats> List of formats to output [types,cjs,esm] - -h, --help display help for command + --minify Minify the generated code + -h, --help display help for command ``` ## lint diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index dec0b1a293..d312811396 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -33,5 +33,5 @@ export default async (cmd: Command) => { outputs = new Set([Output.types, Output.esm, Output.cjs]); } - await buildPackage({ outputs }); + await buildPackage({ outputs, minify: cmd.minify }); }; diff --git a/packages/cli/src/commands/index.ts b/packages/cli/src/commands/index.ts index 94a8104ff1..bef5dfc285 100644 --- a/packages/cli/src/commands/index.ts +++ b/packages/cli/src/commands/index.ts @@ -138,6 +138,7 @@ export function registerCommands(program: CommanderStatic) { .command('build') .description('Build a package for publishing') .option('--outputs ', 'List of formats to output [types,cjs,esm]') + .option('--minify', 'Minify the generated code') .action(lazy(() => import('./build').then(m => m.default))); program