mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-01 02:17:53 +01:00
Implemented centralized versioning (#1016)
This commit is contained in:
1 parent
b133adeecb
commit
7da80768dd
21 files changed
+46
-20
No files matched your search
@@ -2,6 +2,7 @@ const path = require("path");
|
||||
const CopyPlugin = require("copy-webpack-plugin");
|
||||
const FileManagerPlugin = require("filemanager-webpack-plugin");
|
||||
|
||||
const extensionVersion = process.env.npm_package_version.replace('-', '.');
|
||||
const entries = ["ryd.content-script", "ryd.background", "popup"];
|
||||
|
||||
const ignorePatterns = [
|
||||
@@ -12,6 +13,25 @@ const ignorePatterns = [
|
||||
...entries.map((entry) => `**/${entry}.js`),
|
||||
];
|
||||
|
||||
const manifestTransform = (content, filename) => {
|
||||
const filteredContent = content
|
||||
.toString()
|
||||
.split('\n')
|
||||
.filter(str => !str.trimStart().startsWith("//"))
|
||||
.join('\n');
|
||||
|
||||
const manifestData = JSON.parse(filteredContent);
|
||||
manifestData.version = extensionVersion;
|
||||
return JSON.stringify(manifestData, null, 2);
|
||||
};
|
||||
|
||||
const i18nTransform = (content, filename) => {
|
||||
if (!filename.endsWith('messages.json'))
|
||||
return content;
|
||||
|
||||
return content.toString().replace(/__RYD_VERSION__/g, extensionVersion);
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
entry: Object.fromEntries(
|
||||
entries.map((entry) => [
|
||||
@@ -40,10 +60,12 @@ module.exports = {
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
},
|
||||
transform: i18nTransform
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-chrome.json",
|
||||
to: "./chrome/manifest.json",
|
||||
transform: manifestTransform
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
@@ -51,10 +73,12 @@ module.exports = {
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
},
|
||||
transform: i18nTransform
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-firefox.json",
|
||||
to: "./firefox/manifest.json",
|
||||
transform: manifestTransform
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined",
|
||||
@@ -62,10 +86,12 @@ module.exports = {
|
||||
globOptions: {
|
||||
ignore: ignorePatterns,
|
||||
},
|
||||
transform: i18nTransform
|
||||
},
|
||||
{
|
||||
from: "./Extensions/combined/manifest-safari.json",
|
||||
to: "./safari/manifest.json",
|
||||
transform: manifestTransform
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user