File tree Expand file tree Collapse file tree
packages/cli/src/commands/init Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -33,9 +33,9 @@ describe("init", () => {
3333 true
3434 ) ;
3535 await initializeCommand ( cwd ) ;
36- expect ( await fs . readJson ( path . join ( cwd , ".changeset/config.json" ) ) ) . toEqual (
37- defaultWrittenConfig
38- ) ;
36+ expect (
37+ await fs . readJson ( path . join ( cwd , ".changeset/config.json" ) )
38+ ) . toEqual ( { ... defaultWrittenConfig , baseBranch : "main" } ) ;
3939 } ) ;
4040 it ( "shouldn't overwrite a config if it does exist" , async ( ) => {
4141 const cwd = await f . copy ( "simple-project" ) ;
Original file line number Diff line number Diff line change @@ -33,7 +33,9 @@ export default async function init(cwd: string) {
3333 }
3434 await fs . writeFile (
3535 path . resolve ( changesetBase , "config.json" ) ,
36- JSON . stringify ( defaultWrittenConfig , null , 2 )
36+ // modify base branch to "main" without changing defaultWrittenConfig since it also serves as a fallback
37+ // for config files that don't specify a base branch so changing that to main would be a breaking change
38+ JSON . stringify ( { ...defaultWrittenConfig , baseBranch : "main" } , null , 2 )
3739 ) ;
3840 } else {
3941 warn (
@@ -44,7 +46,7 @@ export default async function init(cwd: string) {
4446 await fs . copy ( path . resolve ( pkgPath , "./default-files" ) , changesetBase ) ;
4547 await fs . writeFile (
4648 path . resolve ( changesetBase , "config.json" ) ,
47- JSON . stringify ( defaultWrittenConfig , null , 2 )
49+ JSON . stringify ( { ... defaultWrittenConfig , baseBranch : "main" } , null , 2 )
4850 ) ;
4951
5052 log (
You can’t perform that action at this time.
0 commit comments