-
Notifications
You must be signed in to change notification settings - Fork 569
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
Add support for the changedFilePatterns
config
#1033
Conversation
🦋 Changeset detectedLatest commit: 1d229e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 1d229e0:
|
packages/config/schema.json
Outdated
"changedFilesPatterns": { | ||
"type": "array", | ||
"items": { | ||
"type": "string" | ||
}, | ||
"default": ["**"], | ||
"description": "Glob patterns for changed files that should determining the package as changed." | ||
}, |
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.
I went with an array because it's much easier to write a couple of small globs than one big one - especially if some negated pattern is involved.
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.
perhaps this should be named changedFilePatterns
? WDYT?
}: { | ||
cwd: string; | ||
ref: string; | ||
}) { | ||
changedFilesPatterns?: readonly string[]; | ||
}): Promise<Package[]> { |
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 core of the change is really in this method. I also rewrote this looping to be more efficient.
@@ -102,3 +103,33 @@ export async function testdir(dir: Fixture) { | |||
} | |||
|
|||
export const tempdir = f.temp; | |||
|
|||
export async function gitdir(dir: Fixture) { |
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.
Extracted this here to reuse in the refactored tests for changeset status
changedFilesPatterns
configchangedFilePatterns
config
This PR introduces a new config option:
changedFilesPatterns
.At first, I thought about introducing this just as a CLI argument for
changeset status
. However, I realized thatchangeset add
should also use this to split packages between changed and not changed in the prompt. That's why I went with the config option approach.The main purpose of this new feature is to have a way to optionally validate PRs that changesets are added for changed packages but without requiring changesets to be added for test file changes, docs changes etc.