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

Commit 50a69f8

Browse files
Merge pull request #37 from Nikhil-Vats/master
Fixed - Do not check for version if user enters latest
2 parents 7f04c68 + 5adaebe commit 50a69f8

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

generators/app/validator.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ validators.packageName = async function(props) {
6969

7070
validators.version = async function(props, answers) {
7171
if (props) {
72+
if (props === "latest") {
73+
return true;
74+
}
75+
7276
let command = "npm view " + answers.packageName + "@" + props;
7377
let res = await executeCommand(command, "version")
7478
.then(() => {
@@ -95,6 +99,28 @@ validators.version = async function(props, answers) {
9599

96100
validators.checkVersionAndInstallComponent = async function(props, answers) {
97101
if (props) {
102+
if (props === "latest") {
103+
let res = await executeCommand(
104+
"cd " +
105+
projectDirectory +
106+
" && npm i " +
107+
answers.packageNameToInstallComponent +
108+
"@" +
109+
props +
110+
" --save-exact",
111+
"checkVersionAndInstallComponent"
112+
)
113+
.then(() => true)
114+
.catch(err => {
115+
return chalk.red(
116+
`Oops! We encountered an error. Please see below for the more details - \n${chalk.yellow(
117+
err
118+
)}`
119+
);
120+
});
121+
return res;
122+
}
123+
98124
let command =
99125
"npm view " + answers.packageNameToInstallComponent + "@" + props;
100126
let res = await executeCommand(command, "version")

0 commit comments

Comments
 (0)