@@ -52,12 +52,11 @@ if (currentNodeVersion.split('.')[0] < 4) {
5252 process . exit ( 1 ) ;
5353}
5454
55- var fs = require ( 'fs' ) ;
55+ var fs = require ( 'fs-extra ' ) ;
5656var path = require ( 'path' ) ;
5757var execSync = require ( 'child_process' ) . execSync ;
5858var spawn = require ( 'cross-spawn' ) ;
5959var semver = require ( 'semver' ) ;
60- var pathExists = require ( 'path-exists' ) ;
6160
6261var projectName ;
6362
@@ -103,10 +102,8 @@ function createApp(name, verbose, version) {
103102 var appName = path . basename ( root ) ;
104103
105104 checkAppName ( appName ) ;
106-
107- if ( ! pathExists . sync ( name ) ) {
108- createFolderPath ( name ) ;
109- } else if ( ! isSafeToCreateProjectIn ( root ) ) {
105+ fs . ensureDirSync ( name ) ;
106+ if ( ! isSafeToCreateProjectIn ( root ) ) {
110107 console . log ( 'The directory ' + chalk . green ( name ) + ' contains files that could conflict.' ) ;
111108 console . log ( 'Try using a new directory name.' ) ;
112109 process . exit ( 1 ) ;
@@ -136,16 +133,6 @@ function createApp(name, verbose, version) {
136133 run ( root , appName , version , verbose , originalDirectory ) ;
137134}
138135
139- function createFolderPath ( path ) {
140- var projectPath = ( path + "/" ) ;
141- projectPath . replace ( / ( \w + ) \/ / ig, function ( i , dirName , index ) {
142- var dirPath = path . substr ( 0 , index + 1 + dirName . length ) ;
143- if ( ! pathExists . sync ( dirPath ) ) {
144- fs . mkdirSync ( dirPath ) ;
145- }
146- } ) ;
147- }
148-
149136function shouldUseYarn ( ) {
150137 try {
151138 execSync ( 'yarn --version' , { stdio : 'ignore' } ) ;
0 commit comments