Skip to content

pre mode with "latest" dist-tag publishing? #786

Description

@FredKSchott

Hey everyone! Fred from Astro here, and we've just entered a 2-month v1.0.0-beta.X period before our official Astro v1.0 release in June.

We've been happy changeset users so far but now I'm not sure the best way to structure/configure changesets for the next two months. What I'd really want is...

What we want:

  • Every package in the monorepo released to latest
  • Only astro is versioned at v1.0.0-beta.X, all others follow v0.x semver
  • don't need to be in pre mode if we can help it.

What we've tried:

But I don't think that's possible. Based on what I know of changesets, I expected this to work as a secondary option:

  • monorepo is in pre mode (tag: 'beta')
  • when we publish, we can still publish all packages to latest

The problem is that changeset publish --tag latest doesn't seem to be respected. When I run a dry-run, I see an error that --tag isn't supported in pre mode.

Any thoughts for how we could achieve something like this with changesets? Since it's short term, I'm willing to do something hacky if you have any suggestions. Thank you!

Activity

  1. Andarist commented on Apr 5, 2022

    @Andarist
    Member

    What should be the tag for the astro? Should it be beta here? Should the astro@latest keep pointing to some older 0.x version?

    The problem is that changeset publish --tag latest doesn't seem to be respected. When I run a dry-run, I see an error that --tag isn't supported in pre mode.

    Even if this would work... what would happen to astro? changeset publish tries to publish everything that has not yet been published to the registry. And it seems that you want to avoid publishing astro beta versions as latest (unless I misunderstood the issue).

    If this would help you - I'm open to scheduling a quick call to hash it out cause I think there is definitely some workaround (even if slightly hacky :P) to make it work for you. I just need to understand all of your constraints/requirements properly

  2. diegohaz commented on Apr 7, 2022

    @diegohaz

    From what I understand, they want to publish astro@1.0.0-beta.X as the latest tag on npm. I have the same requirement with ariakit.

    Update 1: did a test here (ariakit-changesets-test) and it looks like the alpha version has been published on the latest tag, which is what I wanted for now. But now I'm confused. I would expect it would create a new dist-tag called alpha. Am I missing something?

    Update 2: I now understand that it was released on the latest tag because I didn't have any stable release on the ariakit-changesets-test package.

    Update 3: I was able to force the latest tag on the prerelease by using the publishConfig field on the package.json file.

  3. Andarist commented on Apr 7, 2022

    @Andarist
    Member

    Update 2: I now understand that it was released on the latest tag because I didn't have any stable release on the ariakit-changesets-test package.

    Yes, the latest tag has to be set to something - that's a requirement of the npm registry.

    Update 3: I was able to force the latest tag on the prerelease by using the publishConfig field on the package.json file.

    Interesting. So you have just added something like this?

    {
      "publishConfig": { "tag": "latest" }
    }

    Which npm client do you use?

  4. FredKSchott commented on Apr 7, 2022

    @FredKSchott
    Author

    Update 3: I was able to force the latest tag on the prerelease by using the publishConfig field on the package.json file.

    Interesting! @diegohaz Did this work automatically with changesets publish, or did you have to define your own publish step using pnpm/yarn/npm, outside of changesets?

  5. Andarist commented on Apr 7, 2022

    @Andarist
    Member

    I'm pretty sure that this is not handled by Changesets and that it might only be handled by some package managers (I'm unsure which ones support this).

  6. FredKSchott commented on Apr 7, 2022

    @FredKSchott
    Author

    If this would help you - I'm open to scheduling a quick call to hash it out cause I think there is definitely some workaround (even if slightly hacky :P) to make it work for you. I just need to understand all of your constraints/requirements properly

    @Andarist apologies for missing this! We're in the middle of a big launch week which has been quite busy 😅 . If you're interested in joining us in Discord, we could do this async but maybe a bit more high-touch? astro.build/chat

    Otherwise, happy to keep debugging here!

  7. diegohaz commented on Apr 7, 2022

    @diegohaz

    I'm using npm 8. I think publishConfig is a feature of npm.

  8. FredKSchott commented on Apr 7, 2022

    @FredKSchott
    Author

    @Andarist honestly, I'm starting to think we might want to fork changesets, and do an astro-specific hack to get us through the next 2 months. I keep getting stuck on ideas:

    • Run a post-publish npm dist-tag add astro@1.0.0-beta.X latest step to our GitHub Action, so that latest always matches beta (okay, but we need this for all packages in the monorepo, not just Astro)
    • Run a post-publish npm dist-tag add X@Y latest step to our GitHub Action, so that latest always matches beta for all packages in the monorepo (okay, but non-Astro dependencies are getting the -beta.1 unnecessarily. We kind of want them to be non-beta, non-pre, normal semver)
    • I can't think of any way this could work without the repo being in pre-mode.

    I think the smallest fork we could make, would be to keep the monorepo in normal mode, but then surgically overwrite whatever internal logic handles version bumping, to just always handle "astro" as a special case to always bump as 1.0.0-beta${X+1}. Everything else about normal "non-pre" mode would remain the same.

    @Andarist what do you think?

    Edit: From poking around the codebase, I feel like this is where the one-off would live:

    let version = semver.inc(release.oldVersion, release.type)!;

    Edit 2: Yup, adding this line to that file above created a correct changeset version output:

      if (release.name === 'astro') {
        version = semver.inc(release.oldVersion, 'prerelease');
      }
    
  9. Andarist commented on Apr 8, 2022

    @Andarist
    Member

    Yeah, forking seems to be the easiest solution to this - especially given that you only need this temporarily~.

    In general, Changesets has not been designed to handle multiple independent "release plans". It's not impossible to add support for those... but it raises the complexity quite a bit because we would have to consider how parallel release plans interact with each other, can they overlap somehow? Can A from RP1 depend on B from RP2? etc etc. This would require deeper thought, analysis, and implementation - and, unfortunately, I'm so slammed with piling OSS issues that I just don't have capacity to do all of this on my own.

  10. matthewp commented on Apr 8, 2022

    @matthewp

    @Andarist

    What should be the tag for the astro? Should it be beta here? Should the astro@latest keep pointing to some older 0.x version?

    No, the tag should be latest.

    This doesn't seem to go against what changeset is doing that much to me. We just want it to be the latest tag instead of the beta tag.


    @FredKSchott

    Run a post-publish npm dist-tag add X@Y latest step to our GitHub Action, so that latest always matches beta for all packages in the monorepo (okay, but non-Astro dependencies are getting the -beta.1 unnecessarily. We kind of want them to be non-beta, non-pre, normal semver)

    Do we? Why? It seems perfectly fine for everything to be marked with the beta version but still tagged latest. I could see possible accidental breakage if we started releasing patches that go out to 0.26.x users on the non-astro projects that implicitly only work with astro beta.

    I agree with @Andarist here that this is the part that seems undoable with how changeset works, you're either in pre-mode or not. I think being in pre-mode for everything is fine, but just with the difference of the tag being latest rather than the pre tag (beta, in this case).

  11. Andarist commented on Apr 8, 2022

    @Andarist
    Member

    This doesn't seem to go against what changeset is doing that much to me. We just want it to be the latest tag instead of the beta tag.

    Maybe we could actually respect publishConfig.tag if that's a thing supported by other tools - I would love to know which tools actually support this.

    This implies though that all your versions would be "preversions" - the only difference would be in the published tag.

  12. diegohaz commented on Apr 8, 2022

    @diegohaz

    Maybe we could actually respect publishConfig.tag if that's a thing supported by other tools - I would love to know which tools actually support this.

    From what I tested, Changesets already supports this (maybe npm just forces this tag and ignores whatever tag you pass to the npm publish command).

    As for other tools, I've used the same approach with lerna in the past.

  13. added theissue type on Jun 30, 2026
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions