[Feature] Do not always include the `changelog.*` files in a package
- [x] I'd be willing to implement this feature (contributing guide)
- [x] This feature is important to have in this repository; a contrib plugin wouldn't do
Describe the user story
Currently yarn npm publish and yarn pack do always include changelog.* files and do not allow to ignore them.
The problem is that the change-log file is always growing and it makes the package install size become larger all the time. For instance, in the jest repo the change-log file takes roughly 310 kB.
Not sure how they publish, but in jests case changelog.md is not included in the published packages. Perhaps because it is a monorepo and they have only a single change-log in the root.
I work on a small project which is not a monorepo and its size is only 238 kB. In this case, yarn npm publish would always include changelog.md. That blows up the install size.
Even when I add optimisations and document them in the change-log file, the published package is getting larger. Although, I wanted to make it smaller. That is rather demotivating.
I mentioned jest, because my project is a CLI tool as well. It is not bundled. Hence the install size is the important measure.
Describe the solution you'd like
Add an option that would allow ignoring changelog.* files.
Describe the drawbacks of your solution
Publishing a package with or without changelog.md makes no difference. I understand a package manager can be opinionated, but still there is no difference, wherever changelog.md is included in a package or not.
Adding an option increases the API surface. If that is not acceptable, simply do not include changelog.md in published packages. Force including is a drawback because all the packages become larger and larger over the time.
Describe alternatives you've considered
To use different name for the file: history.md, releases.md or so.
This works, but at the same time I feel like getting punished, when I name the file changelog.md. I really like Yarn. It is the best of all. Could I use the changelog.md file name without that feeling, please?
Or I am pushed to use npm publish. But I do not like some aspects of its behaviour.
Or I could write a script that would pack and publish the package just like yarn npm publish does, but without including changelog.md. Honestly, sounds like dream!
It was inherited from Yarn 1, which I think inherited it from npm: https://github.com/yarnpkg/yarn/blob/7cafa512a777048ce0b666080a24e80aae3d66a9/src/cli/commands/pack.js#L50
I don't have a very strong opinion on this - although just a small note the size isn't really an issue in PnP installs since the files won't be unpacked to disk, and text files are typically trivial to compress.
Shall I open a PR removing these pattern? (Feel free to merge without rush, at any comfortable time.)
I think inherited it from npm
Right, seems like they removed this behaviour in https://github.com/npm/npm-packlist/pull/61 (or thatβs something else?)
That seems like it indeed; I'm ok to remove it, but note it'll have to wait the next major, which may take some time.
note it'll have to wait the next major, which may take some time.
Understandable. I saw that the change in npm broke someone. The change is trivial, should be easy to maintain the PR for long time.
Thank you for quick and constructive response.
Hmm... npm's current docs still lists CHANGELOG as never ignored. I guess they didn't update that when they made the change?
Funny. Click a link at the bottom of that section:
See package.json for more info on what can and can't be ignored.
Scroll to #files. CHANGELOG is not listed there. Seems like an oversight in the Developer Guide (the link you provided).
UPDATE: They just merged a PR removing the line which was still listing CHANGELOG as never ignored: https://github.com/npm/cli/pull/8295