This repository was archived by the owner on Mar 30, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ validators.packageName = async function(props) {
69
69
70
70
validators . version = async function ( props , answers ) {
71
71
if ( props ) {
72
+ if ( props === "latest" ) {
73
+ return true ;
74
+ }
75
+
72
76
let command = "npm view " + answers . packageName + "@" + props ;
73
77
let res = await executeCommand ( command , "version" )
74
78
. then ( ( ) => {
@@ -95,6 +99,28 @@ validators.version = async function(props, answers) {
95
99
96
100
validators . checkVersionAndInstallComponent = async function ( props , answers ) {
97
101
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
+
98
124
let command =
99
125
"npm view " + answers . packageNameToInstallComponent + "@" + props ;
100
126
let res = await executeCommand ( command , "version" )
You can’t perform that action at this time.
0 commit comments