From 47e2f116e28d1874f6ef3428b643be0a3b86f4d7 Mon Sep 17 00:00:00 2001 From: sienori Date: Sun, 24 Feb 2019 03:35:42 +0900 Subject: [PATCH] Update build of opera --- src/manifest-opera.json | 67 +++++++++++++++++++++++++++++++++++++++++ webpack.config.dev.js | 3 +- webpack.config.dist.js | 3 +- webpack.utils.js | 18 +++++++++++ 4 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 src/manifest-opera.json diff --git a/src/manifest-opera.json b/src/manifest-opera.json new file mode 100644 index 0000000..c80e70b --- /dev/null +++ b/src/manifest-opera.json @@ -0,0 +1,67 @@ +{ + "manifest_version": 2, + "version": "2.0.0", + + "name": "__MSG_extName__", + "description": "__MSG_extDescription__", + "default_locale": "en", + + "permissions": ["", "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://*/*", ""], + "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__" + } + } +} diff --git a/webpack.config.dev.js b/webpack.config.dev.js index bbcc11f..5efcb4e 100644 --- a/webpack.config.dev.js +++ b/webpack.config.dev.js @@ -7,6 +7,7 @@ const { getHTMLPlugins, getOutput, getCopyPlugins, + getOperaCopyPlugins, getFirefoxCopyPlugins, getEntry } = require("./webpack.utils"); @@ -99,7 +100,7 @@ module.exports = [ output: getOutput("opera", config.devDirectory), plugins: [ ...getHTMLPlugins("opera", config.devDirectory, config.operaPath), - ...getCopyPlugins("opera", config.devDirectory, config.operaPath) + ...getOperaCopyPlugins("opera", config.devDirectory, config.operaPath) ] }, { diff --git a/webpack.config.dist.js b/webpack.config.dist.js index 1a6520a..4b3475c 100644 --- a/webpack.config.dist.js +++ b/webpack.config.dist.js @@ -10,6 +10,7 @@ const { getOutput, getCopyPlugins, getZipPlugin, + getOperaCopyPlugins, getFirefoxCopyPlugins, getEntry } = require("./webpack.utils"); @@ -110,7 +111,7 @@ module.exports = [ new CleanWebpackPlugin(["dist", "temp"]), new UglifyJsPlugin(), ...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) ] }, diff --git a/webpack.utils.js b/webpack.utils.js index b346f84..03b09aa 100644 --- a/webpack.utils.js +++ b/webpack.utils.js @@ -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") => [ new CopyWebpackPlugin([ { @@ -93,6 +110,7 @@ module.exports = { getHTMLPlugins, getOutput, getCopyPlugins, + getOperaCopyPlugins, getFirefoxCopyPlugins, getZipPlugin, getEntry