@@ -45,7 +45,15 @@ function currentGitBranch() {
4545 * @returns {Promise<void> }
4646 */
4747export const publish = async ( options ) => {
48- const { branchConfigs, packages, rootDir, branch, tag, ghToken } = options
48+ const {
49+ branchConfigs,
50+ packages,
51+ rootDir,
52+ branch,
53+ tag,
54+ ghToken,
55+ releaseTogether = false ,
56+ } = options
4957
5058 const branchName = /** @type {string } */ ( branch ?? currentGitBranch ( ) )
5159 const isMainBranch = branchName === 'main'
@@ -250,16 +258,22 @@ export const publish = async (options) => {
250258 . filter ( Boolean )
251259
252260 /** Uses packages and changedFiles to determine which packages have changed */
253- const changedPackages = RELEASE_ALL
254- ? packages
255- : packages . filter ( ( pkg ) => {
256- const changed = changedFiles . some (
257- ( file ) =>
258- file . startsWith ( path . join ( pkg . packageDir , 'src' ) ) ||
259- file . startsWith ( path . join ( pkg . packageDir , 'package.json' ) ) ,
260- )
261- return changed
262- } )
261+ const packagesWithChanges = packages . filter ( ( pkg ) => {
262+ const changed = changedFiles . some (
263+ ( file ) =>
264+ file . startsWith ( path . join ( pkg . packageDir , 'src' ) ) ||
265+ file . startsWith ( path . join ( pkg . packageDir , 'package.json' ) ) ,
266+ )
267+ return changed
268+ } )
269+
270+ // If RELEASE_ALL is set, release all packages
271+ // If releaseTogether is set, release all packages if any package has changed
272+ // Otherwise, only release packages that have changed
273+ const changedPackages =
274+ RELEASE_ALL || ( releaseTogether && packagesWithChanges . length > 0 )
275+ ? packages
276+ : packagesWithChanges
263277
264278 // If a package has a dependency that has been updated, we need to update the
265279 // package that depends on it as well.
0 commit comments