Skip to content

Commit 32a56ea

Browse files
committed
🐛 Fix comparison
1 parent ba44462 commit 32a56ea

File tree

1 file changed

+14
-22
lines changed

1 file changed

+14
-22
lines changed

scripts/check-deps.ts

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,24 @@ if (localVersion !== remoteVersion) {
2525
process.exit(1);
2626
}
2727

28-
execSync(`npm pack @huggingface/${dep}`);
28+
execSync(`npm pack`);
2929
execSync(`mv huggingface-${dep}-${localVersion}.tgz ${dep}-local.tgz`);
3030

3131
execSync(`npm pack @huggingface/${dep}@${remoteVersion}`);
3232
execSync(`mv huggingface-${dep}-${remoteVersion}.tgz ${dep}-remote.tgz`);
3333

34-
execSync(`tar -xf ${dep}-local.tgz`);
35-
const localChecksum = execSync(`cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1`)
36-
.toString()
37-
.trim();
38-
console.log(`Local package checksum: ${localChecksum}`);
39-
execSync(`rm -Rf package`);
40-
41-
execSync(`tar -xf ${dep}-remote.tgz`);
42-
const remoteChecksum = execSync(`cd package && tar --mtime='1970-01-01' --mode=755 -cf - . | sha256sum | cut -d' ' -f1`)
43-
.toString()
44-
.trim();
45-
console.log(`Remote package checksum: ${remoteChecksum}`);
46-
execSync(`rm -Rf package`);
47-
48-
if (localChecksum !== remoteChecksum) {
49-
console.error(
50-
`Checksum Verification Failed: The local @huggingface/${dep} package differs from the remote version. Release halted. Local Checksum: ${localChecksum}, Remote Checksum: ${remoteChecksum}`
51-
);
34+
execSync(`rm -Rf local && mkdir local && tar -xf ${dep}-local.tgz -C local`);
35+
execSync(`rm -Rf remote && mkdir remote && tar -xf ${dep}-remote.tgz -C remote`);
36+
37+
try {
38+
execSync("diff --brief -r local remote").toString();
39+
} catch (e) {
40+
console.error(e.output.filter(Boolean).join("\n"));
41+
console.error(`Error: The local and remote @huggingface/${dep} packages are inconsistent. Release halted.`);
5242
process.exit(1);
5343
}
54-
console.log(
55-
`Checksum Verification Successful: The local and remote @huggingface/${dep} packages are consistent. Local Checksum: ${localChecksum}, Remote Checksum: ${remoteChecksum}.`
56-
);
44+
45+
console.log(`The local and remote @huggingface/${dep} packages are consistent.`);
46+
47+
execSync(`rm -Rf local`);
48+
execSync(`rm -Rf remote`);

0 commit comments

Comments
 (0)