@@ -52,12 +52,11 @@ if (currentNodeVersion.split('.')[0] < 4) {
52
52
process . exit ( 1 ) ;
53
53
}
54
54
55
- var fs = require ( 'fs' ) ;
55
+ var fs = require ( 'fs-extra ' ) ;
56
56
var path = require ( 'path' ) ;
57
57
var execSync = require ( 'child_process' ) . execSync ;
58
58
var spawn = require ( 'cross-spawn' ) ;
59
59
var semver = require ( 'semver' ) ;
60
- var pathExists = require ( 'path-exists' ) ;
61
60
62
61
var projectName ;
63
62
@@ -103,10 +102,8 @@ function createApp(name, verbose, version) {
103
102
var appName = path . basename ( root ) ;
104
103
105
104
checkAppName ( appName ) ;
106
-
107
- if ( ! pathExists . sync ( name ) ) {
108
- createFolderPath ( name ) ;
109
- } else if ( ! isSafeToCreateProjectIn ( root ) ) {
105
+ fs . ensureDirSync ( name ) ;
106
+ if ( ! isSafeToCreateProjectIn ( root ) ) {
110
107
console . log ( 'The directory ' + chalk . green ( name ) + ' contains files that could conflict.' ) ;
111
108
console . log ( 'Try using a new directory name.' ) ;
112
109
process . exit ( 1 ) ;
@@ -136,16 +133,6 @@ function createApp(name, verbose, version) {
136
133
run ( root , appName , version , verbose , originalDirectory ) ;
137
134
}
138
135
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
-
149
136
function shouldUseYarn ( ) {
150
137
try {
151
138
execSync ( 'yarn --version' , { stdio : 'ignore' } ) ;
0 commit comments