77 * of patent rights can be found in the PATENTS file in the same directory.
88 */
99
10- var fs = require ( 'fs' ) ;
10+ var fs = require ( 'fs-extra ' ) ;
1111var path = require ( 'path' ) ;
1212var spawn = require ( 'cross-spawn' ) ;
1313
@@ -35,25 +35,7 @@ module.exports = function(hostPath, appName, verbose) {
3535 ) ;
3636
3737 // 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 ) ;
5739
5840 // Run another npm install for react and react-dom
5941 console . log ( 'Installing react and react-dom from npm...' ) ;
@@ -71,7 +53,7 @@ module.exports = function(hostPath, appName, verbose) {
7153
7254 // Make sure to display the right way to cd
7355 var cdpath ;
74- if ( path . join ( process . cwd ( ) , appName ) == hostPath ) {
56+ if ( path . join ( process . cwd ( ) , appName ) === hostPath ) {
7557 cdpath = appName ;
7658 } else {
7759 cdpath = hostPath ;
0 commit comments