Permalink
Browse files

Move extension manifest details into package.json to DRY things out

  • Loading branch information...
lmorchard committed Nov 13, 2017
1 parent f09e0a6 commit 0e47b0d3b444a5d25120f126dc15d978c1efc994
Showing with 70 additions and 44 deletions.
  1. +42 −3 package.json
  2. +0 −40 src/extension/manifest.json
  3. +28 −1 webpack.extension.js
View
@@ -1,8 +1,13 @@
{
"name": "themesrfun",
"description": "Theming demo for Firefox Quantum and beyond.",
"version": "0.0.1",
"description": "",
"main": "index.js",
"id": "themesrfun@mozilla.com",
"author": "Les Orchard <ma@lmorchard.com>",
"contributors": [
"John Gruen <john.gruen@gmail.com>"
],
"main": "src/web/index.js",
"scripts": {
"start": "npm-run-all --parallel server watch:extension",
"server": "NODE_ENV=development webpack-dev-server --config webpack.web.js",
@@ -20,7 +25,6 @@
"engines": {
"node": ">=6.2.0"
},
"author": "",
"license": "MPL2",
"devDependencies": {
"babel-core": "^6.26.0",
@@ -35,6 +39,7 @@
"css-loader": "^0.28.7",
"ejs": "^2.5.7",
"extract-text-webpack-plugin": "^3.0.2",
"generate-asset-webpack-plugin": "^0.3.0",
"html-webpack-plugin": "^2.30.1",
"image-webpack-loader": "^3.4.2",
"node-sass": "^4.6.1",
@@ -53,5 +58,39 @@
"dependencies": {
"react": "^16.1.0",
"react-dom": "^16.1.0"
},
"extensionManifest": {
"permissions": [
"theme",
"storage"
],
"browser_action": {
"browser_style": true,
"default_title": "ThemesRFun",
"default_icon": {
"32": "images/icon.svg"
}
},
"background": {
"scripts": ["background.js"]
},
"content_scripts": [
{
"js": ["contentScript.js"],
"matches": [
"*://localhost/*",
"https://*.mozilla.org/"
]
}
],
"icons": {
"48": "images/icon.svg",
"96": "images/icon.svg"
},
"applications": {
"gecko": {
"strict_min_version": "57.0a1"
}
}
}
}

This file was deleted.

Oops, something went wrong.
View
@@ -3,7 +3,9 @@ const webpack = require('webpack');
const merge = require('webpack-merge');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const GenerateAssetWebpackPlugin = require('generate-asset-webpack-plugin');
const packageMeta = require('./package.json');
const common = require('./webpack.common.js');
module.exports = merge(common, {
@@ -16,10 +18,35 @@ module.exports = merge(common, {
filename: '[name].js'
},
plugins: [
new GenerateAssetWebpackPlugin({
filename: 'manifest.json',
fn: buildManifest
}),
new CopyWebpackPlugin([
{ from: 'LICENSE' },
{ from: './src/extension/manifest.json' },
// { from: './src/extension/manifest.json' },
{ from: './src/images', to: 'images' }
])
]
});
function buildManifest(compilation, cb) {
const {
name,
version,
description,
author,
homepage,
extensionManifest
} = packageMeta;
console.log('dfooooo', packageMeta);
const manifest = Object.assign({}, extensionManifest, {
manifest_version: 2,
name,
version,
description,
author,
homepage_url: homepage
});
return cb(null, JSON.stringify(manifest, null, ' '));
}

0 comments on commit 0e47b0d

Please sign in to comment.