-const chalk = require('chalk')
-const webpack = require('webpack')
-const merge = require('webpack-merge')
-const Crx = require("crx-webpack-plugin")
-const generatePem = require('./generate-pem')
-const prodConf = require('./webpack.prod.conf')
-const crxConf = require('./crx-conf')
+const fs = require("fs");
+const chalk = require("chalk");
+const webpack = require("webpack");
+const Crx = require("crx");
+const merge = require("webpack-merge");
+// const Crx = require("crx-webpack-plugin")
+const generatePem = require("./generate-pem");
+const prodConf = require("./webpack.prod.conf");
+const crxConf = require("./crx-conf");
+const { resolve } = require("./util");
-generatePem(crxConf.keyPath).then(info => {
- console.log(chalk.green(info))
- const conf = merge(prodConf, {
- plugins: [
- new Crx({
- keyFile: crxConf.keyPath,
- contentPath: crxConf.contentPath,
- outputPath: crxConf.outputPath,
- name: crxConf.name
- })
- ]
- })
- webpack(conf, (err, stats) => {
- if (err) throw err
- process.stdout.write(stats.toString({
+webpack(prodConf, (err, stats) => {
+ if (err) throw err;
+ process.stdout.write(
+ stats.toString({
colors: true,
modules: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
chunks: false,
chunkModules: false
- }) + '\n\n')
+ }) + "\n\n"
+ );
- if (stats.hasErrors()) {
- console.log(chalk.red(' Build failed with errors.\n'))
- process.exit(1)
- }
+ if (stats.hasErrors()) {
+ console.log(chalk.red(" Build failed with errors.\n"));
+ process.exit(1);
+ }
- console.log(chalk.cyan(' Build complete.\n'))
- })
-}).catch(err => {
- console.log(chalk.red(err))
-})
+ console.log(chalk.cyan(" Crx building. \n"));
+
+ // const crx = new Crx({
+ // codebase: "http://localhost:8000/chrome-ext.crx",
+ // privateKey: fs.readFileSync(crxConf.keyPath)
+ // });
+ // crx
+ // .load(crxConf.contentPath)
+ // .then(crx => crx.pack())
+ // .then(crxBuffer => {
+ // const updateXML = crx.generateUpdateXML();
+ // return Promise.all([
+ // fs.promises.writeFile(resolve("./dist/updates.xml"), updateXML),
+ // fs.promises.writeFile(resolve("./dist/byone.crx"), crxBuffer)
+ // ]);
+ // })
+ // .then(() => {
+ // console.log(chalk.cyan(" Crx Build complete.\n"));
+ // })
+ // .catch(err => {
+ // console.log(chalk.red(" Crx build failed.\n"));
+ // console.log(err);
+ // });
+});
+++ /dev/null
-module.exports = {
- manifest_version: 2,
- name: 'Byone',
- description: 'Bytom Wallet Chrome extension.',
- version: '3.0.8',
- author: 'Bytom frontend, zhitinglin',
- web_accessible_resources: ['js/inject.js'],
- browser_action: {
- default_popup: 'pages/popup.html',
- default_icon: 'icons/logo.png'
- },
- icons: {
- '16': 'icons/logo.png',
- '48': 'icons/logo.png',
- '128': 'icons/logo.png'
- },
- permissions: [
- '*://*/',
- 'storage',
- "unlimitedStorage",
- 'contextMenus',
- 'clipboardWrite',
- 'clipboardRead',
- 'background'
- ],
- content_security_policy: "script-src 'self' 'unsafe-eval' https://www.google-analytics.com/analytics.js; object-src 'self'",
- content_scripts: [
- {
- js: ['js/content.js'],
- run_at: 'document_end',
- matches: ['<all_urls>'],
- all_frames: true
- }
- ],
- background: {
- scripts: ['js/background.js']
- }
-}
--- /dev/null
+{
+ "manifest_version": 2,
+ "name": "Byone",
+ "description": "Bytom Wallet Chrome extension.",
+ "version": "3.0.9",
+ "author": "Bytom frontend, zhitinglin",
+ "web_accessible_resources": ["js/inject.js"],
+ "browser_action": {
+ "default_popup": "pages/popup.html",
+ "default_icon": "icons/logo.png"
+ },
+ "icons": {
+ "16": "icons/logo.png",
+ "48": "icons/logo.png",
+ "128": "icons/logo.png"
+ },
+ "permissions": [
+ "*://*/",
+ "storage",
+ "unlimitedStorage",
+ "contextMenus",
+ "clipboardWrite",
+ "clipboardRead",
+ "background"
+ ],
+ "content_security_policy": "script-src 'self' 'unsafe-eval' https://www.google-analytics.com/analytics.js; object-src 'self'",
+ "content_scripts": [
+ {
+ "js": ["js/content.js"],
+ "run_at": "document_end",
+ "matches": ["<all_urls>"],
+ "all_frames": true
+ }
+ ],
+ "background": {
+ "scripts": ["js/background.js"]
+ }
+}