You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was in pre-release mode and I needed to publish one package out of pre-release. This package has no dependency with others packages so I guessed it won't be that complicated...
changeset pre exit
changeset version --ignore pkg1 --ignore pkg2 ...
No error so far
🦋 All files have been updated. Review them and commit at your leisure
But I can see that all my packages have bumped in version and their changelog has changed too. Nothing seems to be ignored at all.
From what I understand, changesets files related to the ignored packages are still present in the .changeset folder. But the version bump still occurs and we have to deal with resetting any changes for these packages.
Also, since we exited pre-release mode, I was expecting that the changesets array inside .changeset/pre.json would still be populated with changesets related to ignored packages...
But after the version bump, this file disappears, and when re-entering pre mode the new file contains an empty array.
Here again, the only solution is to modify the pre.json file manually or by script.
Proposed solution
Avoid bumping version of ignored packages
Make the ignore options work even in scenarios where we just exited pre-release mode.
When entering pre mode we should have the option to pre-populate the pre changesets list with already present changeset files.
Since the ignored packages should not be version bumped, I would expect that the version of packages listed in pre.json would still be correct.
Current Workaround
This is my script to do the expected result for now:
#!/bin/bashif [ -z"$1" ];thenecho"Please provide an argument (either 'version' or 'publish')"exit 1
fiif [ $1!="version" ] && [ $1!="publish" ];thenecho"Invalid argument. Please provide either 'version' or 'publish'"exit 1
fi#### VERSION ####if [ $1=="version" ];then# Create a new branch to review version bump changes
git checkout -b changeset-release
# Exit Pre-Release Mode
pnpm changeset pre exit# Bump version of a single package
pnpm changeset version \
--ignore pkg-1 \
--ignore pkg2
# Revert any changes in ignored packages
git checkout -- \
packages/pkg-1 \
packages/pkg-2
# Push the changes and create a PR
git add .
git commit -m "chore(release): changeset-release"
git push -u origin changeset-release
fi#### RELEASE ####if [ $1=="publish" ];then# Publish the package
pnpm changeset publish
# Go Back to Pre-Release Mode
pnpm changeset pre enter pre
# List all md files in .changeset folder and add them in .changeset/pre.json using jq
names=""forfilein .changeset/*.md;do
name="$(basename $file .md)"if [ $name=="README" ];thencontinuefi
names="$names\"$name\","done
names=${names%?}
newPre="$(jq '.changesets = [ '"$names"' ]' .changeset/pre.json)"printf'%s\n'"$newPre"> .changeset/pre.json
# Push the changes to the base branch
git add .changeset
git commit -m "chore(release): back to pre-release mode"
git push --follow-tags
fi
The text was updated successfully, but these errors were encountered:
Affected Packages
Problem
I was in pre-release mode and I needed to publish one package out of pre-release. This package has no dependency with others packages so I guessed it won't be that complicated...
changeset pre exit changeset version --ignore pkg1 --ignore pkg2 ...
No error so far
But I can see that all my packages have bumped in version and their changelog has changed too. Nothing seems to be ignored at all.
From what I understand, changesets files related to the ignored packages are still present in the
.changeset
folder. But the version bump still occurs and we have to deal with resetting any changes for these packages.Also, since we exited pre-release mode, I was expecting that the
changesets
array inside.changeset/pre.json
would still be populated with changesets related to ignored packages...But after the version bump, this file disappears, and when re-entering
pre
mode the new file contains an empty array.Here again, the only solution is to modify the
pre.json
file manually or by script.Proposed solution
pre
mode we should have the option to pre-populate the prechangesets
list with already present changeset files.pre.json
would still be correct.Current Workaround
This is my script to do the expected result for now:
The text was updated successfully, but these errors were encountered: