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
Ensure no extraneous files get published #103
Comments
👍 👍 I can't believe I didn't think of that. I'm like the biggest proponent of the How about failing if there's neither and warn about recommending |
I had the same thought :D I'd be fine with that. I think you should you be able to force through the error with an option though. |
Why? There's absolutely no reason to not use either |
I agree with Sindre. It gives me the creeps to see test files being part of a shipped dependency... |
I'm thinking of the case when you started a new repo and want/need to publish it quickly for some reason and you don't want to mess up the package by quickly adding a files property without checking it's right. Maybe you don't have the time to check it because it's very urgent and you'd need to make a PR to add the files field and get it approved by your team, etc... Ok, maybe it's a bit farfetched, I agree. But other than this case, I don't see a good reason no. I thought about letting this pass when the package is so simple that it would not publish anything extra anyway, but I'm not sure it's worth going through the trouble of implementing it for what seems like a very edgy case. you want to publish your repo for the |
I would suggest adding this functionality without an option. If someone comes up with a valid use case, we can always reconsider. |
Yeah, let's do that. Anyway, if this case comes up, they could still use the original npm publish |
The only thing that makes me a bit anxious is that of the two solutions, Currently I have opted to push for Will be hard though to test whether I'm 👍 on adding a warning though, especially as a first step, to nudge people in this direction. If one could then somehow add a safety net to catch missing additions to either |
How is this worse than not using
See: #82 |
@sindresorhus It's worse as |
Related: perhaps there can be a size check too/instead. Shipping a hundred 1KB files (like tests, usually) is not as bad as a 5MB package. To put things into perspective, all babel's tests take 750KB of disk space (although they are 4000 files) |
@voxpelli gitignore might be ignored at some point:
|
@bfred-it Totally and that would solve my anxiety here that enforcing a mechanism like this on people not expecting a mechanism like this will result in them doing things that goes against their intentions. But we're not there now so until we are I will be restrictive in adding either So I'm 👍 on any nudging to raise awareness about this issue in the meanwhile though, but 👎 on any enforcing until a change like the one you mention has been implemented. |
If we would enforce it, you can easily just add an empty |
@SamVerschueren Simply adding an empty |
@voxpelli That's a fair point. But instead of creating an empty |
Is there a verdict then? |
@IssueHunt has funded $60.00 to this issue.
|
@itaisteinherz Yes, let's start with a warning, and we can consider making it an error in the future if the warning works out well. I would show the warning at startup before the publish process begins. I wonder if we could check with Git if any files were added since the last release, and if so, we could check if they match any patterns in |
@sindresorhus Even before the |
@itaisteinherz I would show it before/above |
The We still need to do:
|
I read the discussion and i wanted to started working on this. |
I while ago I created a CLI tool called It asserts that you have explicitly declared all files as either included or excluded. It does not do anything with git, which makes sense in case you have non-versioned build artifacts that you must remember to declare. Anyway, I see that #456 is almost done already, but I'll leave this here anyway since the implementation is a bit different. Maybe future versions of |
@sindresorhus has rewarded $54.00 to @bunysae. See it on IssueHunt
|
I think it will be nice if, before publishing,
np
checked whether the package has either:files
field inpackage.json
a .npmignore
fileThis would help publishers make cleaner packages and reduce the bandwidth used when installing the resulting package.
I would actually advocate towards making sure there is a
files
field, as it's better IMO than using.npmignore
, but that's just my opinion. A well designed.npmignore
has the same result.IssueHunt Summary
bunysae has been rewarded.
Backers (Total: $60.00)
Submitted pull Requests
Tips
The text was updated successfully, but these errors were encountered: