change author to pylix & fix stupit

This commit is contained in:
amsyarasyiq 2023-04-05 16:35:45 +08:00
parent c7f43e403d
commit 6774230513
2 changed files with 5 additions and 3 deletions

View file

@ -1,7 +1,7 @@
{ {
"authors": [ "authors": [
{ {
"name": "amsyarasyiq", "name": "pylix",
"id": "492949202121261067" "id": "492949202121261067"
} }
], ],

View file

@ -60,7 +60,7 @@ async function buildPlugin(plugin) {
const map = { const map = {
"react": "window.React", "react": "window.React",
"react-native": "globalThis.vendetta.metro.common.ReactNative" "react-native": "vendetta.metro.common.ReactNative"
}; };
return map[id] || null; return map[id] || null;
@ -107,7 +107,7 @@ async function buildPlugin(plugin) {
] ]
}; };
Object.assign(manifest, { const applyHash = async () => Object.assign(manifest, {
hash: createHash("sha256").update(await readFile(outPath)).digest("hex"), hash: createHash("sha256").update(await readFile(outPath)).digest("hex"),
main: entry main: entry
}); });
@ -117,6 +117,7 @@ async function buildPlugin(plugin) {
await bundle.write(options.output); await bundle.write(options.output);
await bundle.close(); await bundle.close();
await applyHash();
await writeFile(`./dist/${plugin}/manifest.json`, JSON.stringify(manifest)); await writeFile(`./dist/${plugin}/manifest.json`, JSON.stringify(manifest));
console.log(`${plugin}: ` + "\x1b[32m" + "Build succeed!" + "\x1b[0m"); console.log(`${plugin}: ` + "\x1b[32m" + "Build succeed!" + "\x1b[0m");
@ -131,6 +132,7 @@ async function buildPlugin(plugin) {
case "BUNDLE_END": { case "BUNDLE_END": {
event.result.close(); event.result.close();
await applyHash();
await writeFile(`./dist/${plugin}/manifest.json`, JSON.stringify(manifest)); await writeFile(`./dist/${plugin}/manifest.json`, JSON.stringify(manifest));
console.log(`${plugin}: ` + "\x1b[32m" + `Build succeed! (${event.duration}ms)` + "\x1b[0m"); console.log(`${plugin}: ` + "\x1b[32m" + `Build succeed! (${event.duration}ms)` + "\x1b[0m");