refactor import
This commit is contained in:
parent
84abb4c9a7
commit
a6435ea376
5 changed files with 12 additions and 8 deletions
11
build.mjs
11
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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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?
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue