From 48e2a3aadeda59ddf75e6e289d170ae9b8f4a2c4 Mon Sep 17 00:00:00 2001 From: ShadiestGoat <48590492+ShadiestGoat@users.noreply.github.com> Date: Mon, 16 Oct 2023 00:55:06 +0100 Subject: [PATCH 1/6] Add type aliases --- src/renderer/coremods/badges/badge.tsx | 2 +- src/renderer/coremods/badges/badges/Booster.tsx | 2 +- src/renderer/coremods/badges/badges/BugHunter.tsx | 2 +- src/renderer/coremods/badges/badges/Contributor.tsx | 2 +- src/renderer/coremods/badges/badges/Developer.tsx | 2 +- src/renderer/coremods/badges/badges/EarlyUser.tsx | 2 +- src/renderer/coremods/badges/badges/Staff.tsx | 2 +- src/renderer/coremods/badges/badges/Support.tsx | 2 +- src/renderer/coremods/badges/badges/Translator.tsx | 2 +- src/renderer/coremods/badges/badges/index.ts | 1 + src/renderer/coremods/installer/AddonEmbed.tsx | 2 +- src/renderer/coremods/settings/icons/index.ts | 1 + src/renderer/modules/common/react.ts | 1 + 13 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/renderer/coremods/badges/badge.tsx b/src/renderer/coremods/badges/badge.tsx index 01bb1f4e4..45c5864ca 100644 --- a/src/renderer/coremods/badges/badge.tsx +++ b/src/renderer/coremods/badges/badge.tsx @@ -1,5 +1,5 @@ import { Messages } from "@common/i18n"; -import React from "@common/react"; +import React, { _ } from "@common/react"; import { Clickable, Tooltip } from "@components"; import { getByProps } from "../../modules/webpack"; import { goToOrJoinServer, openExternal } from "../../util"; diff --git a/src/renderer/coremods/badges/badges/Booster.tsx b/src/renderer/coremods/badges/badges/Booster.tsx index eb9046447..138d1bab6 100644 --- a/src/renderer/coremods/badges/badges/Booster.tsx +++ b/src/renderer/coremods/badges/badges/Booster.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/BugHunter.tsx b/src/renderer/coremods/badges/badges/BugHunter.tsx index bd4b82e43..f779394b2 100644 --- a/src/renderer/coremods/badges/badges/BugHunter.tsx +++ b/src/renderer/coremods/badges/badges/BugHunter.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Contributor.tsx b/src/renderer/coremods/badges/badges/Contributor.tsx index 4ba780668..2e3b782ff 100644 --- a/src/renderer/coremods/badges/badges/Contributor.tsx +++ b/src/renderer/coremods/badges/badges/Contributor.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Developer.tsx b/src/renderer/coremods/badges/badges/Developer.tsx index ba8573993..bdb209297 100644 --- a/src/renderer/coremods/badges/badges/Developer.tsx +++ b/src/renderer/coremods/badges/badges/Developer.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/EarlyUser.tsx b/src/renderer/coremods/badges/badges/EarlyUser.tsx index db3843656..4f1b3e772 100644 --- a/src/renderer/coremods/badges/badges/EarlyUser.tsx +++ b/src/renderer/coremods/badges/badges/EarlyUser.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Staff.tsx b/src/renderer/coremods/badges/badges/Staff.tsx index 1968a57f7..6c16440ab 100644 --- a/src/renderer/coremods/badges/badges/Staff.tsx +++ b/src/renderer/coremods/badges/badges/Staff.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Support.tsx b/src/renderer/coremods/badges/badges/Support.tsx index 52dbb03db..9e2c93460 100644 --- a/src/renderer/coremods/badges/badges/Support.tsx +++ b/src/renderer/coremods/badges/badges/Support.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Translator.tsx b/src/renderer/coremods/badges/badges/Translator.tsx index d1fb80e14..3b0ada03a 100644 --- a/src/renderer/coremods/badges/badges/Translator.tsx +++ b/src/renderer/coremods/badges/badges/Translator.tsx @@ -1,4 +1,4 @@ -import React from "@common/react"; +import React, {_} from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/index.ts b/src/renderer/coremods/badges/badges/index.ts index 166cdbe83..adf388fdc 100644 --- a/src/renderer/coremods/badges/badges/index.ts +++ b/src/renderer/coremods/badges/badges/index.ts @@ -1,3 +1,4 @@ +import type _ from "react" import Booster from "./Booster"; import BugHunter from "./BugHunter"; import Contributor from "./Contributor"; diff --git a/src/renderer/coremods/installer/AddonEmbed.tsx b/src/renderer/coremods/installer/AddonEmbed.tsx index 0ff620242..2ff7ba419 100644 --- a/src/renderer/coremods/installer/AddonEmbed.tsx +++ b/src/renderer/coremods/installer/AddonEmbed.tsx @@ -1,5 +1,5 @@ import { Messages } from "@common/i18n"; -import { React } from "@common"; +import React, { _ } from "@common/react"; import { Button, Clickable, Text, Tooltip } from "@components"; import { Logger } from "@replugged"; import { getByProps } from "@webpack"; diff --git a/src/renderer/coremods/settings/icons/index.ts b/src/renderer/coremods/settings/icons/index.ts index e6c8be8d6..beac4db02 100644 --- a/src/renderer/coremods/settings/icons/index.ts +++ b/src/renderer/coremods/settings/icons/index.ts @@ -1,3 +1,4 @@ +import _ from "react"; import Discord from "./Discord"; import GitHub from "./GitHub"; import Link from "./Link"; diff --git a/src/renderer/modules/common/react.ts b/src/renderer/modules/common/react.ts index 0e0ec9693..b4ed2ccaf 100644 --- a/src/renderer/modules/common/react.ts +++ b/src/renderer/modules/common/react.ts @@ -2,3 +2,4 @@ import type React from "react"; import { waitForProps } from "../webpack"; export default await waitForProps("createElement", "useState"); +export type { React as _ } From f53ec18de369b5959e50a863669e99805e19c5c3 Mon Sep 17 00:00:00 2001 From: ShadiestGoat <48590492+ShadiestGoat@users.noreply.github.com> Date: Mon, 16 Oct 2023 01:09:29 +0100 Subject: [PATCH 2/6] Test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index eae391f37..4c276bcda 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "lint": "pnpm run prettier:check && pnpm run eslint:check && pnpm run cspell:check && pnpm run typescript:check", "lint:fix": "pnpm run prettier:fix && pnpm run eslint:fix && pnpm run cspell:check && pnpm run typescript:check", "postinstall": "tsx scripts/build-bin.mts", - "prepublishOnly": "rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", + "prepare": "[ ! -e src ] && exit 0; rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", "postpublish": "rm -rf *.d.ts; rm -rf dist; npm run build", "docs": "typedoc src/renderer/replugged.ts --excludeExternals", "docs:watch": "pnpm run docs --watch" From a139afcd7067c4541df298c9741a520646971324 Mon Sep 17 00:00:00 2001 From: ShadiestGoat <48590492+ShadiestGoat@users.noreply.github.com> Date: Mon, 16 Oct 2023 01:18:29 +0100 Subject: [PATCH 3/6] New debug for prepare script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c276bcda..7a0f45b17 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "lint": "pnpm run prettier:check && pnpm run eslint:check && pnpm run cspell:check && pnpm run typescript:check", "lint:fix": "pnpm run prettier:fix && pnpm run eslint:fix && pnpm run cspell:check && pnpm run typescript:check", "postinstall": "tsx scripts/build-bin.mts", - "prepare": "[ ! -e src ] && exit 0; rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", + "prepare": "[ ! -e src ] && echo 'No src detected, exiting...' && exit 0; rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", "postpublish": "rm -rf *.d.ts; rm -rf dist; npm run build", "docs": "typedoc src/renderer/replugged.ts --excludeExternals", "docs:watch": "pnpm run docs --watch" From 37b150c21306551a41ec3b92e61a9d09079e3f21 Mon Sep 17 00:00:00 2001 From: ShadiestGoat <48590492+ShadiestGoat@users.noreply.github.com> Date: Mon, 16 Oct 2023 01:41:04 +0100 Subject: [PATCH 4/6] Move scripts around to make it all fancy --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 7a0f45b17..cbb6f2b05 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,9 @@ "eslint:fix": "eslint ./src ./scripts ./bin --fix", "lint": "pnpm run prettier:check && pnpm run eslint:check && pnpm run cspell:check && pnpm run typescript:check", "lint:fix": "pnpm run prettier:fix && pnpm run eslint:fix && pnpm run cspell:check && pnpm run typescript:check", - "postinstall": "tsx scripts/build-bin.mts", - "prepare": "[ ! -e src ] && echo 'No src detected, exiting...' && exit 0; rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", + "postinstall": "tsx scripts/build-bin.mts; [ ! -e src ] && exit 0 || pnpm run build:types", + "build:types": "rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", + "prepublishOnly": "pnpm run build:types", "postpublish": "rm -rf *.d.ts; rm -rf dist; npm run build", "docs": "typedoc src/renderer/replugged.ts --excludeExternals", "docs:watch": "pnpm run docs --watch" From 1a6b242454f3fe4866c652aa2d5cc63111954cc3 Mon Sep 17 00:00:00 2001 From: ShadiestGoat <48590492+ShadiestGoat@users.noreply.github.com> Date: Mon, 16 Oct 2023 01:54:30 +0100 Subject: [PATCH 5/6] Fix styling --- package.json | 2 +- src/renderer/coremods/badges/badges/Booster.tsx | 2 +- src/renderer/coremods/badges/badges/BugHunter.tsx | 2 +- src/renderer/coremods/badges/badges/Contributor.tsx | 2 +- src/renderer/coremods/badges/badges/Developer.tsx | 2 +- src/renderer/coremods/badges/badges/EarlyUser.tsx | 2 +- src/renderer/coremods/badges/badges/Staff.tsx | 2 +- src/renderer/coremods/badges/badges/Support.tsx | 2 +- src/renderer/coremods/badges/badges/Translator.tsx | 2 +- src/renderer/coremods/badges/badges/index.ts | 2 +- src/renderer/modules/common/react.ts | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index cbb6f2b05..c8be828bc 100644 --- a/package.json +++ b/package.json @@ -25,8 +25,8 @@ "eslint:fix": "eslint ./src ./scripts ./bin --fix", "lint": "pnpm run prettier:check && pnpm run eslint:check && pnpm run cspell:check && pnpm run typescript:check", "lint:fix": "pnpm run prettier:fix && pnpm run eslint:fix && pnpm run cspell:check && pnpm run typescript:check", - "postinstall": "tsx scripts/build-bin.mts; [ ! -e src ] && exit 0 || pnpm run build:types", "build:types": "rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", + "postinstall": "tsx scripts/build-bin.mts; [ ! -e src ] && exit 0 || pnpm run build:types", "prepublishOnly": "pnpm run build:types", "postpublish": "rm -rf *.d.ts; rm -rf dist; npm run build", "docs": "typedoc src/renderer/replugged.ts --excludeExternals", diff --git a/src/renderer/coremods/badges/badges/Booster.tsx b/src/renderer/coremods/badges/badges/Booster.tsx index 138d1bab6..e7311abeb 100644 --- a/src/renderer/coremods/badges/badges/Booster.tsx +++ b/src/renderer/coremods/badges/badges/Booster.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/BugHunter.tsx b/src/renderer/coremods/badges/badges/BugHunter.tsx index f779394b2..0e9afd60a 100644 --- a/src/renderer/coremods/badges/badges/BugHunter.tsx +++ b/src/renderer/coremods/badges/badges/BugHunter.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Contributor.tsx b/src/renderer/coremods/badges/badges/Contributor.tsx index 2e3b782ff..a498285c0 100644 --- a/src/renderer/coremods/badges/badges/Contributor.tsx +++ b/src/renderer/coremods/badges/badges/Contributor.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Developer.tsx b/src/renderer/coremods/badges/badges/Developer.tsx index bdb209297..cd956cbf1 100644 --- a/src/renderer/coremods/badges/badges/Developer.tsx +++ b/src/renderer/coremods/badges/badges/Developer.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/EarlyUser.tsx b/src/renderer/coremods/badges/badges/EarlyUser.tsx index 4f1b3e772..56d4ef0e2 100644 --- a/src/renderer/coremods/badges/badges/EarlyUser.tsx +++ b/src/renderer/coremods/badges/badges/EarlyUser.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Staff.tsx b/src/renderer/coremods/badges/badges/Staff.tsx index 6c16440ab..53594c137 100644 --- a/src/renderer/coremods/badges/badges/Staff.tsx +++ b/src/renderer/coremods/badges/badges/Staff.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Support.tsx b/src/renderer/coremods/badges/badges/Support.tsx index 9e2c93460..b479221e4 100644 --- a/src/renderer/coremods/badges/badges/Support.tsx +++ b/src/renderer/coremods/badges/badges/Support.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/Translator.tsx b/src/renderer/coremods/badges/badges/Translator.tsx index 3b0ada03a..2306f8328 100644 --- a/src/renderer/coremods/badges/badges/Translator.tsx +++ b/src/renderer/coremods/badges/badges/Translator.tsx @@ -1,4 +1,4 @@ -import React, {_} from "@common/react"; +import React, { _ } from "@common/react"; export default React.memo((props) => ( diff --git a/src/renderer/coremods/badges/badges/index.ts b/src/renderer/coremods/badges/badges/index.ts index adf388fdc..dddb8bae4 100644 --- a/src/renderer/coremods/badges/badges/index.ts +++ b/src/renderer/coremods/badges/badges/index.ts @@ -1,4 +1,4 @@ -import type _ from "react" +import type _ from "react"; import Booster from "./Booster"; import BugHunter from "./BugHunter"; import Contributor from "./Contributor"; diff --git a/src/renderer/modules/common/react.ts b/src/renderer/modules/common/react.ts index b4ed2ccaf..a39774226 100644 --- a/src/renderer/modules/common/react.ts +++ b/src/renderer/modules/common/react.ts @@ -2,4 +2,4 @@ import type React from "react"; import { waitForProps } from "../webpack"; export default await waitForProps("createElement", "useState"); -export type { React as _ } +export type { React as _ }; From 76f1b084105f4a846760c5ef5e96dae64196153e Mon Sep 17 00:00:00 2001 From: ShadiestGoat <48590492+ShadiestGoat@users.noreply.github.com> Date: Mon, 16 Oct 2023 02:17:53 +0100 Subject: [PATCH 6/6] Move back to using prepare --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c8be828bc..93ddf3829 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,8 @@ "lint": "pnpm run prettier:check && pnpm run eslint:check && pnpm run cspell:check && pnpm run typescript:check", "lint:fix": "pnpm run prettier:fix && pnpm run eslint:fix && pnpm run cspell:check && pnpm run typescript:check", "build:types": "rm -rf dist; tsc --declaration --emitDeclarationOnly --noEmit false -p tsconfig.json --outDir dist; rm -rf dist/scripts; mv dist/src/* dist; rm -rf dist/src; cp src/*.d.ts dist; tsx scripts/create-import-wrappers.mts", - "postinstall": "tsx scripts/build-bin.mts; [ ! -e src ] && exit 0 || pnpm run build:types", - "prepublishOnly": "pnpm run build:types", + "postinstall": "tsx scripts/build-bin.mts", + "prepare": "[ ! -e src ] && exit 0 || pnpm run build:types", "postpublish": "rm -rf *.d.ts; rm -rf dist; npm run build", "docs": "typedoc src/renderer/replugged.ts --excludeExternals", "docs:watch": "pnpm run docs --watch"