Skip to content

Commit

Permalink
feat(build): add clean flag
Browse files Browse the repository at this point in the history
  • Loading branch information
pacoyang committed Nov 16, 2023
1 parent 0f5b8f1 commit 3b57070
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export default class Build extends Command {
char: 's',
description: 'Silent mode'
}),
clean: Flags.boolean({
char: 'c',
description: 'Clean the output directory',
default: false,
}),
mode: Flags.custom({
options: ['production', 'prod', 'development', 'dev'],
default: 'production',
Expand Down Expand Up @@ -88,7 +93,7 @@ export default class Build extends Command {

try {
const stats = await runWebpack({
clean: !flags.output,
clean: flags.output ? false : flags.clean,
projectDir: directory,
outputDir: flags.output ? upath.resolve(upath.dirname(flags.output)) : outputDir,
outputFileName: flags.output ? upath.basename(flags.output) : undefined,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/PhatCommandBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export default abstract class PhatCommandBase extends Command {
try {
ux.action.start('Creating an optimized build')
const stats = await runWebpack({
clean: true,
clean: false,
projectDir: directory,
customWebpack: this.parsedFlags.webpack,
buildEntries: {
Expand Down

0 comments on commit 3b57070

Please sign in to comment.