File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,9 @@ const CORE_SCRIPTS = [
60
60
function initialize ( configType = 'js' ) {
61
61
/* eslint global-require:0,import/no-dynamic-require:0 */
62
62
const packageJsonPath = findUpSync ( 'package.json' )
63
+ if ( packageJsonPath === null ) {
64
+ return
65
+ }
63
66
const packageJson = require ( packageJsonPath )
64
67
const { scripts = { } } = packageJson
65
68
packageJson . scripts = getCoreScripts ( packageJson . scripts )
Original file line number Diff line number Diff line change @@ -185,7 +185,12 @@ function parse(rawArgv) {
185
185
return
186
186
}
187
187
}
188
- const { packageScriptsPath} = initialize ( initArgv . type )
188
+ const init = initialize ( initArgv . type )
189
+ if ( ! packageScriptsPath ) {
190
+ log . error ( chalk . red ( 'Unable to to find an existing package.json' ) )
191
+ return
192
+ }
193
+ const packageScriptsPath = init . packageScriptsPath
189
194
log . info (
190
195
`Your scripts have been saved at ${ chalk . green ( packageScriptsPath ) } ` ,
191
196
)
You can’t perform that action at this time.
0 commit comments