Skip to content

enable updating custom version files with changeset version #1166

Open

Description

Affected Packages

changesets/cli , version command

Problem

sometimes a package wants to export it's version. To do that, it needs to include something like

// version.js , autogenerated, do not modify
export const VERSION = '1.2.3';
// index.js
export VERSION from './version.js'

in it's output.

But version.js can only be updated after changeset version has bumped package.json. Leading to a situation where the version value in package.json and version.js is different until a separate generate-version-js script has been run.

If for whatever reason these two go out of sync, there could be a release where the VERSION export does not correctly reflect the version of package.json, which would be very confusing at best and lead to hard to track errors at worst.

Proposed solution

improve the version command allow updating other files with the bumped verison. This could be other files like documentation too.

One workaround could be to use a custom version arg with the @changeset/action, but this ties it to github actions.


Background: we are moving svelte to a pnpm monorepo with changesets and need to export the version in unbundled esm.

Activity

  1. bluwy commented on Oct 6, 2024

    @bluwy
    Member

    Perhaps related to #982 requesting "postversion" script hook support

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