Skip to content

Instantly share code, notes, and snippets.

@mikedotexe
Created October 17, 2024 08:05
Show Gist options
  • Save mikedotexe/2234aad04a5f66811c32b7c4b2732896 to your computer and use it in GitHub Desktop.
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)
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