@@ -5,20 +5,23 @@ var path = require("path"),
55// ignore the remainder of the script if for some reason no package.json exists
66try { projectPackageJson = require ( projectPackageJsonFilename ) ; } catch ( ignore ) { return ; } ;
77
8- // check if either nativescript-telerik-ui or nativescript-telerik-ui-pro are installed
9- var telerikui = projectPackageJson . dependencies [ "nativescript-telerik-ui" ] ;
10- var telerikuipro = projectPackageJson . dependencies [ "nativescript-telerik-ui-pro" ] ;
8+ if ( projectPackageJson . dependencies ) {
9+ // check if either nativescript-telerik-ui or nativescript-telerik-ui-pro are installed
10+ var telerikui = projectPackageJson . dependencies [ "nativescript-telerik-ui" ] ;
11+ var telerikuipro = projectPackageJson . dependencies [ "nativescript-telerik-ui-pro" ] ;
1112
12- // if neither are installed, add nativescript-telerik-ui to the project package.json as a dependency,
13- // so the user can always later decide to upgrade to nativescript-telerik-ui-pro.
14- if ( telerikui === undefined && telerikuipro === undefined ) {
13+ // if neither are installed, add nativescript-telerik-ui to the project package.json as a dependency,
14+ // so the user can always later decide to upgrade to nativescript-telerik-ui-pro.
15+ if ( telerikui === undefined && telerikuipro === undefined ) {
1516
16- // we want to install the same version this plugin is tested with, so grab it from the devDependencies.
17- var pluginPackageJson = require ( path . join ( __dirname , ".." , "package.json" ) ) ;
18- var telerikuiversion = pluginPackageJson . devDependencies [ "nativescript-telerik-ui" ] ;
17+ // we want to install the same version this plugin is tested with, so grab it from the devDependencies.
18+ var pluginPackageJson = require ( path . join ( __dirname , ".." , "package.json" ) ) ;
19+ var telerikuiversion = pluginPackageJson . devDependencies [ "nativescript-telerik-ui" ] ;
20+
21+ // give the user a bit of feedback as installing this dependency take a while to complete.
22+ console . log ( "The nativescript-imagepicker plugin requires nativescript-telerik-ui. Please wait while it's being added to your project..." ) ;
23+ require ( 'child_process' ) . execSync ( 'npm i --save nativescript-telerik-ui@' + telerikuiversion , { cwd : path . join ( __dirname , ".." , ".." ) } ) ;
24+ console . log ( "nativescript-telerik-ui@" + telerikuiversion + " has been successfully installed and was added to your app's package.json." ) ;
25+ }
26+ }
1927
20- // give the user a bit of feedback as installing this dependency take a while to complete.
21- console . log ( "The nativescript-imagepicker plugin requires nativescript-telerik-ui. Please wait while it's being added to your project..." ) ;
22- require ( 'child_process' ) . execSync ( 'npm i --save nativescript-telerik-ui@' + telerikuiversion , { cwd : path . join ( __dirname , ".." , ".." ) } ) ;
23- console . log ( "nativescript-telerik-ui@" + telerikuiversion + " has been successfully installed and was added to your app's package.json." ) ;
24- }
0 commit comments