Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-imagepicker",
"version": "3.0.5",
"version": "3.0.6",
"description": "A plugin for the NativeScript framework implementing multiple image picker",
"repository": {
"type": "git",
Expand Down
31 changes: 17 additions & 14 deletions src/scripts/require-nativescript-telerik-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ var path = require("path"),
// ignore the remainder of the script if for some reason no package.json exists
try { projectPackageJson = require(projectPackageJsonFilename); } catch (ignore) { return; };

// check if either nativescript-telerik-ui or nativescript-telerik-ui-pro are installed
var telerikui = projectPackageJson.dependencies["nativescript-telerik-ui"];
var telerikuipro = projectPackageJson.dependencies["nativescript-telerik-ui-pro"];
if(projectPackageJson.dependencies) {
// check if either nativescript-telerik-ui or nativescript-telerik-ui-pro are installed
var telerikui = projectPackageJson.dependencies["nativescript-telerik-ui"];
var telerikuipro = projectPackageJson.dependencies["nativescript-telerik-ui-pro"];

// if neither are installed, add nativescript-telerik-ui to the project package.json as a dependency,
// so the user can always later decide to upgrade to nativescript-telerik-ui-pro.
if (telerikui === undefined && telerikuipro === undefined) {
// if neither are installed, add nativescript-telerik-ui to the project package.json as a dependency,
// so the user can always later decide to upgrade to nativescript-telerik-ui-pro.
if (telerikui === undefined && telerikuipro === undefined) {

// we want to install the same version this plugin is tested with, so grab it from the devDependencies.
var pluginPackageJson = require(path.join(__dirname, "..", "package.json"));
var telerikuiversion = pluginPackageJson.devDependencies["nativescript-telerik-ui"];
// we want to install the same version this plugin is tested with, so grab it from the devDependencies.
var pluginPackageJson = require(path.join(__dirname, "..", "package.json"));
var telerikuiversion = pluginPackageJson.devDependencies["nativescript-telerik-ui"];

// give the user a bit of feedback as installing this dependency take a while to complete.
console.log("The nativescript-imagepicker plugin requires nativescript-telerik-ui. Please wait while it's being added to your project...");
require('child_process').execSync('npm i --save nativescript-telerik-ui@' + telerikuiversion, { cwd: path.join(__dirname, "..", "..")});
console.log("nativescript-telerik-ui@" + telerikuiversion + " has been successfully installed and was added to your app's package.json.");
}
}

// give the user a bit of feedback as installing this dependency take a while to complete.
console.log("The nativescript-imagepicker plugin requires nativescript-telerik-ui. Please wait while it's being added to your project...");
require('child_process').execSync('npm i --save nativescript-telerik-ui@' + telerikuiversion, { cwd: path.join(__dirname, "..", "..")});
console.log("nativescript-telerik-ui@" + telerikuiversion + " has been successfully installed and was added to your app's package.json.");
}