Skip to content

Commit 1882c73

Browse files
raelgcbluwy
andauthored
feat(create-vite): allow overwrite in command line (#15808)
Co-authored-by: bluwy <bjornlu.dev@gmail.com>
1 parent 1f84cae commit 1882c73

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/create-vite/__tests__/cli.spec.ts

+6
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,9 @@ test('works with the -t alias', () => {
9797
expect(stdout).toContain(`Scaffolding project in ${genPath}`)
9898
expect(templateFiles).toEqual(generatedFiles)
9999
})
100+
101+
test('accepts command line override for --overwrite', () => {
102+
createNonEmptyDir()
103+
const { stdout } = run(['.', '--overwrite', 'ignore'], { cwd: genPath })
104+
expect(stdout).not.toContain(`Current directory is not empty.`)
105+
})

packages/create-vite/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ async function init() {
253253
'projectName' | 'overwrite' | 'packageName' | 'framework' | 'variant'
254254
>
255255

256+
prompts.override({
257+
overwrite: argv.overwrite,
258+
})
259+
256260
try {
257261
result = await prompts(
258262
[

0 commit comments

Comments
 (0)