Skip to content

Commit

Permalink
fix: support workspace:* yarn protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Feb 3, 2024
1 parent c1269dd commit 4812cbc
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/monorepo/src/utils/packages/writePackages.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const noop = (p) => p;
* @returns {Promise<void[]>}
*/
export async function writePackages(context) {
const {outputDir, silent, ignore = [], pkgMapper = noop, branchName} = context;
const {outputDir, silent, ignore = [], pkgMapper = noop, branchName, rootPkg} = context;
let {npmDistTag} = context;

if (["alpha", "beta", "rc"].includes(branchName)) {
Expand All @@ -38,6 +38,18 @@ export async function writePackages(context) {
pkg.typings = "lib/index.d.ts";
}

Object.entries(pkg.dependencies || {}).forEach(([name, version]) => {
if (version.startsWith("workspace:")) {
pkg.dependencies[name] = version.replace("workspace:*", rootPkg.version);
}
});

Object.entries(pkg.devDependencies || {}).forEach(([name, version]) => {
if (version.startsWith("workspace:")) {
pkg.devDependencies[name] = version.replace("workspace:*", rootPkg.version);
}
});

return writePackage(join(outputDir, name, "package.json"), pkg);
});

Expand Down

0 comments on commit 4812cbc

Please sign in to comment.