Skip to content

[Feature] Do not always include the changelog.* files in a package #6793

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

Open
2 tasks done
mrazauskas opened this issue May 12, 2025 · 7 comments · May be fixed by #6794
Open
2 tasks done

[Feature] Do not always include the changelog.* files in a package #6793

mrazauskas opened this issue May 12, 2025 · 7 comments · May be fixed by #6794
Labels
enhancement New feature or request

Comments

@mrazauskas
Copy link

  • I'd be willing to implement this feature (contributing guide)
  • 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!

@mrazauskas mrazauskas added the enhancement New feature or request label May 12, 2025
@arcanis
Copy link
Member

arcanis commented May 12, 2025

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.

@mrazauskas
Copy link
Author

Shall I open a PR removing these pattern? (Feel free to merge without rush, at any comfortable time.)

@mrazauskas
Copy link
Author

mrazauskas commented May 12, 2025

I think inherited it from npm

Right, seems like they removed this behaviour in npm/npm-packlist#61 (or that’s something else?)

@arcanis
Copy link
Member

arcanis commented May 13, 2025

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.

@mrazauskas mrazauskas linked a pull request May 13, 2025 that will close this issue
3 tasks
@mrazauskas
Copy link
Author

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.

@clemyan
Copy link
Member

clemyan commented May 15, 2025

Hmm... npm's current docs still lists CHANGELOG as never ignored. I guess they didn't update that when they made the change?

@mrazauskas
Copy link
Author

mrazauskas commented May 15, 2025

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: npm/cli#8295

@mrazauskas mrazauskas changed the title [Feature] Add an option that would allow ignoring changelog.* files [Feature] Do not always include the changelog.* files in a package May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants