Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore .idea folder #522

Merged
merged 2 commits into from
Aug 31, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions global-cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -167,11 +167,12 @@ 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', 'README.md', 'LICENSE'
'.DS_Store', 'Thumbs.db', '.git', '.gitignore', '.idea', 'README.md', 'LICENSE'
];
return fs.readdirSync(root)
.every(function(file) {
Expand Down