@@ -217,16 +217,13 @@ function shouldUseYarn() {
217217 }
218218}
219219
220- function install ( root , useYarn , dependencies , verbose , isOnline , isDevDeps ) {
220+ function install ( root , useYarn , dependencies , verbose , isOnline ) {
221221 return new Promise ( ( resolve , reject ) => {
222222 let command
223223 let args
224224 if ( useYarn ) {
225225 command = "yarnpkg"
226- args = [ "add" , "--exact" ]
227- if ( isDevDeps ) {
228- args . push ( "--dev" )
229- }
226+ args = [ "add" , "--dev" , "--exact" ]
230227 if ( ! isOnline ) {
231228 args . push ( "--offline" )
232229 }
@@ -249,7 +246,7 @@ function install(root, useYarn, dependencies, verbose, isOnline, isDevDeps) {
249246 command = "npm"
250247 args = [
251248 "install" ,
252- `--save${ isDevDeps ? " -dev" : "" } ` ,
249+ `--save-dev` ,
253250 "--save-exact" ,
254251 "--loglevel" ,
255252 "error" ,
@@ -301,24 +298,15 @@ function run(
301298 ) } ...`
302299 )
303300 console . log ( )
304-
301+ const devDependencies = [ "typescript" , packageToInstall ]
305302 return install (
306303 root ,
307304 useYarn ,
308- [ "typescript" ] ,
305+ devDependencies ,
309306 verbose ,
310307 isOnline ,
311- false
312- ) . then ( ( ) =>
313- install (
314- root ,
315- useYarn ,
316- [ packageToInstall ] ,
317- verbose ,
318- isOnline ,
319- true
320- ) . then ( ( ) => packageName )
321- )
308+ true
309+ ) . then ( ( ) => packageName )
322310 } )
323311 . then ( packageName => {
324312 checkNodeVersion ( packageName )
@@ -580,8 +568,8 @@ function setCaretRangeForRuntimeDeps(packageName) {
580568 const packagePath = path . join ( process . cwd ( ) , "package.json" )
581569 const packageJson = require ( packagePath )
582570
583- if ( typeof packageJson . dependencies === "undefined" ) {
584- console . error ( chalk . red ( "Missing dependencies in package.json" ) )
571+ if ( typeof packageJson . devDependencies === "undefined" ) {
572+ console . error ( chalk . red ( "Missing devDependencies in package.json" ) )
585573 process . exit ( 1 )
586574 }
587575
@@ -591,7 +579,7 @@ function setCaretRangeForRuntimeDeps(packageName) {
591579 process . exit ( 1 )
592580 }
593581
594- makeCaretRange ( packageJson . dependencies , "typescript" )
582+ makeCaretRange ( packageJson . devDependencies , "typescript" )
595583
596584 fs . writeFileSync ( packagePath , JSON . stringify ( packageJson , null , 2 ) )
597585}
0 commit comments