Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #37 from Nikhil-Vats/master
Browse files Browse the repository at this point in the history
Fixed - Do not check for version if user enters latest
  • Loading branch information
sarthak-sehgal authored Aug 27, 2019
2 parents 7f04c68 + 5adaebe commit 50a69f8
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions generators/app/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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")
Expand Down

0 comments on commit 50a69f8

Please sign in to comment.