File tree 1 file changed +18
-6
lines changed
1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,26 @@ function loadPluginList (options) {
9
9
try {
10
10
fs . accessSync ( path . join ( options . cwd , 'package.json' ) , fs . constants . R_OK ) ;
11
11
} 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 ) ;
13
24
}
14
25
15
- var plugins = JSON . parse (
16
- fs . readFileSync ( path . join ( options . cwd , 'package.json' ) , 'utf-8' )
17
- ) ;
18
26
var targets = [ ] ;
19
27
20
- plugins = Object . assign ( plugins . dependencies , plugins . devDependencies ) ;
28
+ plugins = Object . assign (
29
+ plugins . dependencies || { } ,
30
+ plugins . devDependencies || { }
31
+ ) ;
21
32
22
33
for ( var plugin in plugins ) {
23
34
if ( plugin . startsWith ( 'db-migrate-plugin' ) ) targets . push ( plugin ) ;
@@ -65,7 +76,8 @@ module.exports.getInstance = function (
65
76
try {
66
77
if ( ! options || ! options . noPlugins ) plugins = loadPlugins ( options ) ;
67
78
} catch ( ex ) {
68
- log . warn ( ex ) ;
79
+ log . verbose ( 'No plugin could be loaded!' ) ;
80
+ log . verbose ( ex ) ;
69
81
}
70
82
71
83
if ( options && options . plugins ) {
You can’t perform that action at this time.
0 commit comments