mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-27 12:50:51 +03:00
Set up uploading source maps to github pages
This commit is contained in:
@@ -42,6 +42,7 @@ class BuildManifest {
|
||||
apply() {
|
||||
const distFolder = path.resolve(__dirname, "../dist/");
|
||||
const distManifestFile = path.resolve(distFolder, "manifest.json");
|
||||
const [owner, repo_name] = (process.env.GITHUB_REPOSITORY ?? "ajayyy/SponsorBlock").split("/");
|
||||
|
||||
// Add missing manifest elements
|
||||
if (this.options.browser.toLowerCase() === "firefox") {
|
||||
@@ -66,7 +67,6 @@ class BuildManifest {
|
||||
}
|
||||
|
||||
if (this.options.autoupdate === true && this.options.browser.toLowerCase() === "firefox") {
|
||||
const [owner, repo_name] = process.env.GITHUB_REPOSITORY.split("/");
|
||||
manifest.browser_specific_settings.gecko.update_url = `https://${owner.toLowerCase()}.github.io/${repo_name}/updates.json`;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,32 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
const { SourceMapDevToolPlugin } = require('webpack');
|
||||
const { merge } = require('webpack-merge');
|
||||
const common = require('./webpack.common.js');
|
||||
|
||||
function createGHPSourceMapURL(env) {
|
||||
const manifest = require("../manifest/manifest.json");
|
||||
const version = manifest.version;
|
||||
const [owner, repo_name] = (process.env.GITHUB_REPOSITORY ?? "ajayyy/SponsorBlock").split("/");
|
||||
return `https://${owner.toLowerCase()}.github.io/${repo_name}/${env.browser}${env.stream === "beta" ? "-beta" : ""}/${version}/`;
|
||||
}
|
||||
|
||||
module.exports = env => {
|
||||
let mode = "production";
|
||||
env.mode = mode;
|
||||
|
||||
return merge(common(env), {
|
||||
mode,
|
||||
devtool: "source-map",
|
||||
...(env.ghpSourceMaps
|
||||
? {
|
||||
devtool: false,
|
||||
plugins: [new SourceMapDevToolPlugin({
|
||||
publicPath: createGHPSourceMapURL(env),
|
||||
filename: '[file].map[query]',
|
||||
})],
|
||||
}
|
||||
: {
|
||||
devtool: "source-map",
|
||||
}
|
||||
),
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user