Skip to content

Commit 9689a16

Browse files
author
radeva
authored
Merge pull request #109 from NativeScript/radeva/fix-dependencies
fix: #108
2 parents ef9ebdd + 17edd2c commit 9689a16

File tree

2 files changed

+18
-15
lines changed

2 files changed

+18
-15
lines changed

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-imagepicker",
3-
"version": "3.0.5",
3+
"version": "3.0.6",
44
"description": "A plugin for the NativeScript framework implementing multiple image picker",
55
"repository": {
66
"type": "git",

src/scripts/require-nativescript-telerik-ui.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ var path = require("path"),
55
// ignore the remainder of the script if for some reason no package.json exists
66
try { 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

Comments
 (0)