-
Notifications
You must be signed in to change notification settings - Fork 537
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
Dont't include ignored packages when adding a changeset #744
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2b10211
Dont't include ignored packages when adding a changeset
4791c19
Add test
4c5ecc8
Merge branch 'main' into ignored-packages
mskelton 7f87916
Merge branch 'main' into ignored-packages
mskelton 0dd1c10
Merge branch 'main' into ignored-packages
mskelton 4da1ec8
Merge branch 'main' into ignored-packages
mskelton 1a81331
Merge branch 'main' into ignored-packages
mskelton 9dc2545
Merge branch 'main' into ignored-packages
emmatown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@changesets/cli": patch | ||
--- | ||
|
||
Ignored packages are no longer listed when adding a changeset. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,9 @@ export default async function add( | |
{ empty, open }: { empty?: boolean; open?: boolean }, | ||
config: Config | ||
) { | ||
const packages = await getPackages(cwd); | ||
const packages = (await getPackages(cwd)).packages.filter( | ||
pkg => !config.ignore.includes(pkg.packageJson.name) | ||
); | ||
const changesetBase = path.resolve(cwd, ".changeset"); | ||
|
||
let newChangeset: UnwrapPromise<ReturnType<typeof createChangeset>>; | ||
|
@@ -38,10 +40,11 @@ export default async function add( | |
ref: config.baseBranch | ||
}); | ||
const changePackagesName = changedPackages | ||
.filter(a => a) | ||
.map(pkg => pkg.packageJson.name); | ||
newChangeset = await createChangeset(changePackagesName, packages.packages); | ||
printConfirmationMessage(newChangeset, packages.packages.length > 1); | ||
.map(pkg => pkg.packageJson.name) | ||
.filter(pkgName => config.ignore.includes(pkgName)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a missing |
||
|
||
newChangeset = await createChangeset(changePackagesName, packages); | ||
printConfirmationMessage(newChangeset, packages.length > 1); | ||
|
||
if (!newChangeset.confirmed) { | ||
newChangeset = { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like the filtered result should be used used for
createChangeset
call but not for theprintConfirmationMessage
. WDYT?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure. I see what you are getting at that it could mess up the resulting value of
repoHasMultiplePackages
, but if a repo has two packages but one is ignored, should we consider the repo as having one or multiple packages? That's where I'm a bit unsure of what you would prefer to happen.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The message added when
repoHasMultiplePackages
is true is about bumping dependents which if there is only one non-ignored package is irrelevant so I'd say the behavior in this PR is correct.