From 50755b23061884599deffb4337ee088023fe3df2 Mon Sep 17 00:00:00 2001 From: Beef Date: Wed, 5 Apr 2023 20:54:14 +0100 Subject: [PATCH] [Init] Rework entrypoint file --- build.mjs | 2 +- entry.js | 17 ----------------- src/entry.ts | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 entry.js create mode 100644 src/entry.ts diff --git a/build.mjs b/build.mjs index 912fd20..320cdfe 100644 --- a/build.mjs +++ b/build.mjs @@ -13,7 +13,7 @@ const commit = (await exec("git rev-parse HEAD")).stdout.trim().substring(0, 7) try { await build({ - entryPoints: ["./entry.js"], + entryPoints: ["./src/entry.ts"], outfile: "./dist/vendetta.js", minify: true, bundle: true, diff --git a/entry.js b/entry.js deleted file mode 100644 index 8a530e0..0000000 --- a/entry.js +++ /dev/null @@ -1,17 +0,0 @@ -// This logs in the native logging implementation, e.g. logcat -console.log("Hello from Vendetta!"); - -(async () => { - try { - await (await import("./src/index.ts")).default(); - } catch (ex) { - console.log(ex?.stack ?? ex.toString()); - const dialog = [ - "Failed to load Vendetta!\n", - `Build Number: ${(nativeModuleProxy.InfoDictionaryManager ?? nativeModuleProxy.RTNClientInfoManager).Build}`, - `Vendetta: ${__vendettaVersion}`, - ex?.stack || ex.toString(), - ].join("\n"); - alert(dialog); - } -})(); diff --git a/src/entry.ts b/src/entry.ts new file mode 100644 index 0000000..8568401 --- /dev/null +++ b/src/entry.ts @@ -0,0 +1,15 @@ +import { ClientInfoManager } from "@lib/native"; + +// This logs in the native logging implementation, e.g. logcat +console.log("Hello from Vendetta!"); + +(async () => (await import(".")).default().catch(e => { + console.log(e?.stack ?? e.toString()); + alert([ + "Failed to load Vendetta!\n", + `Build Number: ${ClientInfoManager.Build}`, + // @ts-expect-error, replaced in build script + `Vendetta: ${__vendettaVersion}`, + e?.stack || e.toString(), + ].join("\n")); +}))();