File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,9 @@ export async function detectFramework(path = "") {
1919 /** @type {import("./meta").SupportedFramework[] } */
2020 const foundFrameworks = [ ]
2121
22- if ( packageJson . dependencies [ "next" ] ) foundFrameworks . push ( "next" )
23- if ( packageJson . dependencies [ "express" ] ) foundFrameworks . push ( "express" )
24- if ( packageJson . devDependencies [ "@sveltejs/kit" ] )
22+ if ( packageJson ? .dependencies ?. [ "next" ] ) foundFrameworks . push ( "next" )
23+ if ( packageJson ? .dependencies ?. [ "express" ] ) foundFrameworks . push ( "express" )
24+ if ( packageJson ? .devDependencies ?. [ "@sveltejs/kit" ] )
2525 foundFrameworks . push ( "sveltekit" )
2626
2727 if ( foundFrameworks . length === 1 ) return foundFrameworks [ 0 ]
@@ -33,7 +33,8 @@ export async function detectFramework(path = "") {
3333 return "unknown"
3434 }
3535 return "unknown"
36- } catch {
36+ } catch ( error ) {
37+ console . error ( error )
3738 return "unknown"
3839 }
3940}
@@ -43,14 +44,15 @@ export async function requireFramework(path = "") {
4344
4445 if ( framework === "unknown" ) {
4546 console . error (
46- y . red ( `No framework detected. Currently supported frameworks are: ${ y . bold (
47- Object . keys ( frameworks ) . join ( ", " )
48- ) } `)
47+ y . red (
48+ `No framework detected. Currently supported frameworks are: ${ y . bold (
49+ Object . keys ( frameworks ) . join ( ", " )
50+ ) } `
51+ )
4952 )
5053
5154 process . exit ( 0 )
5255 }
5356
5457 return framework
5558}
56-
You can’t perform that action at this time.
0 commit comments