Skip to content

Commit b83787f

Browse files
authored
Change defaultWrittenConfig's baseBranch to main (#1650)
1 parent 771dc07 commit b83787f

6 files changed

Lines changed: 12 additions & 13 deletions

File tree

.changeset/plenty-forks-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@changesets/config": major
3+
---
4+
5+
Change the `defaultWrittenConfig` `baseBranch` value from `"master"` to `"main"`

packages/cli/src/commands/init/__tests__/command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ describe("init", () => {
3939
JSON.parse(
4040
await fs.readFile(path.join(cwd, ".changeset/config.json"), "utf8")
4141
)
42-
).toEqual({ ...defaultWrittenConfig, baseBranch: "main" });
42+
).toEqual(defaultWrittenConfig);
4343
});
4444
it("should add newline at the end of config", async () => {
4545
const cwd = await testdir({

packages/cli/src/commands/init/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ async function pathExists(p: string) {
1717

1818
const pkgPath = path.dirname(require.resolve("@changesets/cli/package.json"));
1919

20-
// Modify base branch to "main" without changing defaultWrittenConfig since it also serves as a fallback
21-
// for config files that don't specify a base branch. Changing that to main would be a breaking change.
22-
const defaultConfig = `${JSON.stringify(
23-
{ ...defaultWrittenConfig, baseBranch: "main" },
24-
null,
25-
2
26-
)}\n`;
20+
const defaultConfig = `${JSON.stringify(defaultWrittenConfig, null, 2)}\n`;
2721

2822
export default async function init(cwd: string) {
2923
const changesetBase = path.resolve(cwd, ".changeset");

packages/config/schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
},
103103
"baseBranch": {
104104
"type": "string",
105-
"default": "master",
105+
"default": "main",
106106
"description": "Determines the branch that Changesets uses when finding what packages have changed."
107107
},
108108
"changedFilePatterns": {

packages/config/src/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ test("read reads the config", async () => {
4545
changelog: false,
4646
commit: ["@changesets/cli/commit", { skipCI: "version" }],
4747
access: "restricted",
48-
baseBranch: "master",
48+
baseBranch: "main",
4949
changedFilePatterns: ["**"],
5050
updateInternalDependencies: "patch",
5151
ignore: [],
@@ -85,7 +85,7 @@ test("read can read config based on the passed in `cwd`", async () => {
8585
changelog: false,
8686
commit: ["@changesets/cli/commit", { skipCI: "version" }],
8787
access: "restricted",
88-
baseBranch: "master",
88+
baseBranch: "main",
8989
changedFilePatterns: ["**"],
9090
updateInternalDependencies: "patch",
9191
ignore: [],
@@ -144,7 +144,7 @@ let defaults: Config = {
144144
changelog: ["@changesets/cli/changelog", null],
145145
commit: false,
146146
access: "restricted",
147-
baseBranch: "master",
147+
baseBranch: "main",
148148
changedFilePatterns: ["**"],
149149
updateInternalDependencies: "patch",
150150
ignore: [],

packages/config/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export let defaultWrittenConfig = {
2525
fixed: [] as Fixed,
2626
linked: [] as Linked,
2727
access: "restricted",
28-
baseBranch: "master",
28+
baseBranch: "main",
2929
updateInternalDependencies: "patch",
3030
ignore: [] as ReadonlyArray<string>,
3131
} as const;

0 commit comments

Comments
 (0)