Skip to content

Commit aa2f111

Browse files
author
Shaw
committed
fix(release): resolve lerna.json from repo root, not packages/
The replace-workspace-versions.js script lives at packages/scripts/<file>, so workspaceRoot needed three dirnames up to reach the repo root where lerna.json lives. Previous two-dirname version resolved to packages/ and broke NPM Release with ENOENT for packages/lerna.json.
1 parent 01d2c07 commit aa2f111

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

packages/scripts/replace-workspace-versions.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ import { dirname, join } from "node:path";
2121
const DRY_RUN = process.argv.includes("--dry-run");
2222
const VERBOSE = process.argv.includes("--verbose") || DRY_RUN;
2323

24-
// Get the workspace root
25-
const workspaceRoot = dirname(dirname(new URL(import.meta.url).pathname));
24+
// Get the workspace root: this script lives at packages/scripts/<file>, so the
25+
// repo root is three dirnames up (file → scripts → packages → repo root).
26+
const workspaceRoot = dirname(
27+
dirname(dirname(new URL(import.meta.url).pathname)),
28+
);
2629

2730
// Read version from lerna.json
2831
function getVersion() {

0 commit comments

Comments
 (0)