Update build of opera

This commit is contained in:
sienori 2019-02-24 03:35:42 +09:00
parent 977b278043
commit 47e2f116e2
4 changed files with 89 additions and 2 deletions

67
src/manifest-opera.json Normal file
View file

@ -0,0 +1,67 @@
{
"manifest_version": 2,
"version": "2.0.0",
"name": "__MSG_extName__",
"description": "__MSG_extDescription__",
"default_locale": "en",
"permissions": ["<all_urls>", "storage", "contextMenus"],
"options_ui": {
"page": "options/index.html",
"open_in_tab": true
},
"icons": {
"512": "icons/512.png",
"128": "icons/128.png",
"64": "icons/64.png",
"48": "icons/48.png",
"32": "icons/32.png"
},
"background": {
"scripts": ["background/background.js"]
},
"browser_action": {
"default_icon": {
"512": "icons/512.png",
"128": "icons/128.png",
"64": "icons/64.png",
"48": "icons/48.png",
"38": "icons/38.png",
"32": "icons/32.png",
"19": "icons/19.png",
"16": "icons/16.png"
},
"default_popup": "popup/index.html"
},
"content_scripts": [
{
"all_frames": true,
"matches": ["http://*/*", "https://*/*", "<all_urls>"],
"js": ["content/content.js"]
}
],
"commands": {
"_execute_browser_action": {
"description": "__MSG_openPopupDescription__",
"suggested_key": {
"default": "Alt+Shift+T"
}
},
"translateSelectedText": {
"description": "__MSG_translateTextMenu__",
"suggested_key": {
"default": "Alt+T"
}
},
"translatePage": {
"description": "__MSG_translatePageMenu__"
}
}
}

View file

@ -7,6 +7,7 @@ const {
getHTMLPlugins, getHTMLPlugins,
getOutput, getOutput,
getCopyPlugins, getCopyPlugins,
getOperaCopyPlugins,
getFirefoxCopyPlugins, getFirefoxCopyPlugins,
getEntry getEntry
} = require("./webpack.utils"); } = require("./webpack.utils");
@ -99,7 +100,7 @@ module.exports = [
output: getOutput("opera", config.devDirectory), output: getOutput("opera", config.devDirectory),
plugins: [ plugins: [
...getHTMLPlugins("opera", config.devDirectory, config.operaPath), ...getHTMLPlugins("opera", config.devDirectory, config.operaPath),
...getCopyPlugins("opera", config.devDirectory, config.operaPath) ...getOperaCopyPlugins("opera", config.devDirectory, config.operaPath)
] ]
}, },
{ {

View file

@ -10,6 +10,7 @@ const {
getOutput, getOutput,
getCopyPlugins, getCopyPlugins,
getZipPlugin, getZipPlugin,
getOperaCopyPlugins,
getFirefoxCopyPlugins, getFirefoxCopyPlugins,
getEntry getEntry
} = require("./webpack.utils"); } = require("./webpack.utils");
@ -110,7 +111,7 @@ module.exports = [
new CleanWebpackPlugin(["dist", "temp"]), new CleanWebpackPlugin(["dist", "temp"]),
new UglifyJsPlugin(), new UglifyJsPlugin(),
...getHTMLPlugins("opera", config.tempDirectory, config.operaPath), ...getHTMLPlugins("opera", config.tempDirectory, config.operaPath),
...getCopyPlugins("opera", config.tempDirectory, config.operaPath), ...getOperaCopyPlugins("opera", config.tempDirectory, config.operaPath),
getZipPlugin(`${config.extName}-for-opera-${extVersion}`, config.distDirectory) getZipPlugin(`${config.extName}-for-opera-${extVersion}`, config.distDirectory)
] ]
}, },

View file

@ -56,6 +56,23 @@ const getCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [
]) ])
]; ];
const getOperaCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [
new CopyWebpackPlugin([
{
from: `${sourceDir}/icons`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/icons`)
},
{
from: `${sourceDir}/_locales`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/_locales`)
},
{
from: `${sourceDir}/manifest-opera.json`,
to: path.resolve(__dirname, `${outputDir}/${browserDir}/manifest.json`)
}
])
];
const getFirefoxCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [ const getFirefoxCopyPlugins = (browserDir, outputDir = "dev", sourceDir = "src") => [
new CopyWebpackPlugin([ new CopyWebpackPlugin([
{ {
@ -93,6 +110,7 @@ module.exports = {
getHTMLPlugins, getHTMLPlugins,
getOutput, getOutput,
getCopyPlugins, getCopyPlugins,
getOperaCopyPlugins,
getFirefoxCopyPlugins, getFirefoxCopyPlugins,
getZipPlugin, getZipPlugin,
getEntry getEntry