Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Meta
create-react-app
Commits
ad2550f7
Commit
ad2550f7
authored
8 years ago
by
eanplatter
Committed by
Christopher Chedeau
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
Recursively copy the template folder (#74)
* Recursively copy the template folder * add fs-extra library
parent
37404734
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
package.json
+1
-0
package.json
scripts/init.js
+3
-21
scripts/init.js
with
4 additions
and
21 deletions
+4
-21
package.json
+
1
-
0
View file @
ad2550f7
...
...
@@ -56,6 +56,7 @@
},
"devDependencies"
:
{
"
bundle-deps
"
:
"
^1.0.0
"
,
"
fs-extra
"
:
"
^0.30.0
"
,
"
react
"
:
"
^15.2.1
"
,
"
react-dom
"
:
"
^15.2.1
"
},
...
...
This diff is collapsed.
Click to expand it.
scripts/init.js
+
3
-
21
View file @
ad2550f7
...
...
@@ -7,7 +7,7 @@
* of patent rights can be found in the PATENTS file in the same directory.
*/
var
fs
=
require
(
'
fs
'
);
var
fs
=
require
(
'
fs
-extra
'
);
var
path
=
require
(
'
path
'
);
var
spawn
=
require
(
'
cross-spawn
'
);
...
...
@@ -35,25 +35,7 @@ module.exports = function(hostPath, appName, verbose) {
);
// Copy the files for the user
function
copySync
(
src
,
dest
)
{
return
fs
.
writeFileSync
(
dest
,
fs
.
readFileSync
(
src
));
}
fs
.
mkdirSync
(
path
.
join
(
hostPath
,
'
src
'
));
fs
.
readdirSync
(
path
.
join
(
selfPath
,
'
template/src
'
)).
forEach
(
function
(
filename
)
{
copySync
(
path
.
join
(
selfPath
,
'
template/src
'
,
filename
),
path
.
join
(
hostPath
,
'
src
'
,
filename
)
);
});
fs
.
readdirSync
(
path
.
join
(
selfPath
,
'
template
'
)).
forEach
(
function
(
filename
)
{
if
(
fs
.
lstatSync
(
path
.
join
(
selfPath
,
'
template
'
,
filename
)).
isDirectory
())
{
return
}
copySync
(
path
.
join
(
selfPath
,
'
template
'
,
filename
),
path
.
join
(
hostPath
,
filename
)
);
});
fs
.
copySync
(
path
.
join
(
selfPath
,
'
template
'
),
hostPath
);
// Run another npm install for react and react-dom
console
.
log
(
'
Installing react and react-dom from npm...
'
);
...
...
@@ -71,7 +53,7 @@ module.exports = function(hostPath, appName, verbose) {
// Make sure to display the right way to cd
var
cdpath
;
if
(
path
.
join
(
process
.
cwd
(),
appName
)
==
hostPath
)
{
if
(
path
.
join
(
process
.
cwd
(),
appName
)
==
=
hostPath
)
{
cdpath
=
appName
;
}
else
{
cdpath
=
hostPath
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment