@@ -31,10 +31,11 @@ export const create = new Command()
31
31
? "yarn dlx"
32
32
: "npx"
33
33
34
- const tmpCwd = "shadcnext"
34
+ let tmpCwd = "shadcnext"
35
35
36
36
try {
37
37
await access ( "package.json" , constants . F_OK )
38
+
38
39
const { stdout : gitignore } = await execa ( "grep" , [
39
40
tmpCwd ,
40
41
".gitignore" ,
@@ -44,13 +45,14 @@ export const create = new Command()
44
45
spinner . info ( `adding ${ tmpCwd } to .gitignore...` )
45
46
await appendFile ( ".gitignore" , `\n${ tmpCwd } /\n` )
46
47
}
48
+
49
+ await execa ( "rm" , [ "-rf" , tmpCwd ] )
50
+ await execa ( "mkdir" , [ "-p" , tmpCwd ] )
47
51
} catch {
48
- spinner . info ( "new project detected." )
52
+ const { stdout : ls } = await execa ( "ls" , [ "-A" ] )
53
+ if ( ! ls ) tmpCwd = "."
49
54
}
50
55
51
- await execa ( "rm" , [ "-rf" , tmpCwd ] )
52
- await execa ( "mkdir" , [ "-p" , tmpCwd ] )
53
-
54
56
const execaOpts = { cwd : tmpCwd }
55
57
spinner . start ( "creating next.js project..." )
56
58
await execa (
@@ -83,7 +85,7 @@ export const create = new Command()
83
85
await execa ( pm . execute , [ "@tailwindcss/upgrade@next" , "--force" ] , execaOpts )
84
86
spinner . succeed ( "tailwindcss upgraded to v4." )
85
87
86
- const cleanup = [ ".git" , " node_modules"]
88
+ const cleanup = [ "node_modules" ]
87
89
88
90
spinner . start ( "cleaning up..." )
89
91
await execa ( "rm" , [ "-rf" , ...cleanup ] , execaOpts )
0 commit comments