From f84fa74171d81e6cb7e482e253c5ab995100c035 Mon Sep 17 00:00:00 2001 From: aiek Date: Fri, 26 Jul 2024 19:07:26 +0300 Subject: [PATCH] Delete 'build/build.mts' --- build/build.mts | 98 ------------------------------------------------- 1 file changed, 98 deletions(-) delete mode 100644 build/build.mts diff --git a/build/build.mts b/build/build.mts deleted file mode 100644 index 8f4e445..0000000 --- a/build/build.mts +++ /dev/null @@ -1,98 +0,0 @@ -/* - * SPDX-License-Identifier: GPL-3.0 - * Vesktop, a desktop app aiming to give you a snappier Discord Experience - * Copyright (c) 2023 Vendicated and Vencord contributors - */ - -import { BuildContext, BuildOptions, context } from "esbuild"; -import { copyFile } from "fs/promises"; - -import vencordDep from "./vencordDep.mjs"; - -const isDev = process.argv.includes("--dev"); - -const CommonOpts: BuildOptions = { - minify: !isDev, - bundle: true, - sourcemap: "linked", - logLevel: "info" -}; - -const NodeCommonOpts: BuildOptions = { - ...CommonOpts, - format: "cjs", - platform: "node", - external: ["electron"], - target: ["esnext"], - define: { - IS_DEV: JSON.stringify(isDev) - } -}; - -const contexts = [] as BuildContext[]; -async function createContext(options: BuildOptions) { - contexts.push(await context(options)); -} - -async function copyVenmic() { - if (process.platform !== "linux") return; - - return Promise.all([ - copyFile( - "./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-x64/node-napi-v7.node", - "./static/dist/venmic-x64.node" - ), - copyFile( - "./node_modules/@vencord/venmic/prebuilds/venmic-addon-linux-arm64/node-napi-v7.node", - "./static/dist/venmic-arm64.node" - ) - ]).catch(() => console.warn("Failed to copy venmic. Building without venmic support")); -} - -await Promise.all([ - copyVenmic(), - createContext({ - ...NodeCommonOpts, - entryPoints: ["src/main/index.ts"], - outfile: "dist/js/main.js", - footer: { js: "//# sourceURL=VCDMain" } - }), - createContext({ - ...NodeCommonOpts, - entryPoints: ["src/preload/index.ts"], - outfile: "dist/js/preload.js", - footer: { js: "//# sourceURL=VCDPreload" } - }), - createContext({ - ...NodeCommonOpts, - entryPoints: ["src/updater/preload.ts"], - outfile: "dist/js/updaterPreload.js", - footer: { js: "//# sourceURL=VCDUpdaterPreload" } - }), - createContext({ - ...CommonOpts, - globalName: "Vesktop", - entryPoints: ["src/renderer/index.ts"], - outfile: "dist/js/renderer.js", - format: "iife", - inject: ["./scripts/build/injectReact.mjs"], - jsxFactory: "VencordCreateElement", - jsxFragment: "VencordFragment", - external: ["@vencord/types/*"], - plugins: [vencordDep], - footer: { js: "//# sourceURL=VCDRenderer" } - }) -]); - -const watch = process.argv.includes("--watch"); - -if (watch) { - await Promise.all(contexts.map(ctx => ctx.watch())); -} else { - await Promise.all( - contexts.map(async ctx => { - await ctx.rebuild(); - await ctx.dispose(); - }) - ); -}