Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/replugged-org/replugged int…
Browse files Browse the repository at this point in the history
…o byPrototype
  • Loading branch information
yofukashino committed Oct 21, 2024
2 parents 4327edc + 22b35d6 commit dd1e181
Show file tree
Hide file tree
Showing 120 changed files with 3,431 additions and 4,101 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.template.js
plugins/*
themes/*
dist-bundle/*
dist/*
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
contact_links:
- name: Support Server
url: https://discord.gg/B2TcnXV9Rg
url: https://discord.gg/HnYFUhv4x4
about:
If you need help with Replugged, join our support server and ask in the appropriated channel.
12 changes: 5 additions & 7 deletions .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: latest
- uses: pnpm/action-setup@v4

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: latest
- uses: pnpm/action-setup@v4

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: latest
- uses: pnpm/action-setup@v4

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: latest
- uses: pnpm/action-setup@v4

- name: Install Node.js dependencies
run: pnpm install
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- uses: pnpm/action-setup@v2
with:
version: latest
- uses: pnpm/action-setup@v4

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.12.1
v20.15.0
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Replugged

[Website](https://replugged.dev) | [Discord](https://discord.gg/replugged) |
[Website](https://replugged.dev) | [Discord](https://discord.gg/HnYFUhv4x4) |
[Developer Guide](https://guide.replugged.dev) | [API Docs](https://docs.replugged.dev)
(API docs will be replaced with the guide in the future)

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

Please create a private [security advisory](https://github.com/replugged-org/replugged/security/advisories/new). This will only be visible to us until we release a fix.

If you have issues with the form above, you can also DM a staff member of our [Discord server](https://discord.gg/replugged) with the details of your issue.
If you have issues with the form above, you can also DM a staff member of our [Discord server](https://discord.gg/HnYFUhv4x4) with the details of your issue.
82 changes: 56 additions & 26 deletions bin/index.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import WebSocket from "ws";
import { release } from "./release.mjs";
import { logBuildPlugin } from "../src/util.mjs";
import { sassPlugin } from "esbuild-sass-plugin";
import { fileURLToPath } from "url";
import { fileURLToPath, pathToFileURL } from "url";
import { AddonType, getAddonFolder, isMonoRepo, selectAddon } from "./mono.mjs";

interface BaseArgs {
Expand All @@ -40,6 +40,20 @@ export const directory = process.cwd();
const dirname = path.dirname(fileURLToPath(import.meta.url));
const packageJson = JSON.parse(readFileSync(path.resolve(dirname, "package.json"), "utf-8"));

const extraESBuildPath = path.join(directory, "esbuild.extra.mjs");
const extraESBuildConfig = new Promise<(config: esbuild.BuildOptions) => esbuild.BuildOptions>(
(resolve) => {
if (existsSync(extraESBuildPath))
resolve(
import(pathToFileURL(extraESBuildPath).href).then((m) => m.default) as Promise<
(config: esbuild.BuildOptions) => esbuild.BuildOptions
>,
);

resolve((config: esbuild.BuildOptions) => config);
},
);

const updateMessage = `Update available ${chalk.dim("{currentVersion}")}${chalk.reset(
" → ",
)}${chalk.green("{latestVersion}")} \nRun ${chalk.cyan("pnpm i -D replugged")} to update`;
Expand Down Expand Up @@ -258,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();
}
}),
Expand All @@ -284,7 +298,7 @@ const CONFIG_PATH = (() => {
return path.join(process.env.HOME || "", ".config", REPLUGGED_FOLDER_NAME);
}
})();
const CHROME_VERSION = "91";
const CHROME_VERSION = "124";

function buildAddons(buildFn: (args: Args) => Promise<void>, args: Args, type: AddonType): void {
const addons = getAddonFolder(type);
Expand Down Expand Up @@ -350,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 });
Expand Down Expand Up @@ -382,25 +398,31 @@ async function buildPlugin({ watch, noInstall, production, noReload, addon }: Ar

const targets: Array<Promise<esbuild.BuildContext>> = [];

const overwrites = await extraESBuildConfig;

if ("renderer" in manifest) {
targets.push(
esbuild.context({
...common,
entryPoints: [path.join(folderPath, manifest.renderer)],
outfile: `${distPath}/renderer.js`,
}),
esbuild.context(
overwrites({
...common,
entryPoints: [path.join(folderPath, manifest.renderer)],
outfile: `${distPath}/renderer.js`,
}),
),
);

manifest.renderer = "renderer.js";
}

if ("plaintextPatches" in manifest) {
targets.push(
esbuild.context({
...common,
entryPoints: [path.join(folderPath, manifest.plaintextPatches)],
outfile: `${distPath}/plaintextPatches.js`,
}),
esbuild.context(
overwrites({
...common,
entryPoints: [path.join(folderPath, manifest.plaintextPatches)],
outfile: `${distPath}/plaintextPatches.js`,
}),
),
);

manifest.plaintextPatches = "plaintextPatches.js";
Expand Down Expand Up @@ -432,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 });
Expand Down Expand Up @@ -464,28 +488,34 @@ async function buildTheme({ watch, noInstall, production, noReload, addon }: Arg

const targets: Array<Promise<esbuild.BuildContext>> = [];

const overwrites = await extraESBuildConfig;

if (main) {
targets.push(
esbuild.context({
...common,
entryPoints: [main],
outfile: `${distPath}/main.css`,
}),
esbuild.context(
overwrites({
...common,
entryPoints: [main],
outfile: `${distPath}/main.css`,
}),
),
);

manifest.main = "main.css";
}

if (splash) {
targets.push(
esbuild.context({
...common,
entryPoints: [splash],
outfile: `${distPath}/splash.css`,
}),
esbuild.context(
overwrites({
...common,
entryPoints: [splash],
outfile: `${distPath}/splash.css`,
}),
),
);

manifest.plaintextPatches = "splash.css";
manifest.splash = "splash.css";
}

if (!existsSync(distPath)) mkdirSync(distPath, { recursive: true });
Expand Down
Loading

0 comments on commit dd1e181

Please sign in to comment.