diff --git a/build.mjs b/build.mjs index a6b657d..562ff0a 100644 --- a/build.mjs +++ b/build.mjs @@ -55,7 +55,7 @@ for (const plug of plugin ? [plugin] : readdirSync("./plugins")) { ] }; - const watchPlugin = new Promise((resolve, reject) => { + const watchPlugin = new Promise((resolve) => { const watcher = watch(config); watcher.on("event", (event) => { switch (event.code) { @@ -63,22 +63,21 @@ for (const plug of plugin ? [plugin] : readdirSync("./plugins")) { process.stdout.write(`Building ${plug}... `); break; case "BUNDLE_END": { - console.log("\x1b[32m", `Succeed! (${event.duration}ms)`, "\x1b[0m"); const toHash = readFileSync(outPath); manifest.hash = createHash("sha256").update(toHash).digest("hex"); manifest.main = "index.js"; writeFileSync(`./dist/${plug}/manifest.json`, JSON.stringify(manifest)); + process.stdout.write("\x1b[32m" + `Succeed! (${event.duration}ms)` + "\x1b[0m"); + + console.log(); resolve(); break; } case "ERROR": console.error("\x1b[31m", "Failed! :(", "\x1b[0m"); - console.error(event.error); - reject(event.error); - break; + throw event.error; case "FATAL": - reject(event.error); process.exit(1); } }); diff --git a/plugins/Last.fm/src/constants.ts b/plugins/Last.fm/src/constants.ts index 7c7ba35..77f9477 100644 --- a/plugins/Last.fm/src/constants.ts +++ b/plugins/Last.fm/src/constants.ts @@ -1,5 +1,6 @@ const Constants = { DEFAULT_APP_NAME: "Music", + DEFAULT_TIME_INTERVAL: 5, /** The application ID of the plugin */ APPLICATION_ID: "1054951789318909972", /** Last.fm api key */ diff --git a/plugins/Last.fm/src/utils.ts b/plugins/Last.fm/src/utils.ts index 01762fe..5db1827 100644 --- a/plugins/Last.fm/src/utils.ts +++ b/plugins/Last.fm/src/utils.ts @@ -185,7 +185,7 @@ export async function initialize() { global.stopped = true; } }), - currentSettings.timeInterval + (currentSettings.timeInterval || Constants.DEFAULT_TIME_INTERVAL) * 1000 ); }