mirror of
https://github.com/Anarios/return-youtube-dislike.git
synced 2026-09-12 10:22:10 +02:00
Prepare AMO source submission
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
*cert
|
*cert
|
||||||
*Backend
|
*Backend
|
||||||
.DS_Store
|
.DS_Store
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
# Website node modules and build output
|
# Website node modules and build output
|
||||||
Website/package-lock.json
|
Website/package-lock.json
|
||||||
@@ -40,5 +39,4 @@ Extensions/combined/bundled-content-script.js
|
|||||||
|
|
||||||
# Dist Files
|
# Dist Files
|
||||||
Extensions/combined/dist/*
|
Extensions/combined/dist/*
|
||||||
package-lock.json
|
|
||||||
Website/package-lock.json
|
Website/package-lock.json
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
# AMO Source Build Instructions
|
||||||
|
|
||||||
|
This source package is provided for Mozilla Add-ons review. The extension is built with webpack, so reviewers should rebuild the submitted source and compare the generated Firefox output with the uploaded add-on package.
|
||||||
|
|
||||||
|
## Build environment
|
||||||
|
|
||||||
|
The release was built with:
|
||||||
|
|
||||||
|
- Ubuntu 24.04-compatible environment
|
||||||
|
- Node.js 22.17.0
|
||||||
|
- npm 10.8.2
|
||||||
|
|
||||||
|
The build script is cross-platform and also works on Windows and macOS when the same Node.js and npm versions are installed.
|
||||||
|
|
||||||
|
## Install Node.js
|
||||||
|
|
||||||
|
Using `nvm`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
nvm install 22.17.0
|
||||||
|
nvm use 22.17.0
|
||||||
|
```
|
||||||
|
|
||||||
|
Confirm the versions:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
node --version
|
||||||
|
npm --version
|
||||||
|
```
|
||||||
|
|
||||||
|
Expected versions:
|
||||||
|
|
||||||
|
```text
|
||||||
|
v22.17.0
|
||||||
|
10.8.2
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
From the repository root, run:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
node scripts/build-firefox-source.mjs
|
||||||
|
```
|
||||||
|
|
||||||
|
The script performs all required technical build steps:
|
||||||
|
|
||||||
|
1. Installs dependencies with `npm ci`.
|
||||||
|
2. Builds the extension with `npm run build`.
|
||||||
|
3. Verifies the generated Firefox output exists.
|
||||||
|
4. Verifies `ryd.content-script.js` is below 5 MB and does not contain a source map reference.
|
||||||
|
|
||||||
|
The generated Firefox extension files are written to:
|
||||||
|
|
||||||
|
```text
|
||||||
|
Extensions/combined/dist/firefox
|
||||||
|
```
|
||||||
|
|
||||||
|
Use that directory when comparing the rebuilt code with the submitted Firefox add-on package.
|
||||||
|
|
||||||
|
## Notes
|
||||||
|
|
||||||
|
- `package-lock.json` is included so npm installs the same dependency versions used for this release.
|
||||||
|
- Production builds disable inline source maps. Development builds still use inline source maps through `npm run dev`.
|
||||||
|
- The production bundle is generated by webpack but is not intentionally obfuscated or minified.
|
||||||
|
- `node_modules` and `Extensions/combined/dist` are generated locally and are not source inputs.
|
||||||
Generated
+8369
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "return-youtube-dislike",
|
"name": "return-youtube-dislike",
|
||||||
"version": "4.0.2",
|
"version": "4.0.3",
|
||||||
"description": "Chrome extension to return youtube dislikes",
|
"description": "Chrome extension to return youtube dislikes",
|
||||||
"main": "ryd.content-script.js",
|
"main": "ryd.content-script.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
import { spawnSync } from "node:child_process";
|
||||||
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
||||||
|
import { dirname, join, resolve } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const scriptDirectory = dirname(fileURLToPath(import.meta.url));
|
||||||
|
const repositoryRoot = resolve(scriptDirectory, "..");
|
||||||
|
const firefoxOutputDirectory = join(repositoryRoot, "Extensions", "combined", "dist", "firefox");
|
||||||
|
const firefoxManifestPath = join(firefoxOutputDirectory, "manifest.json");
|
||||||
|
const contentScriptPath = join(firefoxOutputDirectory, "ryd.content-script.js");
|
||||||
|
const maxContentScriptBytes = 5 * 1024 * 1024;
|
||||||
|
const npmCommand = process.platform === "win32" ? "npm.cmd" : "npm";
|
||||||
|
const shouldUseShell = process.platform === "win32";
|
||||||
|
|
||||||
|
function run(command, args, options = {}) {
|
||||||
|
const result = spawnSync(command, args, {
|
||||||
|
cwd: repositoryRoot,
|
||||||
|
env: {
|
||||||
|
...process.env,
|
||||||
|
...options.env,
|
||||||
|
},
|
||||||
|
stdio: "inherit",
|
||||||
|
shell: shouldUseShell,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.error !== undefined) {
|
||||||
|
throw result.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status !== 0) {
|
||||||
|
throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function readCommandOutput(command, args) {
|
||||||
|
const result = spawnSync(command, args, {
|
||||||
|
cwd: repositoryRoot,
|
||||||
|
encoding: "utf8",
|
||||||
|
shell: shouldUseShell,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.error !== undefined) {
|
||||||
|
throw result.error;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.status !== 0) {
|
||||||
|
throw new Error(`${command} ${args.join(" ")} failed with exit code ${result.status}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.stdout.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
function verifyFileExists(filePath, description) {
|
||||||
|
if (!existsSync(filePath)) {
|
||||||
|
throw new Error(`${description} was not generated at ${filePath}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Node.js: ${process.version}`);
|
||||||
|
console.log(`npm: ${readCommandOutput(npmCommand, ["--version"])}`);
|
||||||
|
|
||||||
|
console.log("Installing dependencies...");
|
||||||
|
run(npmCommand, ["ci"], {
|
||||||
|
env: {
|
||||||
|
HUSKY: "0",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("Building Firefox extension output...");
|
||||||
|
run(npmCommand, ["run", "build"]);
|
||||||
|
|
||||||
|
verifyFileExists(firefoxManifestPath, "Firefox manifest");
|
||||||
|
verifyFileExists(contentScriptPath, "Firefox content script");
|
||||||
|
|
||||||
|
const contentScriptSize = statSync(contentScriptPath).size;
|
||||||
|
if (contentScriptSize >= maxContentScriptBytes) {
|
||||||
|
throw new Error(`ryd.content-script.js is ${contentScriptSize} bytes, expected less than ${maxContentScriptBytes}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const contentScript = readFileSync(contentScriptPath, "utf8");
|
||||||
|
if (contentScript.includes("sourceMappingURL")) {
|
||||||
|
throw new Error("ryd.content-script.js contains a source map reference");
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Firefox output: ${firefoxOutputDirectory}`);
|
||||||
|
console.log(`ryd.content-script.js: ${contentScriptSize} bytes`);
|
||||||
|
console.log("AMO source build completed successfully.");
|
||||||
+3
-3
@@ -66,7 +66,7 @@ class MirrorJsOutputsPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = (env, argv) => ({
|
||||||
entry: Object.fromEntries(
|
entry: Object.fromEntries(
|
||||||
entries.map((entry) => [entry, path.join(__dirname, "./Extensions/combined/", `${entry}.js`)]),
|
entries.map((entry) => [entry, path.join(__dirname, "./Extensions/combined/", `${entry}.js`)]),
|
||||||
),
|
),
|
||||||
@@ -132,5 +132,5 @@ module.exports = {
|
|||||||
experiments: {
|
experiments: {
|
||||||
topLevelAwait: true,
|
topLevelAwait: true,
|
||||||
},
|
},
|
||||||
devtool: "inline-source-map",
|
devtool: argv.mode === "development" ? "inline-source-map" : false,
|
||||||
};
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user