From 5adaebee01ec04b0b8d05da2263d2dee0f19cf35 Mon Sep 17 00:00:00 2001 From: Nikhil-Vats Date: Thu, 22 Aug 2019 21:27:56 +0530 Subject: [PATCH] Fixed - Do not check for version if user enters latest --- generators/app/validator.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/generators/app/validator.js b/generators/app/validator.js index 30ecac5..278ff0e 100644 --- a/generators/app/validator.js +++ b/generators/app/validator.js @@ -69,6 +69,10 @@ validators.packageName = async function(props) { validators.version = async function(props, answers) { if (props) { + if (props === "latest") { + return true; + } + let command = "npm view " + answers.packageName + "@" + props; let res = await executeCommand(command, "version") .then(() => { @@ -95,6 +99,28 @@ validators.version = async function(props, answers) { validators.checkVersionAndInstallComponent = async function(props, answers) { if (props) { + if (props === "latest") { + let res = await executeCommand( + "cd " + + projectDirectory + + " && npm i " + + answers.packageNameToInstallComponent + + "@" + + props + + " --save-exact", + "checkVersionAndInstallComponent" + ) + .then(() => true) + .catch(err => { + return chalk.red( + `Oops! We encountered an error. Please see below for the more details - \n${chalk.yellow( + err + )}` + ); + }); + return res; + } + let command = "npm view " + answers.packageNameToInstallComponent + "@" + props; let res = await executeCommand(command, "version")