Skip to content

Commit

Permalink
Add support for the changedFilePatterns config (#1033)
Browse files Browse the repository at this point in the history
* Add support for the `changedFilesPatterns` config

* fixed type errors

* fixed formatting

* add missing dev dep

* Rename the new config option to `changedFilePatterns`

* Add changesets
  • Loading branch information
Andarist committed Dec 18, 2022
1 parent b360d50 commit 521205d
Show file tree
Hide file tree
Showing 17 changed files with 657 additions and 205 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-schools-admire.md
@@ -0,0 +1,5 @@
---
"@changesets/config": minor
---

Support and validation for the new `changedFilePatterns` option has been added.
5 changes: 5 additions & 0 deletions .changeset/healthy-rats-chew.md
@@ -0,0 +1,5 @@
---
"@changesets/git": minor
---

`getChangedPackagesSinceRef` accepts now a new `changedFilePatterns` option. It can be used to determine which packages should be classified as changed. You can pass an array of glob patterns to it.
5 changes: 5 additions & 0 deletions .changeset/spicy-apes-visit.md
@@ -0,0 +1,5 @@
---
"@changesets/types": patch
---

Added `changedFilePatterns` property to `Config` and `WrittenConfig` types.
14 changes: 14 additions & 0 deletions .changeset/wicked-years-share.md
@@ -0,0 +1,14 @@
---
"@changesets/cli": minor
---

A new config-level `changedFilePatterns` option has been added. You can configure it with an array of glob patterns like here:

```json
// .changeset/config.json
{
"changedFilePatterns": ["src/**"]
}
```

Files that do not match the configured pattern won't contribute to the "changed" status of the package to which they belong. This both affects `changesets add` and `changeset status`.
18 changes: 18 additions & 0 deletions packages/apply-release-plan/src/index.test.ts
Expand Up @@ -47,6 +47,7 @@ class FakeReleasePlan {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "patch",
ignore: [],
Expand Down Expand Up @@ -89,6 +90,7 @@ async function testSetup(
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "patch",
ignore: [],
Expand Down Expand Up @@ -661,6 +663,7 @@ describe("apply release plan", () => {
linked: [],
access: "restricted",
baseBranch: "main",
changedFilePatterns: ["**"],
updateInternalDependencies: "patch",
privatePackages: { version: true, tag: false },
ignore: [],
Expand Down Expand Up @@ -736,6 +739,7 @@ describe("apply release plan", () => {
linked: [],
access: "restricted",
baseBranch: "main",
changedFilePatterns: ["**"],
updateInternalDependencies: "patch",
privatePackages: { version: true, tag: false },
ignore: [],
Expand Down Expand Up @@ -992,6 +996,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1107,6 +1112,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1207,6 +1213,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1306,6 +1313,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1408,6 +1416,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1523,6 +1532,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1631,6 +1641,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1730,6 +1741,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies,
ignore: [],
Expand Down Expand Up @@ -1830,6 +1842,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "patch",
ignore: [],
Expand Down Expand Up @@ -2058,6 +2071,7 @@ describe("apply release plan", () => {
linked: [],
access: "restricted",
baseBranch: "main",
changedFilePatterns: ["**"],
changelog: [
path.resolve(__dirname, "test-utils/simple-get-changelog-entry"),
null,
Expand Down Expand Up @@ -2198,6 +2212,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "patch",
ignore: [],
Expand Down Expand Up @@ -2306,6 +2321,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "minor",
ignore: [],
Expand Down Expand Up @@ -2426,6 +2442,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "minor",
ignore: [],
Expand Down Expand Up @@ -2560,6 +2577,7 @@ describe("apply release plan", () => {
fixed: [],
linked: [],
access: "restricted",
changedFilePatterns: ["**"],
baseBranch: "main",
updateInternalDependencies: "minor",
ignore: [],
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/add/index.ts
Expand Up @@ -42,6 +42,7 @@ export default async function add(
const changedPackages = await git.getChangedPackagesSinceRef({
cwd,
ref: config.baseBranch,
changedFilePatterns: config.changedFilePatterns,
});
const changedPackagesName = changedPackages
.filter((pkg) => isListablePackage(config, pkg.packageJson))
Expand Down

0 comments on commit 521205d

Please sign in to comment.