Created
October 17, 2024 08:05
-
-
Save mikedotexe/2234aad04a5f66811c32b7c4b2732896 to your computer and use it in GitHub Desktop.
Yarn 4.5.0 constraint (`yarn set version berry` has to be run)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
async constraints({ Yarn }) { | |
// get the root-level package.json's version | |
// then update all the packages' versions | |
/* The line below returns something like | |
{ | |
cwd: '.', | |
ident: '@meer-js/monorepo', | |
manifest: { | |
version: '6.6.7' | |
… | |
*/ | |
const projectRootMonorepo = Yarn.workspace() | |
const rootVersion = projectRootMonorepo.manifest.version | |
// run through and update workspace package versions | |
for (const workspace of Yarn.workspaces()) { | |
// could skip the root package but who cares i guess | |
workspace.set('version', rootVersion) | |
} | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment