fix(npm): stop rejecting INSTALL-INTEL-MAC.md in the release tarball

The x86_64-apple-darwin release tarball packages INSTALL-INTEL-MAC.md
(release.yml), but postinstall's strict archive-member check only accepted
the three binaries — so npm install hard-failed on every Intel Mac with
'Unexpected archive entry'. Known-optional docs are now accepted; genuinely
unknown entries are still rejected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Sam Valladares 2026-07-25 21:58:03 +08:00
parent 89b0b35665
commit e95ab05d4a

View file

@ -60,6 +60,9 @@ const checksumPath = path.join(targetDir, `${archiveName}.sha256`);
const expectedArchiveMembers = new Set(
['vestige-mcp', 'vestige', 'vestige-restore'].map((name) => (isWindows ? `${name}.exe` : name))
);
// Docs that some release archives legitimately include alongside the binaries
// (e.g. the x86_64-apple-darwin tarball ships INSTALL-INTEL-MAC.md).
const optionalArchiveMembers = new Set(['INSTALL-INTEL-MAC.md']);
function isWorkspaceCheckout() {
const packageRoot = path.resolve(__dirname, '..');
@ -183,7 +186,7 @@ function validateArchiveEntries(archivePath) {
for (const entry of entries) {
const normalized = normalizeArchiveEntry(entry);
if (!expectedArchiveMembers.has(normalized)) {
if (!expectedArchiveMembers.has(normalized) && !optionalArchiveMembers.has(normalized)) {
throw new Error(`Unexpected archive entry: ${entry}`);
}
}