From 8254073477e14f3ce264e027c751b57e9a3a997f Mon Sep 17 00:00:00 2001 From: Tharki-God Date: Fri, 21 Jun 2024 11:27:15 +0530 Subject: [PATCH 1/3] fix --- src/renderer/coremods/contextMenu/plaintextPatches.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/coremods/contextMenu/plaintextPatches.ts b/src/renderer/coremods/contextMenu/plaintextPatches.ts index be44892b0..59b34151f 100644 --- a/src/renderer/coremods/contextMenu/plaintextPatches.ts +++ b/src/renderer/coremods/contextMenu/plaintextPatches.ts @@ -2,10 +2,10 @@ import type { PlaintextPatch } from "src/types"; export default [ { - find: 'Error("Menu', + find: 'Error("Menu API', replacements: [ { - match: /return(\(0,.\.jsx\)\(\w+.OnMenuSelectContext)/, + match: /return(\(0,.\.jsx\)\(\w+\.\w+\.Provider)/, replace: (_, suffix) => `return replugged.coremods.coremods.contextMenu._buildPatchedMenu(arguments[0])??${suffix}`, }, From 40eb0a449283b7849122c4b1909ace43996f33d3 Mon Sep 17 00:00:00 2001 From: Federico Di Leo <38290480+FedeIlLeone@users.noreply.github.com> Date: Mon, 24 Jun 2024 01:32:54 +0200 Subject: [PATCH 2/3] fix(scripts): catch and exit if building fails (#634) --- bin/index.mts | 10 +++++++--- scripts/build.mts | 6 ++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/bin/index.mts b/bin/index.mts index 05570f840..1fde60ba3 100755 --- a/bin/index.mts +++ b/bin/index.mts @@ -272,7 +272,7 @@ async function handleContexts( if (watch) { await context.watch(); } else { - await context.rebuild().catch(() => {}); + await context.rebuild().catch(() => process.exit(1)); context.dispose(); } }), @@ -364,7 +364,9 @@ async function buildPlugin({ watch, noInstall, production, noReload, addon }: Ar const install: esbuild.Plugin = { name: "install", setup: (build) => { - build.onEnd(async () => { + build.onEnd(async (result) => { + if (result.errors.length > 0) return; + if (!noInstall) { const dest = path.join(CONFIG_PATH, "plugins", manifest.id); if (existsSync(dest)) rmSync(dest, { recursive: true, force: true }); @@ -452,7 +454,9 @@ async function buildTheme({ watch, noInstall, production, noReload, addon }: Arg const install: esbuild.Plugin = { name: "install", setup: (build) => { - build.onEnd(async () => { + build.onEnd(async (result) => { + if (result.errors.length > 0) return; + if (!noInstall) { const dest = path.join(CONFIG_PATH, "themes", manifest.id); if (existsSync(dest)) rmSync(dest, { recursive: true, force: true }); diff --git a/scripts/build.mts b/scripts/build.mts index 8e314b2fe..ff10da1c2 100644 --- a/scripts/build.mts +++ b/scripts/build.mts @@ -33,7 +33,9 @@ rmSync("replugged.asar", { force: true }); const preBundle: esbuild.Plugin = { name: "preBundle", setup: (build) => { - build.onEnd(() => { + build.onEnd((result) => { + if (result.errors.length > 0) return; + if (!existsSync(`${distDir}/i18n`)) { mkdirSync(`${distDir}/i18n`); } @@ -114,7 +116,7 @@ await Promise.all( if (watch) { await context.watch(); } else { - await context.rebuild().catch(() => {}); + await context.rebuild().catch(() => process.exit(1)); context.dispose(); } }), From e9c279e046748f47bb2862e7e3933ecdba89d6a0 Mon Sep 17 00:00:00 2001 From: Tharki-God Date: Wed, 26 Jun 2024 17:56:33 +0530 Subject: [PATCH 3/3] pretty --- src/renderer/coremods/contextMenu/index.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/renderer/coremods/contextMenu/index.tsx b/src/renderer/coremods/contextMenu/index.tsx index 026886d1f..7599c0b86 100644 --- a/src/renderer/coremods/contextMenu/index.tsx +++ b/src/renderer/coremods/contextMenu/index.tsx @@ -9,7 +9,6 @@ import type { import { Logger } from "../../modules/logger"; import { ContextMenu as ContextComponents } from "../../modules/components"; - const logger = Logger.api("ContextMenu"); export const menuItems = {} as Record< @@ -115,7 +114,6 @@ export function _buildPatchedMenu(menu: ContextMenuData): React.ReactElement | n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (!menuItems[navId] || !MenuGroup) return ; - // The data as passed as Arguments from the calling function, so we just grab what we want from it const data = menu.data[0];