Skip to content

Commit

Permalink
调整发布脚本,添加 zip 打包
Browse files Browse the repository at this point in the history
  • Loading branch information
OpportunityLiu committed Sep 20, 2019
1 parent 1b4582f commit b6da214
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 10 deletions.
19 changes: 19 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"main": "syringe.js",
"scripts": {
"test": "echo Error: no test specified && exit 1",
"start": "webpack --mode=development --watch",
"webpack": "webpack",
"start": "npm run dev:chrome",
"dev:chrome": "webpack --mode=development --watch",
"dev:firefox": "webpack --mode=development --watch --firefox",
"dev:android": "webpack --mode=development --watch --android",
"build": "webpack --mode=production --crx --no-db",
"build": "webpack --mode=production --pack",
"web-ext": "web-ext",
"update-db": "node ./tools/update-db.js"
},
Expand Down Expand Up @@ -46,7 +47,8 @@
"web-ext": "^3.1.1",
"webext-webpack-plugin": "^0.0.8",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.9"
"webpack-cli": "^3.3.9",
"zip-webpack-plugin": "^3.0.0"
},
"dependencies": {
"emoji-regex": "^8.0.0",
Expand Down
21 changes: 14 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const path = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const { WebExtWebpackPlugin } = require('webext-webpack-plugin');
const ZipPlugin = require('zip-webpack-plugin');
const CrxPlugin = require("./crx-packet");

const plugins = [];
const Crx = require("./crx-packet");

const crx = process.argv.indexOf('--crx') > 0;
const pack = process.argv.indexOf('--pack') > 0;
const firefox = process.argv.indexOf('--firefox') > 0;
const android = process.argv.indexOf('--android') > 0;
const nodb = process.argv.indexOf('--no-db') > 0;
Expand All @@ -29,15 +31,20 @@ if (firefox || android) {
)
}

if(crx){
if (pack) {
plugins.push(
new ZipPlugin({
path: path.resolve(__dirname, 'release'),
pathPrefix: 'EhSyringe',
filename: 'EhSyringe'
}));
plugins.push(
new Crx({
new CrxPlugin({
key: 'key.pem',
src: 'dist',
dest: 'release',
name: 'EhSyringe'
})
)
}));
}

const copyPatterns = [
Expand All @@ -61,7 +68,7 @@ const copyPatterns = [
if (nodb) {
copyPatterns.push({
from: 'tools/tag-empty.db', to: 'assets/tag.db'
})
});
}

module.exports = {
Expand Down

0 comments on commit b6da214

Please sign in to comment.