@@ -12,7 +12,7 @@ import {
1212} from 'node:fs' ;
1313import { join , resolve } from 'node:path' ;
1414import { parseArgs } from 'node:util' ;
15- import { isCancel , select , text } from '@clack/prompts' ;
15+ import { isCancel , select , text , log } from '@clack/prompts' ;
1616import { kebabCase } from 'es-toolkit' ;
1717
1818const engines = [ 'deno' , 'node' , 'bun' ] as const ;
@@ -35,6 +35,10 @@ const args = parseArgs({
3535 force : {
3636 type : 'boolean' ,
3737 } ,
38+ git : {
39+ type : 'boolean' ,
40+ default : true ,
41+ } ,
3842 } ,
3943} ) ;
4044
@@ -92,7 +96,7 @@ async function ensureTargetDir(name: string, target?: string): Promise<string> {
9296 const response = await text ( {
9397 message : 'Where should the template be copied?' ,
9498 placeholder : defaultName ,
95- defaultValue : defaultName
99+ defaultValue : defaultName ,
96100 } ) ;
97101
98102 if ( ! response || isCancel ( response ) ) {
@@ -169,7 +173,7 @@ async function handleTargetDirectory(targetPath: string) {
169173 }
170174}
171175
172- async function handleSuccessfulCopy ( path : string , name : string ) {
176+ async function updateProjectName ( path : string , name : string ) {
173177 if ( ! existsSync ( join ( path , 'package.json' ) ) ) {
174178 console . log ( 'nope' ) ;
175179 } else {
@@ -201,8 +205,13 @@ async function main() {
201205 await handleTargetDirectory ( targetPath ) ;
202206
203207 copyRecursive ( templatePath , targetPath ) ;
204- handleSuccessfulCopy ( targetPath , name ) ;
205- console . log ( `✅ Template "${ engine } " copied to "${ targetPath } "` ) ;
208+ updateProjectName ( targetPath , name ) ;
209+
210+ if ( args . values . git ) {
211+ existsSync ( 'git init' ) ;
212+ }
213+
214+ log . success ( `✅ Template "${ engine } " copied to "${ targetPath } "` ) ;
206215}
207216
208217main ( ) ;
0 commit comments