Skip to content

Unexpected first time publish without adding a changeset #756

Closed

Description

@melanieseltzer

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?

Full link to logs.

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?

Proposed solution

Activity

  1. Andarist commented on Feb 15, 2022

    @Andarist
    Member

    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:

    1. changeset version and changeset publish are 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 like yarn workspaces foreach --verbose --topological-dev --parallel --no-private npm publish --tolerate-republish --tag=dev --access=public or pnpm -r publish. In case of the pnpm this is even called out (somewhat) explicitly in the docs:

    When running this command recursively (pnpm -r publish), pnpm will publish all the packages that have versions not yet published to the registry.

    1. Changesets also try to stay decoupled from git as much as possible so we don't query the result of the changeset version from 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#ignore within changeset publish to 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.

  2. melanieseltzer commented on Feb 23, 2022

    @melanieseltzer
    ContributorAuthor

    Marking private: true while developing seems like a good/easy enough solution 👍 Appreciate the detailed explanation @Andarist!

    Is this first publish behavior + private: true recommendation documented somewhere? If not, I'd be happy to submit a PR adding it 🙂 Was thinking under the publish command section?

  3. Andarist commented on Feb 23, 2022

    @Andarist
    Member

    Please PR this it you can 🙏 docs PRs are the best!

  4. melanieseltzer commented on Feb 23, 2022

    @melanieseltzer
    ContributorAuthor

    @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 publish unless a changeset has been generated already). Let me know if I need to phrase things differently 😄

  5. added theissue type on Jun 30, 2026
  6. removed theissue type on Jun 30, 2026
  7. added a commit that references this issue on Jun 30, 2026
    238700d
  8. bluwy commented on Jun 30, 2026

    @bluwy
    Member

    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.

  9. added a commit that references this issue on Jul 29, 2026
    1b9687f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions