Skip to content

Commit 33ccc88

Browse files
committed
Fix require caching issue
1 parent 7816118 commit 33ccc88

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

scripts/manual-publish.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// throws an exception if process.env.oldv === process.env.v The library version is not up to date, error(" Not able to release to the same version.
99

1010
const { execSync } = require("child_process");
11+
const fs = require("fs");
12+
const path = require("path");
1113

1214
const BRANCH = process.env.BRANCH;
1315
const DEFAULT_BRANCH = process.env.DEFAULT_BRANCH;
@@ -27,13 +29,17 @@ if (!isLatestRelease) {
2729
}
2830
/** Apply changeset */
2931
execSync("pnpm changeset version");
30-
const NEW_VERSION = require("../lib/package.json").version;
3132

3233
// exit pre mode -- to avoid collision with full releases
3334
try {
3435
execSync("pnpm changeset pre exit");
3536
} catch {}
3637

38+
/** not requiring as require is cached by npm/node */
39+
const NEW_VERSION = JSON.parse(
40+
fs.readFileSync(path.resolve(__dirname, "..", "lib", "package.json")),
41+
).version;
42+
3743
const [newMajor, newMinor] = NEW_VERSION.split(".");
3844
const [oldMajor, oldMinor] = OLD_VERSION.split(".");
3945

0 commit comments

Comments
 (0)