From 5ab129e0bc8c2711931a216bab3fceed4f5f14c5 Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Wed, 31 Aug 2016 14:50:54 +0300 Subject: [PATCH 1/2] ignore .idea folder this change is requred for IntelliJ-based products because project information files are written before actual generator is invoked --- global-cli/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/global-cli/index.js b/global-cli/index.js index 9a298b83a6..a0c181fb48 100644 --- a/global-cli/index.js +++ b/global-cli/index.js @@ -171,7 +171,7 @@ function checkNodeVersion() { // https://github.com/facebookincubator/create-react-app/pull/368#issuecomment-237875655 function isGitHubBoilerplate(root) { var validFiles = [ - '.DS_Store', 'Thumbs.db', '.git', '.gitignore', 'README.md', 'LICENSE' + '.DS_Store', 'Thumbs.db', '.git', '.gitignore', '.idea', 'README.md', 'LICENSE' ]; return fs.readdirSync(root) .every(function(file) { From afc353644d66f0142221d0e5b5bd1ba98d79b4aa Mon Sep 17 00:00:00 2001 From: Dennis Ushakov Date: Wed, 31 Aug 2016 16:05:18 +0300 Subject: [PATCH 2/2] better method name and explanation --- global-cli/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/global-cli/index.js b/global-cli/index.js index a0c181fb48..dc6262b71a 100644 --- a/global-cli/index.js +++ b/global-cli/index.js @@ -71,7 +71,7 @@ function createApp(name, verbose, version) { var root = path.resolve(name); if (!pathExists.sync(name)) { fs.mkdirSync(root); - } else if (!isGitHubBoilerplate(root)) { + } else if (!isSafeToCreateProjectIn(root)) { console.log('The directory `' + name + '` contains file(s) that could conflict. Aborting.'); process.exit(1); } @@ -167,9 +167,10 @@ function checkNodeVersion() { } } -// Check if GitHub boilerplate compatible -// https://github.com/facebookincubator/create-react-app/pull/368#issuecomment-237875655 -function isGitHubBoilerplate(root) { +// If project only contains files generated by GH, it’s safe. +// We also special case IJ-based products .idea because it integrates with CRA: +// https://github.com/facebookincubator/create-react-app/pull/368#issuecomment-243446094 +function isSafeToCreateProjectIn(root) { var validFiles = [ '.DS_Store', 'Thumbs.db', '.git', '.gitignore', '.idea', 'README.md', 'LICENSE' ];