Repository navigation
Description
Affected Packages
I'm unsure.
Problem
I'm not sure if this is a problem or if this is me misunderstanding something.
I have this PR that creates a brand new package (@mels/eslint-config-base). It hadn't been published to npm yet before creating the PR. I hadn't even added a changeset yet to the PR because I'm still working on it, and the version is 0.0.0 in the package.json.
I have a GitHub Actions workflow in the repo that creates snapshots on pull requests, so that I can test PRs by installing at each commit if needed.
Despite not even adding a changeset yet to my PR, it's gone and published 0.0.0 to npm. Is that intended behavior? 🤔 I thought that it was supposed to wait until there's a changeset before publishing something? Or if it needed to publish something first (just to get something up in the registry since it didn't exist previously), shouldn't it have published 0.0.0-prerelease-96f1f5f in this case?
6s
Run COMMIT_SHA=653789aa0bef7e6da3408f2cc26[1](https://github.com/melanieseltzer/toolkit/runs/5194225946?check_suite_focus=true#step:5:1)0bc808bf6a0b
yarn run v1.22.[17](https://github.com/melanieseltzer/toolkit/runs/5194225946?check_suite_focus=true#step:5:17)
$ changeset version --snapshot prerelease-653789a
🦋 warn No unreleased changesets found, exiting.
Done in 0.51s.
yarn run v1.[22](https://github.com/melanieseltzer/toolkit/runs/5194225946?check_suite_focus=true#step:5:22).17
$ changeset publish --tag prerelease
🦋 warn ===============================IMPORTANT!===============================
🦋 warn Packages will be released under the prerelease tag
🦋 warn ----------------------------------------------------------------------
🦋 info npm info @mels/eslint-config-base
🦋 info npm info @mels/eslint-patch
🦋 warn Received 404 for npm info "@mels/eslint-config-base"
🦋 info @mels/eslint-config-base is being published because our local version (0.0.0) has not been published on npm
🦋 info Publishing "@mels/eslint-config-base" at "0.0.0"
🦋 warn @mels/eslint-patch is not being published because version 1.0.1 is already published on npm
🦋 success packages published successfully:
🦋 @mels/[email protected]
🦋 Creating git tag...
🦋 New tag: @mels/[email protected]
Done in 5.[26](https://github.com/melanieseltzer/toolkit/runs/5194225946?check_suite_focus=true#step:5:26)s.
Out of curiosity, I made a test PR against a package that already exists in the registry and didn't add a changeset. It did not publish anything. That is exactly what I want since I didn't add a changeset yet.
3s
Run COMMIT_SHA=96f[1](https://github.com/melanieseltzer/toolkit/runs/5195511247?check_suite_focus=true#step:5:1)f5fb8[15](https://github.com/melanieseltzer/toolkit/runs/5195511247?check_suite_focus=true#step:5:15)97e9cc79301cbe042829a2ddd1ece
yarn run v1.22.[17](https://github.com/melanieseltzer/toolkit/runs/5195511247?check_suite_focus=true#step:5:17)
$ changeset version --snapshot prerelease-96f1f5f
🦋 warn No unreleased changesets found, exiting.
Done in 0.63s.
yarn run v1.[22](https://github.com/melanieseltzer/toolkit/runs/5195511247?check_suite_focus=true#step:5:22).17
$ changeset publish --tag prerelease
🦋 warn ===============================IMPORTANT!===============================
🦋 warn Packages will be released under the prerelease tag
🦋 warn ----------------------------------------------------------------------
🦋 info npm info @mels/eslint-config-base
🦋 info npm info @mels/eslint-patch
🦋 warn @mels/eslint-config-base is not being published because version 0.0.0 is already published on npm
🦋 warn @mels/eslint-patch is not being published because version 1.0.1 is already published on npm
🦋 warn No unpublished packages to publish
Done in 2.94s.
Any insight here as to what went wrong with the brand new package, and how I could avoid this behavior of publishing 0.0.0 on first PR?
Activity
Andarist commentedon Feb 15, 2022
Duplicate of #241
It's hard to answer some questions asked here. This is how it actually works right now and it is sort of by design. The current design has weird side-effects like this though and I think this can be very confusing for people. So I would say that this is a crack in this design - one that should be addressed somehow. However, I have no good idea about how I would currently adjust the algorithm to handle this in a better way (although I didn't think about it too much yet).
The problem is that:
changeset versionandchangeset publishare decoupled. No information is shared between them. Note that with some other monorepo-aware tools you might end up in a similar problem if you end up using their publish script. I didn't test this but I don't see how this would work any different with a script likeyarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish --tag=dev --access=publicorpnpm -r publish. In case of thepnpmthis is even called out (somewhat) explicitly in the docs:changeset versionfrom the git history (this would be quite cumbersome to do anyway as there are many ways people can actually integrate Changesets with their projects)We could also follow up on the discussion taking place here: #600 and we could handle
.changeset/config.json#ignorewithinchangeset publishto filter stuff out. However, while this probably be a good thing... it wouldn't quite solve your problem because you'd have to explicitly include a package in that option.My recommendation, for now, would be to mark such non-publishable packages (even if temporarily) with
private: true.melanieseltzer commentedon Feb 23, 2022
Marking
private: truewhile developing seems like a good/easy enough solution 👍 Appreciate the detailed explanation @Andarist!Is this first publish behavior +
private: truerecommendation documented somewhere? If not, I'd be happy to submit a PR adding it 🙂 Was thinking under the publish command section?Andarist commentedon Feb 23, 2022
Please PR this it you can 🙏 docs PRs are the best!
melanieseltzer commentedon Feb 23, 2022
@Andarist PR open #762 I did my best to try and summarize the problem in that it mostly relates to automatic snapshots, I think (because normally you wouldn't be running
changeset publishunless a changeset has been generated already). Let me know if I need to phrase things differently 😄Document accidental new package publish
bluwy commentedon Jun 30, 2026
This is now documented in the site at https://changesets.dev/guide/cli#publish. I've compacted the information a bit so it doesn't take up too much space and leaves room for the general command docs, but I've added as a co-author for the changes in the commit.
Add new docs site (changesets#1979)