@@ -59,8 +59,8 @@ export async function create(effects: CreateEffects = defaultEffects): Promise<v
59
59
appTitle : ( { results : { rootPath} } ) =>
60
60
clack . text ( {
61
61
message : "What should we title your app?" ,
62
- placeholder : inferTitle ( rootPath ! ) ,
63
- defaultValue : inferTitle ( rootPath ! )
62
+ placeholder : inferTitle ( rootPath ) ,
63
+ defaultValue : inferTitle ( rootPath )
64
64
} ) ,
65
65
includeSampleFiles : ( ) =>
66
66
clack . select ( {
@@ -135,7 +135,10 @@ export async function create(effects: CreateEffects = defaultEffects): Promise<v
135
135
}
136
136
}
137
137
if ( spinning ) s . stop ( "Installed! 🎉" ) ;
138
- const instructions = [ `cd ${ rootPath } ` , ...( packageManager ? [ ] : [ installCommand ] ) , `${ runCommand } dev` ] ;
138
+ const instructions : string [ ] = [ ] ;
139
+ if ( rootPath !== "." ) instructions . push ( `cd ${ rootPath } ` ) ;
140
+ if ( ! packageManager ) instructions . push ( installCommand ) ;
141
+ instructions . push ( `${ runCommand } dev` ) ;
139
142
clack . note ( instructions . map ( ( line ) => reset ( cyan ( line ) ) ) . join ( "\n" ) , "Next steps…" ) ;
140
143
clack . outro ( `Problems? ${ link ( "https://github.com/observablehq/framework/discussions" ) } ` ) ;
141
144
}
@@ -159,8 +162,8 @@ function validateRootPath(rootPath: string, defaultError?: string): string | und
159
162
if ( readdirSync ( rootPath ) . length !== 0 ) return "Directory is not empty." ;
160
163
}
161
164
162
- function inferTitle ( rootPath : string ) : string {
163
- return basename ( rootPath ! )
165
+ function inferTitle ( rootPath = "." ) : string {
166
+ return basename ( join ( process . cwd ( ) , rootPath ) )
164
167
. split ( / [ - _ \s ] / )
165
168
. map ( ( [ c , ...rest ] ) => c . toUpperCase ( ) + rest . join ( "" ) )
166
169
. join ( " " ) ;
0 commit comments