Nicer manifest merging

This commit is contained in:
Dima Gerasimov 2019-01-06 13:42:54 +00:00
parent 7dbc4652a6
commit 4b56d48f40
3 changed files with 17 additions and 13 deletions

View file

@ -28,7 +28,8 @@ npm run flow
* TODO [#B] docs on using * TODO [#B] docs on using
* TODO [#B] circleci? * TODO [#B] circleci?
* TODO [#D] nicer manifest? * DONE [#D] nicer manifest?
CLOSED: [2019-01-06 Sun 13:43]
* TODO [#D] do not minfy for dev * TODO [#D] do not minfy for dev
* TODO [#C] motivation * TODO [#C] motivation
* TODO [#B] doesn't look like hotkey working unless you manually rebind.. wtf? * TODO [#B] doesn't look like hotkey working unless you manually rebind.. wtf?

View file

@ -28,6 +28,7 @@
"webpack": "^4.28.3", "webpack": "^4.28.3",
"webpack-cli": "^3.2.0", "webpack-cli": "^3.2.0",
"webpack-dev-server": "^3.1.14", "webpack-dev-server": "^3.1.14",
"webpack-extension-manifest-plugin": "^0.4.3",
"write-file-webpack-plugin": "^4.5.0" "write-file-webpack-plugin": "^4.5.0"
}, },
"dependencies": { "dependencies": {

View file

@ -5,7 +5,11 @@ var webpack = require("webpack"),
CleanWebpackPlugin = require("clean-webpack-plugin"), CleanWebpackPlugin = require("clean-webpack-plugin"),
CopyWebpackPlugin = require("copy-webpack-plugin"), CopyWebpackPlugin = require("copy-webpack-plugin"),
HtmlWebpackPlugin = require("html-webpack-plugin"), HtmlWebpackPlugin = require("html-webpack-plugin"),
WriteFilePlugin = require("write-file-webpack-plugin"); WriteFilePlugin = require("write-file-webpack-plugin"),
WebpackExtensionManifestPlugin = require("webpack-extension-manifest-plugin");
const pkg = require('./package.json');
const baseManifest = require('./src/manifest.json');
// load the secrets // load the secrets
var alias = {}; var alias = {};
@ -65,17 +69,15 @@ var options = {
new webpack.DefinePlugin({ new webpack.DefinePlugin({
"process.env.NODE_ENV": JSON.stringify(env.NODE_ENV) "process.env.NODE_ENV": JSON.stringify(env.NODE_ENV)
}), }),
new CopyWebpackPlugin([{ new WebpackExtensionManifestPlugin({
from: "src/manifest.json", config: {
transform: function (content, path) { base: baseManifest,
// generates the manifest file using the package.json informations extend: {
return Buffer.from(JSON.stringify({ version: pkg.version,
description: process.env.npm_package_description, description: pkg.description,
version: process.env.npm_package_version,
...JSON.parse(content.toString())
}))
} }
}]), }
}),
new HtmlWebpackPlugin({ new HtmlWebpackPlugin({
template: path.join(__dirname, "src", "popup.html"), template: path.join(__dirname, "src", "popup.html"),
filename: "popup.html", filename: "popup.html",