Skip to content

Add dry run option to CLI publish command #614

Open

Description

@raypatterson

Affected Packages

  • @changesets/cli

Problem

  • It's not possible to verify the end to end publishing configuration without publishing

Proposed solution

[package manager] changeset publish --dry-run

Activity

  1. Andarist commented on Oct 10, 2021

    @Andarist
    Member

    This is a very good idea - I've actually lately created a duplicate of this issue: #645

    I probably won't have time to work on this at the moment though. An implementation provided by the community would be awesome.

  2. dkozma commented on Feb 28, 2024

    @dkozma

    @Andarist It looks like #669 can resolve this issue, and has been open for a bit, is there any way that can be merged in? It looks like all of the concerns in the PR have been addressed, unless I missed something.

  3. denbite commented on Apr 24, 2025

    @denbite

    just wanted to drop a note here since this PR has been open for quite a while and it doesn’t look like it’s getting merged anytime soon

    for anyone looking for a workaround to simulate a dry run in the meantime, here’s a solution that’s worked for me

    pnpm changeset status --output sim.json

    this command will create a sim.json file like the following

    {
      "changesets": [
        {
          "releases": [
            {
              "name": "pkg-a",
              "type": "major"
            },
            {
              "name": "pkg-b",
              "type": "minor"
            }
          ],
          "summary": "Description",
          "id": "rotten-flies-butter"
        }
      ],
      "releases": [
        {
          "name": "pkg-a",
          "type": "major",
          "oldVersion": "1.3.1",
          "changesets": [
            "rotten-flies-butter"
          ],
          "newVersion": "2.0.0"
        },
        {
          "name": "pkg-b",
          "type": "minor",
          "oldVersion": "1.6.8",
          "changesets": [
            "rotten-cases-dance"
          ],
          "newVersion": "1.7.0"
        }
      ]
    }

    hope this helps someone 👌

  4. raypatterson commented on Apr 25, 2025

    @raypatterson
    Author

    I've been using verdaccio

  5. Andarist commented on Apr 25, 2025

    @Andarist
    Member

    I'd like to understand the use case better before committing to this. What a dry run even is in this context? Could somebody write down what's the goal is and how it is different from calling changeset version?

  6. raypatterson commented on Apr 25, 2025

    @raypatterson
    Author

    Thanks for the question and all the work on this tool @Andarist !

    The dry run reports what will happen without actually doing anything.

    Maybe this PR from the beachball tool could be a point of reference?

  7. shakiba commented on Apr 25, 2025

    @shakiba

    Use case: similar to npm publish dry-run, to validate what would be published without actually publishing.

  8. Andarist commented on Apr 25, 2025

    @Andarist
    Member

    I just wonder how you want to use this because changeset version already applies all of the updates on disk and it doesn't publish to the registry. So how this is different from changeset version? 🤔

  9. cjpearson commented on Apr 25, 2025

    @cjpearson

    changeset version and changset status outputting to JSON have covered most of my needs.

    However, we occasionally have issues where the version on npm doesn't match the version in the repository. (Typically if something failed in the publish job after pushing to npm) If it's not cleaned up, then a subsequent publish will try to create the release again but will skip pushing to npm because the version already exists there.

    I also haven't used the npm functionality, but perhaps a publish dry-run would be able to catch this?

    Another small benefit would be validating the tag creation without actually pushing to npm.

  10. raypatterson commented on Apr 25, 2025

    @raypatterson
    Author

    @Andarist I guess this is more about publishing for me. I want to see a representation of what will be published to ensure everything is correct. I'm curious about the PR attached to this issue and whether people think it was the expected solution. #669 (comment)

  11. caseyisonit commented on May 7, 2025

    @caseyisonit

    I'm working in a very complex, very old, messy mono repo with a bundle and individual component packages. I'm debugging our versioning and tagging. This feature would be massively helpful for working through my issues with the confidence that I won't actually publish anything, but also get useful outputs to work against. I'll be looking into the workaround suggested above since it's not likely this will get adopted.

    @Andarist, can you share your hesitation about adopting a widely available NPM feature? You mentioned an external contribution would be welcomed since you didn't have time to work on this; it's been four years.

  12. devjiwonchoi commented on May 11, 2025

    @devjiwonchoi

    I'd like to understand the use case better before committing to this. What a dry run even is in this context?

    I think it likely shares the same purpose as the other CLI packages' --dry-run flag: to verify that changeset publish works without actually publishing to NPM.

    My use case is that I'm adding changesets to a repository and want to verify that changeset publish works during the CI. However, I don't want to verify by publishing to NPM.

    Could somebody write down what's the goal is and how it is different from calling changeset version?

    It would differ from the changeset version because what I want is to verify if "NPM publish" worked, not "versioning the packages" worked.

  13. alburdette619 commented on Jun 17, 2025

    @alburdette619

    I'm currently in need of this option. I am running into an issue where the calls to npm info from publish are getting an inconsistent E401. The token seems fine and different packages each time trigger the error with some having worked fine the previous attempt.
    I had thought this was changset version so I commented out my call to publish but now there's no npm info calls at all. Without doing a full run of PR to make changes to my github workflows, auto run changsets to create a release PR, and then manually run my release workflow. I cannot test what I need to and have no clue why the initial issue is happening.

  14. danguilherme commented on Aug 19, 2025

    @danguilherme

    Just to be clear, adding to the comments, a dry run would also run validations, specially around authorisation -- does the npm auth token you're using work? This is very helpful when setting up CI.

    In my case we're configuring it to publish internal packages into GitHub's package registry using a GitHub App's token. Similar to others in this thread, I'd like to test my workflow without actually publishing it first.

    semantic-release's --dry-run works really well for that.

  15. dipunm commented on Jul 22, 2026

    @dipunm

    Hi, I would like to provide a use case. We use TeamCity at my workplace instead of Github actions, however we have a similar build and release flow as recommended in the docs.

    We allow the creation of pre-release packages and publish them using pnpm changeset publish

    There is a race condition:

    1. We merge a release branch to main which has bumped package.json version, updated changelogs
    2. A build queues to publish those packages
    3. A PR with a new changeset is raised
    4. The PR build runs first
    5. It identifies packages to publish as pre-release packages
    6. It publishes with a pre-release version and a prXXX tag.

    The issue is that we use the pnpm changeset publish command and the outcome in this situation is this:

    Packages that are pre-release get published with a pre-release version:
    [email protected]
    and tag
    package1@PRXXX

    Packages that are missing from our remote repository are ALSO published, but with a pre-release tag (not latest which is our saving grace)
    [email protected]
    package2@PRXXX

    The issue is that this publish happened in our PR build which is not designed to then do further work like creating github releases.

    The main build that would have published these will identify that they were already published and will skip publishing with the latest tag and creating github releases etc because it assumes that that work must have already been done if the package already exists in our repository.

    Our current use case is to be able to detect if the PR build will over publish and fail fast or take alternative action.

    In hindsight, one might consider this behaviour to simply be a bug. changeset publish should specify exactly what packages it wants to publish and not attempt to publish anything else as default behaviour.

  16. Andarist commented on Jul 22, 2026

    @Andarist
    Member

    @dipunm does this command satisfy your needs #2061 ? It's coming in the soon-to-be-released Changesets v3

  17. dipunm commented on Jul 23, 2026

    @dipunm

    @Andarist I found a workaround which was to directly call pnpm -r publish --dry-run --json and parse the output before running any changeset steps (ensuring it is clean before starting).

    That said, this blocks the pipeline (albeit a minor, easy to resolve block) which is not ideal.

    What package managers do you officially support? I found that at least with pnpm, you can use --filter and name the packages that you want to publish and it will not publish anything else. This would allow the build to run without race conditions or blocks. I can create a new issue for this if it helps?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions