Skip to content

Commit 9afcd19

Browse files
committed
Add force option
1 parent df7c086 commit 9afcd19

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

packages/cta-cli/src/cli.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ Remove your node_modules directory and package lock file and re-install.`,
373373
'--add-on-config <config>',
374374
'JSON string with add-on configuration options',
375375
)
376+
.option(
377+
'-f, --force',
378+
'force project creation even if the target directory is not empty',
379+
false,
380+
)
376381

377382
program.action(async (projectName: string, options: CliOptions) => {
378383
if (options.listAddOns) {

packages/cta-cli/src/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export async function promptForCreateOptions(
4444

4545
options.projectName = cliOptions.projectName || (await getProjectName())
4646
if (
47+
!cliOptions.force &&
4748
fs.existsSync(options.projectName) &&
4849
fs.readdirSync(options.projectName).length > 0
4950
) {

packages/cta-cli/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ export interface CliOptions {
2121
interactive?: boolean
2222
ui?: boolean
2323
addOnConfig?: string
24+
force?: boolean
2425
}

0 commit comments

Comments
 (0)