File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,26 @@ function loadPluginList (options) {
99 try {
1010 fs . accessSync ( path . join ( options . cwd , 'package.json' ) , fs . constants . R_OK ) ;
1111 } catch ( err ) {
12- return { } ;
12+ throw new Error (
13+ 'There was no package.json found in the current working dir!' ,
14+ options . cwd
15+ ) ;
16+ }
17+
18+ try {
19+ var plugins = JSON . parse (
20+ fs . readFileSync ( path . join ( options . cwd , 'package.json' ) , 'utf-8' )
21+ ) ;
22+ } catch ( err ) {
23+ throw new Error ( 'Error parsing package.json' , err ) ;
1324 }
1425
15- var plugins = JSON . parse (
16- fs . readFileSync ( path . join ( options . cwd , 'package.json' ) , 'utf-8' )
17- ) ;
1826 var targets = [ ] ;
1927
20- plugins = Object . assign ( plugins . dependencies , plugins . devDependencies ) ;
28+ plugins = Object . assign (
29+ plugins . dependencies || { } ,
30+ plugins . devDependencies || { }
31+ ) ;
2132
2233 for ( var plugin in plugins ) {
2334 if ( plugin . startsWith ( 'db-migrate-plugin' ) ) targets . push ( plugin ) ;
@@ -65,7 +76,8 @@ module.exports.getInstance = function (
6576 try {
6677 if ( ! options || ! options . noPlugins ) plugins = loadPlugins ( options ) ;
6778 } catch ( ex ) {
68- log . warn ( ex ) ;
79+ log . verbose ( 'No plugin could be loaded!' ) ;
80+ log . verbose ( ex ) ;
6981 }
7082
7183 if ( options && options . plugins ) {
You can’t perform that action at this time.
0 commit comments