Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable updating custom version files with changeset version #1166

Open
dominikg opened this issue May 30, 2023 · 1 comment
Open

enable updating custom version files with changeset version #1166

dominikg opened this issue May 30, 2023 · 1 comment

Comments

@dominikg
Copy link

dominikg commented May 30, 2023

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.

@dominikg
Copy link
Author

Looks like with commit: false option which is the default, it is possible to do this after changeset version and before commiting. The changeset action allows to pass a custom version script so with a bit of scripting effort this is achievable today.

Still would be nice to have something builtin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant