Skip to content

Commit

Permalink
Add prepublish hook to unpin deps only for published version
Browse files Browse the repository at this point in the history
  • Loading branch information
ecraig12345 committed Sep 11, 2024
1 parent df63c15 commit 3a7fd14
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion beachball.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @ts-check
/** @type {import('beachball').BeachballConfig}*/
module.exports = {
const config = {
groupChanges: true,
access: "public",
ignorePatterns: [
Expand All @@ -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;

0 comments on commit 3a7fd14

Please sign in to comment.