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

Adds .gitignore file to default template #79

Merged
merged 4 commits into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions scripts/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Copy link
Contributor

@vjeux vjeux Jul 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't over abstract things. There's only one case right now so you can just write

fs.move(path.join(hostPath, 'gitignore'), path.join(hostPath, '.gitignore'));

which is going to be clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

].forEach(function(nameMap) {
fs.move(path.join(hostPath, nameMap[0]), path.join(hostPath, nameMap[1]), []);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the empty array as third argument doing?

Copy link
Contributor Author

@npverni npverni Jul 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was in issue with fs.move erring without that param:

node_modules/fs-extra/lib/move/index.js:19
  var shouldMkdirp = ('mkdirp' in options) ? options.mkdirp : true
                                  ^

TypeError: Cannot use 'in' operator to search for 'mkdirp' in undefined

The third param is an empty array so that in doesn't throw an error.

});

// 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?
Expand Down
7 changes: 7 additions & 0 deletions template/gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not name it .gitignore but gitignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't be named .gitignore due to npm/npm#1862, which is why we need to move it after the fact.


# dependencies
/node_modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the leading /, it looks like you're not putting it for npm-debug.log


# misc
npm-debug.log