From 3a7fd142152533496dc660fc2635917259a6cb53 Mon Sep 17 00:00:00 2001 From: Elizabeth Craig Date: Wed, 11 Sep 2024 15:30:03 -0700 Subject: [PATCH] Add prepublish hook to unpin deps only for published version --- beachball.config.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/beachball.config.js b/beachball.config.js index a07d8964b..359a92f7e 100644 --- a/beachball.config.js +++ b/beachball.config.js @@ -1,6 +1,6 @@ // @ts-check /** @type {import('beachball').BeachballConfig}*/ -module.exports = { +const config = { groupChanges: true, access: "public", ignorePatterns: [ @@ -16,4 +16,19 @@ module.exports = { // This one is especially important (otherwise dependabot would be blocked by change file requirements) "yarn.lock", ], + hooks: { + prepublish: (packagePath, name, version, packageInfos) => { + const { packageJsonPath } = packageInfos[name]; + const packageJson = require(packageJsonPath); + for (const [dep, version] of Object.entries(packageJson.dependencies || {})) { + // If the dep is a specific version, unpin before publishing. + // See the comment towards the end of renovate.json5 for why the deps are pinned to start out. + if (/^\d/.test(version)) { + packageJson.dependencies[dep] = `^${version}`; + } + } + }, + }, }; + +module.exports = config;