-
Notifications
You must be signed in to change notification settings - Fork 3k
Rename .gitignore to .npmignore in package if no .npmignore found #1862
Comments
+100 on this. I've lost count of the number of times I've managed to check in a dependency without realising that its dependencies are missing! |
This "feature" threw me off for a long time when trying to package my first node library. I am generating the code from coffeescript, so while my
my Regardless of whether my approach is ideal, the behavior is very confusing. I wouldn't expect that my I would suggest one or more of the following changes:
|
+1 @cespare . Please reopen for consideration. |
The .gitignore files are only renamed to .npmignore when they're treated as such. If a .npmignore file is already present, then .gitignore files are excluded. This is to make it easier to check node_modules folders into source control for deployed apps. Doc patches are always welcome, but the behavior is not going to change. |
Thanks for clarifying, @isaacs. I made a pull request for a tweak to the docs that would have helped me out, at least. I can see why removing
doesn't really make sense to me. How can you assume that the files that people want git to ignore are the same that they don't want included in their package? |
Given the number of complaints I'd received from people who accidentally published stuff that's .gitignore'd, vs the number of complaints from people who accidentally didn't publish stuff that's .gitignore'd once the change was made, yes, the data is overwhelmingly not in your favor here. There's no way to not confuse anyone. Even that sentence is sort of confusing. |
This design really becomes a bit draconian when creating yo modules to setup new projects - particularly where you want to include a .gitignore file - this hidden 'feature' breaks my yo generator that has a .gitignore (by renaming it to .npmignore). Besides, I don't want node_modules checked in - I want to force developers to define explicit versions in their package.json and require an 'npm install' upon code checkout to assure packages are explicitly listed or the build fails (particularly on the build server). We have a private repo and caching proxy to assure these dependencies aren't lost and our more frequent installs don't impact the public npm repo. |
Closes #10 npm calls it a feature. I call it a bug. npm/npm#1862
npm calls it a feature, while I call it a bug. npm/npm#1862;
This is breaking my yeoman generator, as well: Lostmyname/generator-component#1 Is there any reason to completely remove the .gitignore? It only saves a few bytes, but it messes up Yeoman and ember generators (see some of the issues above). |
Yepp also breaking my generator. I have a templates/.gitignore file, which in fact is just a template file. I guess I should just rename it to gitignore in it's template form. Either way, a bit annoying to have third party code screw with your files. |
@JaysonRaymond @callumacrae @kosz Can we center the generators discussion at #7252? It would be nice if we could come up with a solution that solves both use cases. |
NOTE: This implementation is a workaround for the npm .gitignore/.npmignore behavior discussed in: - npm/npm#1862 - npm/npm#3763 - npm/npm#7252
NOTE: This implementation is a workaround for the npm .gitignore/.npmignore behavior discussed in: - npm/npm#1862 - npm/npm#3763 - npm/npm#7252
The package is broken because `npm publish` has renamed `gitignore` to `.npmignore`. * npm/npm#1862 * npm/npm#7252
npm renames .gitignore to .npmignore in the event that a .npmignore file doesn't exist. This is indented behavior on npm's part. Add special handling for this case. See npm/npm#1862
Because npm never publishes a `.gitignore` file, we need to rename our `.gitignore` files in our templates to `_gitignore` and have the `hops-local-cli` `init()` method rename it again, after unpacking. Read more about it: npm/npm#1862 Related to: #275
Because npm never publishes a `.gitignore` file, we need to rename our `.gitignore` files in our templates to `_gitignore` and have the `hops-local-cli` `init()` method rename it again, after unpacking. Read more about it: npm/npm#1862 Related to: #275
addressing: npm/npm#1862
NOTE: This implementation is a workaround for the npm .gitignore/.npmignore behavior discussed in: - npm/npm#1862 - npm/npm#3763 - npm/npm#7252
XXX TODO: USE fs-extra function instead, XXX WAITING FOR apache#14 to be merged NOTE: This implementation is a workaround for the npm .gitignore/.npmignore behavior discussed in: - npm/npm#1862 - npm/npm#3763 - npm/npm#7252
affects: @zetapush/create
When packaging up a folder, if there's a gitignore file and no .npmignore file, add it to the tarball as .npmignore.
Always exclude .gitignore files from packages.
This is to better support the "check node_modules into git" approach.
The text was updated successfully, but these errors were encountered: