Skip to content

Instantly share code, notes, and snippets.

@fzed51
Last active August 21, 2023 07:13
Show Gist options
  • Save fzed51/587894f9c83b3ab1eaedbc585d4430f3 to your computer and use it in GitHub Desktop.
Save fzed51/587894f9c83b3ab1eaedbc585d4430f3 to your computer and use it in GitHub Desktop.
Gestion des versions de package dans un workspaces de yarn
  • ./package.json
{
  "private": true,
  "workspaces": {
    "packages": [
      "./packages/*"
    ]
  },
  "scripts": {
    "bump": "git diff-index --quiet HEAD -- && yarn version --no-commit-hooks --no-git-tag-version",
    "version": "yarn workspaces run bump-to $npm_package_version",
    "postversion": "git add --all && git commit -m \"v$npm_package_version\" && git tag \"v$npm_package_version\" -m \"Version $npm_package_version\" && git push && git push --tags"
  },
  "version": "1.0.0"
}
  • ./packages/*/package.json
{
  "name": "my-package",
  "version": "1.0.0",
  "scripts": {
    "bump-to": "yarn version --no-commit-hooks --no-git-tag-version --new-version"
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment