Skip to content

Proposal: Add tag to version #249

Open

Description

@Noviny

Affected Packages

cli, probably apply-release-plan

Problem

With independent versioning, it's not clear what you need to upgrade when a release is done, since the version of each package is separate. For example, if I version [email protected] and [email protected] and [email protected] in one run of the version command, but all are linked in including the same security, patch, knowing this list of versions when upgrading (as a consumer) is very useful.

Proposed solution

Leverage tags in npm when publishing to name a release:

changesets publish --tag=one
changesets publish --tag=heather

This will allow consumers to:

yarn upgrade pkg-a@one pkg-b@one pkg-c@one

or if names are used:

yarn upgrade pkg-a@heather pkg-b@heather pkg-c@heather

Being able to publish with tags isn't necessarily a huge change.

Relevant related thing, some people using changesets already name their releases. It would be good when running 'version' to also provide this tag. This relates to #200 - it's possible you just pass this in twice, but it would be good if that wasn't necessary.

Activity

  1. danieldelcore commented on Jan 17, 2020

    @danieldelcore
    Contributor

    This is a great idea, i love it!

    Some ideas/ notes:

    • Push release names as tags for components not published so people can install the whole release at once
    • What happens to semver? Would we just need to update the tag with the latest? How would that look for consumers, deduping etc. 😄
  2. Noviny commented on Jan 17, 2020

    @Noviny
    ContributorAuthor

    Some further thoughts around this:

    It's worth noting that running npm tag may need to be run separate to publish, as we also want ti published to 'latest'


    Push release names as tags for components not published so people can install the whole release at once

    The pro of this is upgrading all packages from the monorepo is the same each time, vs needing to hunt down specific versions. Both can work from an automation perspective though, so maybe it's not that important.


    In auto-publishing, we need to think about how tags are passed in. Whether this is something changesets would want to own, or whether it's an implementation detail for the automator.

  3. emmatown commented on Jan 21, 2020

    @emmatown
    Member

    I'm not sure I understand the use case for this. Why does knowing the versions/having a special tag for it matter? Wouldn't knowing the packages that you need to update be enough(especially given that you already need to know that even if you have the tag) so that you can do this:

    yarn add pkg-a pkg-b pkg-c
    
  4. Noviny commented on Jan 21, 2020

    @Noviny
    ContributorAuthor

    it is if you assume you are always moving to latest, but we've got a fair number of cases where someone wants to upgrade to a moment-in-time, but not pass beyond that moment-in-time. The current strategy is effectively list the version of each package at that moment. This allows us to apply an arbitrary name to that moment to remove the need for such a list.

    So, the explicit goal is "I want to upgrade to a moment-in-time release of packages from a monorepo, but I do not know what versions existed at that moment"

  5. added
    discussionOpen discussion of a topic - looking for ideas and consensus
    on Jan 27, 2020
  6. thekevinbrown commented on Apr 6, 2020

    @thekevinbrown

    Also @mitchellhamilton, there's the case where let's say that (hypothetically) Keystone v8 doesn't work with Node 10, but I have to stay on Node 10 because of infrastructure reasons. In this case, I either need a table of Keystone v7.0.1 is compatible with Knex Adapter v6.0.0, and v7.0.2 is compatible with Knex Adapter v7.0.0, for every single package in the monorepo, or I have to look at publish times and guess, then hope I haven't introduced a subtle breakage that I don't notice between packages that aren't compatible.

    There have been quite a few people on Slack confused recently because the versions of the packages don't line up (e.g. I've got Keystone 7, where is Admin UI 7?), and if there were a consistent way of getting all the packages that worked together that aren't the latest, this'd be hugely helpful.

  7. Noviny commented on Apr 6, 2020

    @Noviny
    ContributorAuthor

    Just capturing some notes from an internal discussion around this as it looks like this will be implemented soon:

    There will be a new config option for getNextTagName, which will behave similarly to the changelog generators, provide a function and maybe options.

    I'll make a default one that just goes through a list of names and uses the next one in the list.

    The latestTag will be written back after versioning. Unsure what file to add it to (is modifying the config okay??). The next call of publish will use the tag.

    Names here are very draft.

    This feature will be off by default - I am aiming for this to be a minor change.

    Below are unfiltered release notes Opinion on where combined release notes live? `[release-notes.md](http://release-notes.md)` or `[changelogs.md](http://changelogs.md)` in root

    SO how does this affect changesets?

    Change to version

    • needs to output the 'release' and write it to a file
    • needs to know what the next tag will be at this point
    • Mark new tag as 'latest tag'

    Change to publish

    • After publish, we need to run npm dist-tag add package@latest latest tag

    What config do we need?

    • We need the last release

    • We need a list of releases (where we can look up the next release) releaseTagKeyThing || true

    • config the release goes to is customisable

    • What happens if a tag name appears twice?

      • EXPLODE with good erroring

    Question: what happens if there is no next thing?

    • We error very very loudly
  8. Noviny commented on Apr 6, 2020

    @Noviny
    ContributorAuthor

    For helpfulness, going to go with getNextReleaseName and latestRelease as the new keys, as the fact they add tags somewhere isn't the relevant thing.

  9. Noviny commented on Apr 15, 2020

    @Noviny
    ContributorAuthor

    Big thing that needs to be talked about above: How often do you iterate the tag name?

    Important thing is often you want to patch the latestTag, not create a new tag. This needs to be pretty seamless.

    Need to run some experiments on how to do this.

  10. Andarist commented on Sep 15, 2020

    @Andarist
    Member

    @Noviny how this relates to the new manypkg npm-tag?

  11. Noviny commented on Sep 15, 2020

    @Noviny
    ContributorAuthor

    Probably closing this while experimenting with manypkg npm-tag - That was intended to be a less intrusive lighter weight way of achieving the same objjectives.

  12. jorenbroekema commented on Jun 7, 2021

    @jorenbroekema
    Contributor

    We actually kinda need this feature, are you still planning to implement this?

    What is the workaround right now, do a manual npm dist-tag add <package-name>@<version> [<tag>] on post publish in a script maybe?

  13. jorenbroekema commented on Jun 20, 2021

    @jorenbroekema
    Contributor

    I just realized my proposed workaround wouldn't be sufficient.

    Imagine publishing @foo/[email protected] , it will get the "latest" npm dist tag.
    Then publish @foo/[email protected], it will get the "latest" npm dist tag.
    So even if you then do npm dist-tag add @foo/[email protected] one, you're still stuck with latest pointing to the wrong thing. You may be able to configure something yourself that restores the latest dist-tag back to the correct thing again but it's definitely some effort :\

    The use case for this is as follows (also illustrated by the scenario above): we have a latest (major v2) and a legacy branch too (major v1). Sometimes we find bugs that have to also be fixed on v1 so we have to publish a new version of our legacy (major v1).
    dist-tags make it easy to ensure that latest is always pointing to v2, by ensuring you publish to dist-tag v1 for example or legacy when you publish a new patch or minor on major v1.

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

    discussionOpen discussion of a topic - looking for ideas and consensus

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions