From e7642ae009b363c081626fd8101b66f3361a1460 Mon Sep 17 00:00:00 2001 From: Nathan Verni Date: Fri, 22 Jul 2016 13:12:42 -0400 Subject: [PATCH 1/4] Adds .gitignore file to default template --- scripts/init.js | 7 +++++++ template/gitignore | 7 +++++++ 2 files changed, 14 insertions(+) create mode 100644 template/gitignore diff --git a/scripts/init.js b/scripts/init.js index fce0a8c241c..f4e7e4b80dd 100644 --- a/scripts/init.js +++ b/scripts/init.js @@ -37,6 +37,13 @@ module.exports = function(hostPath, appName, verbose) { // Copy the files for the user fs.copySync(path.join(selfPath, 'template'), hostPath); + // Rename files + [ + ['gitignore', '.gitignore'], + ].forEach(function(nameMap) { + fs.move(path.join(hostPath, nameMap[0]), path.join(hostPath, nameMap[1]), []); + }); + // Run another npm install for react and react-dom console.log('Installing react and react-dom from npm...'); // TODO: having to do two npm installs is bad, can we avoid it? diff --git a/template/gitignore b/template/gitignore new file mode 100644 index 00000000000..ecd5384ab1e --- /dev/null +++ b/template/gitignore @@ -0,0 +1,7 @@ +# See http://help.github.com/ignore-files/ for more about ignoring files. + +# dependencies +/node_modules + +# misc +npm-debug.log From c0d34f3e7975ace7326920300aa329c3c8997126 Mon Sep 17 00:00:00 2001 From: Nathan Verni Date: Fri, 22 Jul 2016 15:50:41 -0400 Subject: [PATCH 2/4] Simplify renames --- scripts/init.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/init.js b/scripts/init.js index f4e7e4b80dd..12cb429d1a9 100644 --- a/scripts/init.js +++ b/scripts/init.js @@ -38,11 +38,7 @@ module.exports = function(hostPath, appName, verbose) { fs.copySync(path.join(selfPath, 'template'), hostPath); // Rename files - [ - ['gitignore', '.gitignore'], - ].forEach(function(nameMap) { - fs.move(path.join(hostPath, nameMap[0]), path.join(hostPath, nameMap[1]), []); - }); + fs.move(path.join(hostPath, 'gitignore'), path.join(hostPath, '.gitignore'), []); // Run another npm install for react and react-dom console.log('Installing react and react-dom from npm...'); From 468e6c3e4eae4c54f895baf68dfd8a9c87b866b0 Mon Sep 17 00:00:00 2001 From: Nathan Verni Date: Fri, 22 Jul 2016 16:03:09 -0400 Subject: [PATCH 3/4] Reference npm issue in comment --- scripts/init.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/init.js b/scripts/init.js index 12cb429d1a9..be5d58b158f 100644 --- a/scripts/init.js +++ b/scripts/init.js @@ -37,7 +37,8 @@ module.exports = function(hostPath, appName, verbose) { // Copy the files for the user fs.copySync(path.join(selfPath, 'template'), hostPath); - // Rename files + // Rename gitignore after the fact to prevent npm from renaming it to .npmignore + // See: https://github.com/npm/npm/issues/1862 fs.move(path.join(hostPath, 'gitignore'), path.join(hostPath, '.gitignore'), []); // Run another npm install for react and react-dom From ae38faac61fab0ecd96f26d12309a6b014c7a4b0 Mon Sep 17 00:00:00 2001 From: Nathan Verni Date: Fri, 22 Jul 2016 16:12:21 -0400 Subject: [PATCH 4/4] Removing leading slash --- template/gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/gitignore b/template/gitignore index ecd5384ab1e..f709354aaaa 100644 --- a/template/gitignore +++ b/template/gitignore @@ -1,7 +1,7 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # dependencies -/node_modules +node_modules # misc npm-debug.log