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] circleci?
* TODO [#D] nicer manifest?
* DONE [#D] nicer manifest?
CLOSED: [2019-01-06 Sun 13:43]
* TODO [#D] do not minfy for dev
* TODO [#C] motivation
* TODO [#B] doesn't look like hotkey working unless you manually rebind.. wtf?

View file

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

View file

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