Skip to content

Commit

Permalink
chore: Try adding bugsnag build plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
birtles committed Mar 1, 2021
1 parent ca51b4d commit a2eda62
Show file tree
Hide file tree
Showing 4 changed files with 447 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ jobs:
run: yarn install --frozen-lockfile

- name: Build assets
env:
RELEASE_BUILD: 1
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
run: |
yarn package
yarn package:chrome
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"web-ext-types": "github:michael-zapata/web-ext-types",
"web-ext-webpack-plugin": "github:birtles/web-ext-webpack-plugin",
"webpack": "^5.23.0",
"webpack-bugsnag-plugins": "^1.6.0",
"webpack-cli": "^4.5.0",
"webpack-preprocessor": "^0.1.12",
"yargs": "^16.2.0"
Expand Down
28 changes: 28 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const WebExtWebpackPlugin = require('web-ext-webpack-plugin');
const {
BugsnagBuildReporterPlugin,
BugsnagSourceMapUploaderPlugin,
} = require('webpack-bugsnag-plugins');
const pjson = require('./package.json');

// Look for an --env arguments to pass along when running Firefox
const env = Object.fromEntries(
Expand Down Expand Up @@ -113,6 +118,29 @@ const firefoxConfig = {
],
};

if (process.env.RELEASE_BUILD && process.env.BUGSNAG_API_KEY) {
firefoxConfig.plugins.push(
new BugsnagBuildReporterPlugin(
{
apiKey: process.env.BUGSNAG_API_KEY,
appVersion: pjson.version,
},
{}
)
);
firefoxConfig.plugins.push(
new BugsnagSourceMapUploaderPlugin(
{
apiKey: process.env.BUGSNAG_API_KEY,
ignoredBundleExtensions: ['.css', '.json', '.idx', '.svg', '.html'],
publicPath: `https://github.com/birtles/rikaichamp/releases/download/v${pjson.version}/`,
overwrite: true,
},
{}
)
);
}

const chromeConfig = {
...commonExtConfig,
module: {
Expand Down
Loading

0 comments on commit a2eda62

Please sign in to comment.