@@ -217,13 +217,16 @@ function shouldUseYarn() {
217217 }
218218}
219219
220- function install ( root , useYarn , dependencies , verbose , isOnline ) {
220+ function install ( root , useYarn , dependencies , verbose , isOnline , isDevDeps ) {
221221 return new Promise ( ( resolve , reject ) => {
222222 let command
223223 let args
224224 if ( useYarn ) {
225225 command = "yarnpkg"
226226 args = [ "add" , "--exact" ]
227+ if ( isDevDeps ) {
228+ args . push ( "--dev" )
229+ }
227230 if ( ! isOnline ) {
228231 args . push ( "--offline" )
229232 }
@@ -246,7 +249,7 @@ function install(root, useYarn, dependencies, verbose, isOnline) {
246249 command = "npm"
247250 args = [
248251 "install" ,
249- " --save" ,
252+ ` --save${ isDevDeps ? "-dev" : "" } ` ,
250253 "--save-exact" ,
251254 "--loglevel" ,
252255 "error" ,
@@ -280,7 +283,6 @@ function run(
280283 useYarn
281284) {
282285 const packageToInstall = getInstallPackage ( version )
283- const allDependencies = [ "typescript" , packageToInstall ]
284286
285287 console . log ( "Installing packages. This might take a couple of minutes." )
286288 getPackageName ( packageToInstall )
@@ -294,14 +296,28 @@ function run(
294296 const isOnline = info . isOnline
295297 const packageName = info . packageName
296298 console . log (
297- `Installing ${ chalk . cyan (
298- "typescript"
299- ) } , ${ chalk . cyan ( ) } , and ${ chalk . cyan ( packageName ) } ...`
299+ `Installing ${ chalk . cyan ( "typescript" ) } and ${ chalk . cyan (
300+ packageName
301+ ) } ...`
300302 )
301303 console . log ( )
302304
303- return install ( root , useYarn , allDependencies , verbose , isOnline ) . then (
304- ( ) => packageName
305+ return install (
306+ root ,
307+ useYarn ,
308+ [ "typescript" ] ,
309+ verbose ,
310+ isOnline ,
311+ false
312+ ) . then ( ( ) =>
313+ install (
314+ root ,
315+ useYarn ,
316+ [ packageToInstall ] ,
317+ verbose ,
318+ isOnline ,
319+ true
320+ ) . then ( ( ) => packageName )
305321 )
306322 } )
307323 . then ( packageName => {
@@ -569,7 +585,7 @@ function setCaretRangeForRuntimeDeps(packageName) {
569585 process . exit ( 1 )
570586 }
571587
572- const packageVersion = packageJson . dependencies [ packageName ]
588+ const packageVersion = packageJson . devDependencies [ packageName ]
573589 if ( typeof packageVersion === "undefined" ) {
574590 console . error ( chalk . red ( `Unable to find ${ packageName } in package.json` ) )
575591 process . exit ( 1 )
0 commit comments