ethers.js/misc/admin/src.ts/cmds/update-hashes.ts
2020-09-22 23:18:45 -04:00

28 lines
824 B
TypeScript

import { getGitTag } from "../git";
import { computeTarballHash, updateJson } from "../local";
import { colorify, getProgressBar } from "../log";
import { dirnames, getPackageJsonPath, resolve } 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);
const dirname = dirnames[i];
const gitHead = await getGitTag(resolve("packages", dirname));
const tarballHash = computeTarballHash(dirname);
updateJson(getPackageJsonPath(dirname), { gitHead, tarballHash }, true);
}
progress(1);
})().catch((error) => {
console.log(error);
process.exit(1);
});;