diff --git a/build.mjs b/build.mjs index 320cdfe..70d1b4a 100644 --- a/build.mjs +++ b/build.mjs @@ -5,8 +5,12 @@ import { promisify } from "util"; import { exec as _exec } from "child_process"; import fs from "fs/promises"; import path from "path"; +import { argv } from "process"; const exec = promisify(_exec); +const hasArg = condition => argv.some(i => condition.test(i)); +const isDev = hasArg(/-d|--dev/); + const tsconfig = JSON.parse(await fs.readFile("./tsconfig.json")); const aliases = Object.fromEntries(Object.entries(tsconfig.compilerOptions.paths).map(([alias, [target]]) => [alias, path.resolve(target)])); const commit = (await exec("git rev-parse HEAD")).stdout.trim().substring(0, 7) || "custom"; @@ -15,7 +19,7 @@ try { await build({ entryPoints: ["./src/entry.ts"], outfile: "./dist/vendetta.js", - minify: true, + minify: !isDev, bundle: true, format: "iife", target: "esnext", @@ -44,7 +48,8 @@ try { alias(aliases), ], define: { - __vendettaVersion: `"${commit}"`, + __vendettaIsDev: `${isDev}`, + __vendettaVersion: `"${isDev ? commit : "local build"}"`, }, footer: { js: "//# sourceURL=Vendetta", @@ -52,7 +57,7 @@ try { legalComments: "none", }); - console.log("Build successful!"); + console.log("Build successful!", `isDev=${isDev}`); } catch (e) { console.error("Build failed...", e); process.exit(1); diff --git a/src/index.ts b/src/index.ts index e89163c..d32c177 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,6 @@ import initSettings from "@ui/settings"; import initFixes from "@lib/fixes"; import logger from "@lib/logger"; import windowObject from "@lib/windowObject"; -import settings from "./lib/settings"; export default async () => { // Load everything in parallel diff --git a/src/lib/themes.ts b/src/lib/themes.ts index 15d4003..5aeb0f8 100644 --- a/src/lib/themes.ts +++ b/src/lib/themes.ts @@ -4,7 +4,7 @@ import { findInReactTree, safeFetch } from "@lib/utils"; import { findByName, findByProps } from "@metro/filters"; import { instead, after } from "@lib/patcher"; import { createFileBackend, createMMKVBackend, createStorage, wrapSync, awaitSyncWrapper } from "@lib/storage"; -import logger from "./logger"; +import logger from "@lib/logger"; //! As of 173.10, early-finding this does not work. // Somehow, this is late enough, though? diff --git a/src/ui/components/Search.tsx b/src/ui/components/Search.tsx index 3862b71..cd25346 100644 --- a/src/ui/components/Search.tsx +++ b/src/ui/components/Search.tsx @@ -1,8 +1,8 @@ import { SearchProps } from "@types"; import { ReactNative as RN } from "@metro/common"; import { findByProps } from "@metro/filters"; -import ErrorBoundary from "./ErrorBoundary"; -import { getAssetIDByName } from "../assets"; +import ErrorBoundary from "@ui/components/ErrorBoundary"; +import { getAssetIDByName } from "@ui/assets"; const { FormIcon } = findByProps("FormIcon"); const { TextInput } = findByProps("TableRow"); diff --git a/src/ui/toasts.ts b/src/ui/toasts.ts index 8eb2771..72bf588 100644 --- a/src/ui/toasts.ts +++ b/src/ui/toasts.ts @@ -1,6 +1,6 @@ import { findByProps } from "@metro/filters"; import { ReactNative, toasts } from "@metro/common"; -import { getAssetIDByName } from "./assets"; +import { getAssetIDByName } from "@ui/assets"; const { uuid4 } = findByProps("uuid4");