7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
10
- var fs = require ( 'fs' ) ;
10
+ var fs = require ( 'fs-extra ' ) ;
11
11
var path = require ( 'path' ) ;
12
12
var spawn = require ( 'cross-spawn' ) ;
13
13
@@ -35,25 +35,7 @@ module.exports = function(hostPath, appName, verbose) {
35
35
) ;
36
36
37
37
// Copy the files for the user
38
- function copySync ( src , dest ) {
39
- return fs . writeFileSync ( dest , fs . readFileSync ( src ) ) ;
40
- }
41
- fs . mkdirSync ( path . join ( hostPath , 'src' ) ) ;
42
- fs . readdirSync ( path . join ( selfPath , 'template/src' ) ) . forEach ( function ( filename ) {
43
- copySync (
44
- path . join ( selfPath , 'template/src' , filename ) ,
45
- path . join ( hostPath , 'src' , filename )
46
- ) ;
47
- } ) ;
48
- fs . readdirSync ( path . join ( selfPath , 'template' ) ) . forEach ( function ( filename ) {
49
- if ( fs . lstatSync ( path . join ( selfPath , 'template' , filename ) ) . isDirectory ( ) ) {
50
- return
51
- }
52
- copySync (
53
- path . join ( selfPath , 'template' , filename ) ,
54
- path . join ( hostPath , filename )
55
- ) ;
56
- } ) ;
38
+ fs . copySync ( path . join ( selfPath , 'template' ) , hostPath ) ;
57
39
58
40
// Run another npm install for react and react-dom
59
41
console . log ( 'Installing react and react-dom from npm...' ) ;
@@ -71,7 +53,7 @@ module.exports = function(hostPath, appName, verbose) {
71
53
72
54
// Make sure to display the right way to cd
73
55
var cdpath ;
74
- if ( path . join ( process . cwd ( ) , appName ) == hostPath ) {
56
+ if ( path . join ( process . cwd ( ) , appName ) === hostPath ) {
75
57
cdpath = appName ;
76
58
} else {
77
59
cdpath = hostPath ;
0 commit comments