Release v0.75.5

This commit is contained in:
Mario Zechner
2026-05-23 11:58:31 +02:00
parent 98477f2ee7
commit ea2b70ddd9
18 changed files with 88 additions and 62 deletions

View File

@@ -30,30 +30,50 @@ function packageLabel(lockPath, entry) {
return entry?.version ? `${name}@${entry.version}` : name;
}
function summarizeLockfileChange() {
function getLockfilePackageChanges() {
const before = readJsonFromGit("HEAD:package-lock.json");
const after = readJsonFromGit(":package-lock.json");
if (!before?.packages || !after?.packages) return [];
if (!before?.packages || !after?.packages) return undefined;
const changes = [];
const paths = new Set([...Object.keys(before.packages), ...Object.keys(after.packages)]);
for (const lockPath of [...paths].sort()) {
if (!lockPath.includes("node_modules/")) continue;
const oldEntry = before.packages[lockPath];
const newEntry = after.packages[lockPath];
if (!oldEntry && newEntry) {
changes.push(`added ${packageLabel(lockPath, newEntry)}`);
} else if (oldEntry && !newEntry) {
changes.push(`removed ${packageLabel(lockPath, oldEntry)}`);
} else if (oldEntry?.version !== newEntry?.version) {
changes.push(
`changed ${packageNameFromLockPath(lockPath)} ${oldEntry?.version ?? "<none>"} -> ${newEntry?.version ?? "<none>"}`,
);
if (JSON.stringify(oldEntry) !== JSON.stringify(newEntry)) {
changes.push({ lockPath, oldEntry, newEntry });
}
}
return changes;
}
function isWorkspacePackagePath(lockPath) {
return lockPath.startsWith("packages/");
}
function hasOnlyWorkspacePackageChanges(changes) {
return changes.length > 0 && changes.every((change) => isWorkspacePackagePath(change.lockPath));
}
function summarizeLockfileChange(changes) {
const nodeModuleChanges = changes.filter((change) => change.lockPath.includes("node_modules/"));
const summary = [];
for (const { lockPath, oldEntry, newEntry } of nodeModuleChanges) {
if (!oldEntry && newEntry) {
summary.push(`added ${packageLabel(lockPath, newEntry)}`);
} else if (oldEntry && !newEntry) {
summary.push(`removed ${packageLabel(lockPath, oldEntry)}`);
} else if (oldEntry?.version !== newEntry?.version) {
summary.push(
`changed ${packageNameFromLockPath(lockPath)} ${oldEntry?.version ?? "<none>"} -> ${newEntry?.version ?? "<none>"}`,
);
} else {
summary.push(`changed ${packageLabel(lockPath, newEntry)}`);
}
}
return summary;
}
const stagedFiles = git(["diff", "--cached", "--name-only"])
.split("\n")
.map((line) => line.trim())
@@ -68,6 +88,12 @@ if (allowed) {
process.exit(0);
}
const changes = getLockfilePackageChanges();
if (changes && hasOnlyWorkspacePackageChanges(changes)) {
console.error("package-lock.json only updates workspace package metadata; allowing commit.");
process.exit(0);
}
console.error("package-lock.json is staged.");
console.error("");
console.error("Review lockfile changes before committing:");
@@ -76,15 +102,15 @@ console.error(" - confirm npm age gates were active for resolution");
console.error(" - review any new lifecycle scripts in the dependency tree");
console.error(" - regenerate/check coding-agent shrinkwrap if release deps changed");
const changes = summarizeLockfileChange();
if (changes.length > 0) {
const summary = changes ? summarizeLockfileChange(changes) : [];
if (summary.length > 0) {
console.error("");
console.error("Detected package version changes:");
for (const change of changes.slice(0, 40)) {
for (const change of summary.slice(0, 40)) {
console.error(` - ${change}`);
}
if (changes.length > 40) {
console.error(` ... ${changes.length - 40} more`);
if (summary.length > 40) {
console.error(` ... ${summary.length - 40} more`);
}
}