Update configuration for local builds
This commit is contained in:
parent
22ac8f4984
commit
76422d7343
2
.env.example
Normal file
2
.env.example
Normal file
@ -0,0 +1,2 @@
|
||||
BUGSNAG_API_KEY=
|
||||
APPLICATION_ID=
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
node_modules/
|
||||
build/
|
||||
.env
|
||||
|
14
package.json
14
package.json
@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "moco-browser-extensions",
|
||||
"description": "Browser plugin for MOCO",
|
||||
"version": "1.0.19",
|
||||
"version": "1.0.20",
|
||||
"scripts": {
|
||||
"start": "yarn start:chrome",
|
||||
"start:chrome": "node_modules/.bin/webpack --config webpack.chrome.config.js --watch --env.browser chrome --env.NODE_ENV development",
|
||||
"start:firefox": "node_modules/.bin/webpack --config webpack.firefox.config.js --watch --env.browser firefox --env.NODE_ENV development",
|
||||
"zip:chrome": "zip -r build/chrome/moco-bx-source.zip . -x .git/\\* build/\\* node_modules/\\* test/\\* .DS_Store",
|
||||
"zip:firefox": "zip -r build/firefox/moco-bx-source.zip . -x .git/\\* build/\\* node_modules/\\* test/\\* .DS_Store",
|
||||
"build:chrome": "node_modules/.bin/webpack -p --config webpack.chrome.config.js --env.browser chrome --env.NODE_ENV production && yarn zip:chrome",
|
||||
"build:firefox": "node_modules/.bin/webpack -p --config webpack.firefox.config.js --env.browser firefox --env.NODE_ENV production && yarn zip:firefox",
|
||||
"build": "yarn run build:firefox && yarn run build:chrome",
|
||||
"zip:chrome": "zip -qr build/chrome/moco-bx-source.zip . -x .git/\\* build/\\* node_modules/\\* test/\\* .DS_Store",
|
||||
"zip:firefox": "zip -qr build/firefox/moco-bx-source.zip . -x .git/\\* build/\\* node_modules/\\* test/\\* .DS_Store",
|
||||
"build:chrome": "node_modules/.bin/webpack -p --config webpack.chrome.config.js --env.browser chrome --env.NODE_ENV production",
|
||||
"build:firefox": "node_modules/.bin/webpack -p --config webpack.firefox.config.js --env.browser firefox --env.NODE_ENV production",
|
||||
"build": "yarn build:firefox && yarn zip:firefox && yarn build:chrome && yarn zip:chrome",
|
||||
"test": "node_modules/.bin/jest",
|
||||
"test:watch": "node_modules/.bin/jest --watch"
|
||||
},
|
||||
@ -20,6 +20,7 @@
|
||||
"axios": "^0.18.0",
|
||||
"classnames": "^2.2.6",
|
||||
"date-fns": "^1.30.1",
|
||||
"dotenv": "^7.0.0",
|
||||
"lodash": "^4.17.11",
|
||||
"mobx": "^5.5.0",
|
||||
"mobx-react": "^5.2.8",
|
||||
@ -56,6 +57,7 @@
|
||||
"prettier": "^1.16.4",
|
||||
"sass-loader": "^7.1.0",
|
||||
"style-loader": "^0.23.1",
|
||||
"uuid": "^3.3.2",
|
||||
"webpack": "^4.15.0",
|
||||
"webpack-bugsnag-plugins": "^1.3.0",
|
||||
"webpack-cli": "^3.0.8",
|
||||
|
@ -25,7 +25,7 @@ const filterReport = report => {
|
||||
}
|
||||
|
||||
const bugsnagClient = bugsnag({
|
||||
apiKey: "da6caac4af70af3e4683454b40fe5ef5",
|
||||
apiKey: process.env.BUGSNAG_API_KEY,
|
||||
appVersion: getAppVersion(),
|
||||
collectUserIp: false,
|
||||
beforeSend: filterReport,
|
||||
|
@ -1,3 +1,5 @@
|
||||
require("dotenv").config()
|
||||
|
||||
const path = require("path")
|
||||
const webpack = require("webpack")
|
||||
const CleanWebpackPlugin = require("clean-webpack-plugin")
|
||||
@ -60,7 +62,10 @@ module.exports = env => {
|
||||
plugins: [
|
||||
new CleanWebpackPlugin([`build/${env.browser}`]),
|
||||
new webpack.DefinePlugin({
|
||||
"process.env.NODE_ENV": JSON.stringify(env.NODE_ENV)
|
||||
"process.env.NODE_ENV": JSON.stringify(env.NODE_ENV),
|
||||
"process.env.BUGSNAG_API_KEY": JSON.stringify(
|
||||
process.env.BUGSNAG_API_KEY
|
||||
)
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: "[name].css",
|
||||
@ -95,22 +100,27 @@ module.exports = env => {
|
||||
if (env.NODE_ENV === "production") {
|
||||
config.devtool = "source-maps"
|
||||
|
||||
if (process.env.BUGSNAG_API_KEY) {
|
||||
config.plugins.push(
|
||||
new BugsnagBuildReporterPlugin({
|
||||
apiKey: process.env.BUGSNAG_API_KEY,
|
||||
appVersion: process.env.npm_package_version,
|
||||
releaseStage: "production"
|
||||
}),
|
||||
// important: upload sourcemaps before removing source mapping url
|
||||
new BugsnagSourceMapUploaderPlugin({
|
||||
apiKey: process.env.BUGSNAG_API_KEY,
|
||||
appVersion: process.env.npm_package_version,
|
||||
publicPath:
|
||||
env.browser === "firefox"
|
||||
? "moz-extension*://*/"
|
||||
: "chrome-extension*://*/", // extra asterisk after protocol needed
|
||||
overwrite: true
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
config.plugins.push(
|
||||
new BugsnagBuildReporterPlugin({
|
||||
apiKey: "da6caac4af70af3e4683454b40fe5ef5",
|
||||
appVersion: process.env.npm_package_version,
|
||||
releaseStage: "production"
|
||||
}),
|
||||
// important: upload sourcemaps before removing source mapping url
|
||||
new BugsnagSourceMapUploaderPlugin({
|
||||
apiKey: "da6caac4af70af3e4683454b40fe5ef5",
|
||||
appVersion: process.env.npm_package_version,
|
||||
publicPath:
|
||||
env.browser === "firefox"
|
||||
? "moz-extension*://*/"
|
||||
: "chrome-extension*://*/", // extra asterisk after protocol needed
|
||||
overwrite: true
|
||||
}),
|
||||
new RemoveSourceMapPlugin(),
|
||||
new ZipPlugin({
|
||||
filename: `moco-bx-${env.browser}-v${
|
||||
|
@ -1,3 +1,4 @@
|
||||
const uuidv4 = require("uuid/v4")
|
||||
const CopyWebpackPlugin = require("copy-webpack-plugin")
|
||||
const { compact } = require("lodash/fp")
|
||||
|
||||
@ -30,7 +31,9 @@ module.exports = env => {
|
||||
browser_style: true
|
||||
},
|
||||
browser_specific_settings: {
|
||||
gecko: { id: "browser-extension@mocoapp.com" }
|
||||
gecko: {
|
||||
id: process.env.APPLICATION_ID || `{${uuidv4()}}`
|
||||
}
|
||||
},
|
||||
description: process.env.npm_package_description,
|
||||
version: process.env.npm_package_version
|
||||
|
@ -2437,6 +2437,11 @@ domutils@1.5.1:
|
||||
dom-serializer "0"
|
||||
domelementtype "1"
|
||||
|
||||
dotenv@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-7.0.0.tgz#a2be3cd52736673206e8a85fb5210eea29628e7c"
|
||||
integrity sha512-M3NhsLbV1i6HuGzBUH8vXrtxOk+tWmzWKDMbAVSUp3Zsjm7ywFeuwrUXhmhQyRK1q5B5GGy7hcXPbj3bnfZg2g==
|
||||
|
||||
duplexify@^3.4.2, duplexify@^3.6.0:
|
||||
version "3.7.1"
|
||||
resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309"
|
||||
|
Loading…
x
Reference in New Issue
Block a user