Release v0.81.0
This commit is contained in:
+44
-8
@@ -68,6 +68,36 @@ function shellQuote(value) {
|
||||
return `'${value.replace(/'/g, `'\\''`)}'`;
|
||||
}
|
||||
|
||||
function removeStaleWorkspaceLockEntries() {
|
||||
const workspaceVersions = new Map(
|
||||
findPackageDirectories()
|
||||
.map((directory) => JSON.parse(readFileSync(join(directory, "package.json"), "utf8")))
|
||||
.filter((pkg) => pkg.private !== true)
|
||||
.map((pkg) => [pkg.name, pkg.version]),
|
||||
);
|
||||
const lockPath = "package-lock.json";
|
||||
const lock = JSON.parse(readFileSync(lockPath, "utf8"));
|
||||
let removed = 0;
|
||||
|
||||
for (const [path, pkg] of Object.entries(lock.packages)) {
|
||||
if (!path.startsWith("packages/") || pkg.link === true) {
|
||||
continue;
|
||||
}
|
||||
for (const [name, version] of workspaceVersions) {
|
||||
if (path.endsWith(`/node_modules/${name}`) && pkg.version !== version) {
|
||||
delete lock.packages[path];
|
||||
removed++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (removed > 0) {
|
||||
writeFileSync(lockPath, `${JSON.stringify(lock, null, "\t")}\n`);
|
||||
console.log(`Removed ${removed} stale workspace package lock ${removed === 1 ? "entry" : "entries"}.`);
|
||||
}
|
||||
}
|
||||
|
||||
function stageChangedFiles() {
|
||||
const output = run("git ls-files -m -o -d --exclude-standard", { silent: true });
|
||||
const paths = [...new Set((output || "").split("\n").map((line) => line.trim()).filter(Boolean))];
|
||||
@@ -84,16 +114,22 @@ function bumpOrSetVersion(target) {
|
||||
if (BUMP_TYPES.has(target)) {
|
||||
console.log(`Bumping version (${target})...`);
|
||||
run(`npm run version:${target}`);
|
||||
return getVersion();
|
||||
} else {
|
||||
if (compareVersions(target, currentVersion) <= 0) {
|
||||
console.error(`Error: explicit version ${target} must be greater than current version ${currentVersion}.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`Setting explicit version (${target})...`);
|
||||
run(`npm version ${target} -ws --no-git-tag-version && node scripts/sync-versions.js && npm install --package-lock-only --ignore-scripts`);
|
||||
}
|
||||
|
||||
if (compareVersions(target, currentVersion) <= 0) {
|
||||
console.error(`Error: explicit version ${target} must be greater than current version ${currentVersion}.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`Setting explicit version (${target})...`);
|
||||
run(`npm version ${target} -ws --no-git-tag-version && node scripts/sync-versions.js && npm install --package-lock-only --ignore-scripts`);
|
||||
// npm version can temporarily install the previous workspace versions before
|
||||
// sync-versions updates inter-package ranges. Remove those stale lock entries,
|
||||
// refresh the lockfile, then hydrate from the final dependency graph.
|
||||
removeStaleWorkspaceLockEntries();
|
||||
run("npm install --package-lock-only --ignore-scripts");
|
||||
run("npm ci --ignore-scripts");
|
||||
return getVersion();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user