mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-30 18:07:53 +01:00
Fix Shorts support and add userscript voting
Harden Shorts controls, reaction state, and navigation; share voting logic with the extension; improve ratio-bar rendering; and add comprehensive Jest, Playwright, artifact, and live-browser regression coverage.
This commit is contained in:
1 parent
4e6dfd1977
commit
3657de9b2c
74 files changed
+23328
-588
No files matched your search
+88
-68
@@ -1,8 +1,10 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
const webpack = require("webpack");
|
||||
const { LiveBuildMarkerPlugin, createLiveBuildId } = require("./webpack.live-build-marker");
|
||||
|
||||
const extensionVersion = process.env.npm_package_version.replace("-", ".");
|
||||
const extensionVersion = (process.env.npm_package_version || require("./package.json").version).replace("-", ".");
|
||||
const entries = ["ryd.content-script", "ryd.background", "popup", "ryd.changelog"];
|
||||
|
||||
const ignorePatterns = [
|
||||
@@ -51,8 +53,8 @@ class MirrorJsOutputsPlugin {
|
||||
const existingFiles = await fsp.readdir(targetDir).catch(() => []);
|
||||
await Promise.all(
|
||||
existingFiles
|
||||
.filter((file) => file.endsWith(".js"))
|
||||
.map((file) => fsp.rm(path.join(targetDir, file), { force: true }))
|
||||
.filter((file) => jsAssets.includes(file))
|
||||
.map((file) => fsp.rm(path.join(targetDir, file), { force: true })),
|
||||
);
|
||||
|
||||
await Promise.all(
|
||||
@@ -66,71 +68,89 @@ class MirrorJsOutputsPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = (env, argv) => ({
|
||||
entry: Object.fromEntries(
|
||||
entries.map((entry) => [entry, path.join(__dirname, "./Extensions/combined/", `${entry}.js`)]),
|
||||
),
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
path: path.resolve(__dirname, "Extensions/combined/dist"),
|
||||
clean: true,
|
||||
},
|
||||
cache: false,
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
watchOptions: {
|
||||
ignored: "**/dist/**",
|
||||
},
|
||||
plugins: [
|
||||
// exclude locale files in moment
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
to: "./chrome",
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
module.exports = (env = {}, argv = {}) => {
|
||||
const liveTestBuild = env.liveTest === true || env.liveTest === "true";
|
||||
const liveBuildId = createLiveBuildId(liveTestBuild);
|
||||
|
||||
return {
|
||||
entry: Object.fromEntries(
|
||||
entries.map((entry) => [entry, path.join(__dirname, "./Extensions/combined/", `${entry}.js`)]),
|
||||
),
|
||||
output: {
|
||||
filename: "[name].js",
|
||||
path: path.resolve(__dirname, "Extensions/combined/dist"),
|
||||
clean: true,
|
||||
},
|
||||
cache: false,
|
||||
optimization: {
|
||||
minimize: false,
|
||||
},
|
||||
watchOptions: {
|
||||
ignored: "**/dist/**",
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
__RYD_LIVE_BUILD_ID__: JSON.stringify(liveBuildId),
|
||||
__RYD_LIVE_TEST_BUILD__: JSON.stringify(liveTestBuild),
|
||||
}),
|
||||
...(liveTestBuild
|
||||
? [
|
||||
new LiveBuildMarkerPlugin(liveBuildId, [
|
||||
"chrome/live-build.json",
|
||||
"firefox/live-build.json",
|
||||
"safari/live-build.json",
|
||||
]),
|
||||
]
|
||||
: []),
|
||||
// exclude locale files in moment
|
||||
new CopyPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
to: "./chrome",
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
},
|
||||
transform: i18nTransform,
|
||||
},
|
||||
transform: i18nTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-chrome.json",
|
||||
to: "./chrome/manifest.json",
|
||||
transform: manifestTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
to: "./firefox",
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
{
|
||||
from: "./Extensions/combined/manifest-chrome.json",
|
||||
to: "./chrome/manifest.json",
|
||||
transform: manifestTransform,
|
||||
},
|
||||
transform: i18nTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-firefox.json",
|
||||
to: "./firefox/manifest.json",
|
||||
transform: manifestTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
to: "./safari",
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
to: "./firefox",
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
},
|
||||
transform: i18nTransform,
|
||||
},
|
||||
transform: i18nTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-safari.json",
|
||||
to: "./safari/manifest.json",
|
||||
transform: manifestTransform,
|
||||
},
|
||||
],
|
||||
}),
|
||||
new MirrorJsOutputsPlugin(["chrome", "firefox", "safari"]),
|
||||
],
|
||||
experiments: {
|
||||
topLevelAwait: true,
|
||||
},
|
||||
devtool: argv.mode === "development" ? "inline-source-map" : false,
|
||||
});
|
||||
{
|
||||
from: "./Extensions/combined/manifest-firefox.json",
|
||||
to: "./firefox/manifest.json",
|
||||
transform: manifestTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
to: "./safari",
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
},
|
||||
transform: i18nTransform,
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-safari.json",
|
||||
to: "./safari/manifest.json",
|
||||
transform: manifestTransform,
|
||||
},
|
||||
],
|
||||
}),
|
||||
new MirrorJsOutputsPlugin(["chrome", "firefox", "safari"]),
|
||||
],
|
||||
experiments: {
|
||||
topLevelAwait: true,
|
||||
},
|
||||
devtool: argv.mode === "development" ? "inline-source-map" : false,
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user