File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ const HEADER = `# Changelog\n\nAll notable changes to this project will be docum
3838const execPromise = ( command ) => new Promise ( ( r ) => exec ( command , ( e , out ) => ( e && r ( e ) ) || r ( out ) ) )
3939
4040const packageFile = JSON . parse ( await readFile ( './package.json' , { encoding : 'utf-8' } ) )
41+ const isMonoRepo = ! ! packageFile . workspaces
4142
4243if ( ! packageFile . homepage ) {
4344 console . error ( 'No repository homepage specified in the package.json, exiting...' )
@@ -159,14 +160,23 @@ if (!cli.flags.dryRun) {
159160
160161 // update the package.json
161162 if ( existsSync ( '.yarn' ) ) {
162- // yarn 3 needs a different command
163- await execPromise ( 'yarn version ' + nextVersion )
163+ if ( isMonoRepo ) {
164+ // Update all workspaces
165+ await execPromise ( 'yarn workspaces foreach --all version -d ' + nextVersion )
166+ await execPromise ( 'yarn version apply --all' )
167+ } else {
168+ // yarn 3 needs a different command
169+ await execPromise ( 'yarn version ' + nextVersion )
170+ }
164171 } else {
165172 await execPromise ( 'yarn version --no-git-tag-version --new-version ' + nextVersion )
166173 }
167174
168175 // git commit
169176 await execPromise ( `git add package.json yarn.lock CHANGELOG.md` )
177+ if ( isMonoRepo ) {
178+ await execPromise ( `git add */package.json` )
179+ }
170180
171181 await execPromise ( `git commit -m "chore(release): v${ nextVersion } "` )
172182
You can’t perform that action at this time.
0 commit comments