Main: Update build.mjs

This commit is contained in:
Amsyar Rasyiq 2023-02-13 22:57:32 +08:00 • committed by GitHub
parent d485611692
commit 489f7bf284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,12 @@ async function buildPlugin(plugin) {
return await rollup(options).then(async (bundle) => {
await bundle.write(options.output);
await bundle.close();
const toHash = readFileSync(outPath);
manifest.hash = createHash("sha256").update(toHash).digest("hex");
manifest.main = "index.js";
writeFileSync(`./dist/${plugin}/manifest.json`, JSON.stringify(manifest));
console.log(`${plugin}: ` + "\x1b[32m" + "Build succeed!" + "\x1b[0m");
});
}