ethers.js/misc/admin/src.ts/cmds/update-hashes.ts

28 lines
810 B
TypeScript
Raw Normal View History

2020-09-23 08:00:30 +03:00
//import { getGitTag } from "../git";
import { computeTarballHash, updateJson } from "../local";
import { colorify, getProgressBar } from "../log";
2020-09-23 08:00:30 +03:00
import { dirnames, getPackageJsonPath } from "../path";
(async function() {
const progress = getProgressBar(colorify.bold("Updating package.json hashes"));
// Updating all tarball hashes now that versions have been updated
for (let i = 0; i < dirnames.length; i++) {
progress(i / dirnames.length);
2020-09-23 05:54:48 +03:00
const dirname = dirnames[i];
2020-09-23 05:54:48 +03:00
2020-09-23 08:00:30 +03:00
//const gitHead = await getGitTag(resolve("packages", dirname));
const tarballHash = computeTarballHash(dirname);
2020-09-23 05:54:48 +03:00
2020-09-23 08:00:30 +03:00
updateJson(getPackageJsonPath(dirname), { tarballHash }, true);
}
progress(1);
2020-09-23 05:54:48 +03:00
})().catch((error) => {
console.log(error);
process.exit(1);
});;