From 4b0739cdb2b0e77bbfe541a30e1e6f9d6fb5c977 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 1 Jul 2025 17:20:18 +0100 Subject: [PATCH 1/4] ensure we pass metadata to the CLI correctly --- build-reporter-plugin.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build-reporter-plugin.js b/build-reporter-plugin.js index c1aaf17..0e4abf8 100644 --- a/build-reporter-plugin.js +++ b/build-reporter-plugin.js @@ -62,12 +62,16 @@ class BugsnagBuildReporterPlugin { const optionalOpts = { autoAssignRelease: opts.build.autoAssignRelease, builderName: opts.build.builderName, - metadata: opts.build.metadata, + metadata: '{' + + Object.entries(opts.build.metadata) + .map(([key, value]) => `${key}=${value}`) + .join(',') + + '}', provider: opts.build.sourceControl.provider, repository: opts.build.sourceControl.repository, revision: opts.build.sourceControl.revision, releaseStage: opts.build.releaseStage, - buildApiRootUrl: opts.build.endpoint, + buildApiRootUrl: opts.build.endpoint || opts.options.endpoint, logLevel: opts.build.logLevel || opts.options.logLevel, dryRun: opts.build.dryRun || opts.options.dryRun, verbose: opts.build.verbose || opts.options.verbose, From 713746d764f44f8c38f94fe4a65dab7bf12eaf69 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 2 Jul 2025 17:14:18 +0100 Subject: [PATCH 2/4] update tests for cli metadata --- build-reporter-plugin.js | 8 +++----- test/build-reporter-plugin.test.mjs | 3 ++- test/fixtures/a/webpack.config.js | 6 +++++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build-reporter-plugin.js b/build-reporter-plugin.js index 0e4abf8..f1e416b 100644 --- a/build-reporter-plugin.js +++ b/build-reporter-plugin.js @@ -62,11 +62,9 @@ class BugsnagBuildReporterPlugin { const optionalOpts = { autoAssignRelease: opts.build.autoAssignRelease, builderName: opts.build.builderName, - metadata: '{' + - Object.entries(opts.build.metadata) - .map(([key, value]) => `${key}=${value}`) - .join(',') + - '}', + metadata: Object.entries(opts.build.metadata) + .map(([key, value]) => `${key}=${value}`) + .join(','), provider: opts.build.sourceControl.provider, repository: opts.build.sourceControl.repository, revision: opts.build.sourceControl.revision, diff --git a/test/build-reporter-plugin.test.mjs b/test/build-reporter-plugin.test.mjs index 58f0bc5..e72d1f0 100644 --- a/test/build-reporter-plugin.test.mjs +++ b/test/build-reporter-plugin.test.mjs @@ -21,7 +21,7 @@ test('BugsnagBuildReporterPlugin', t => { }) test('it sends upon successful build', t => { - t.plan(3) + t.plan(4) const server = createServer((req, res) => { let body = '' req.on('data', (d) => { body += d }) @@ -37,6 +37,7 @@ test('it sends upon successful build', t => { t.ok(j, 'json body was received') t.equal(j.appVersion, '1.2.3', 'body should contain app version') t.equal(j.apiKey, 'YOUR_API_KEY', 'body should contain api key') + t.same(j.metadata, { foo: 'bar', baz: 'qux' }, 'body should contain correct metadata') }) }) server.listen() diff --git a/test/fixtures/a/webpack.config.js b/test/fixtures/a/webpack.config.js index e673c14..bf111e5 100644 --- a/test/fixtures/a/webpack.config.js +++ b/test/fixtures/a/webpack.config.js @@ -10,7 +10,11 @@ module.exports = { new BugsnagBuildReporterPlugin({ apiKey: 'YOUR_API_KEY', appVersion: '1.2.3', - endpoint: `http://localhost:${process.env.PORT}` + endpoint: `http://localhost:${process.env.PORT}`, + metadata: { + foo: 'bar', + baz: 'qux' + } }) ] } From 6e5087c09b41b72015eed12154e82a36b907a911 Mon Sep 17 00:00:00 2001 From: Josh Date: Wed, 2 Jul 2025 17:17:15 +0100 Subject: [PATCH 3/4] add changelog entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a56d40..043bb0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [2.2.2] - 2025-07-02 + +- Ensure that we correctly pass the metadata the BugSnag CLI create build command (#100) + ## [2.2.1] - 2025-05-27 - Ensure we expose all options in the Webpack plugin that are available in the Bugsnag CLI (#99) From 8ea2cafcf0ff880c59a1e35183df0df45e904b50 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 3 Jul 2025 08:24:22 +0100 Subject: [PATCH 4/4] bump date for release --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 043bb0a..da09f6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [2.2.2] - 2025-07-02 +## [2.2.2] - 2025-07-03 - Ensure that we correctly pass the metadata the BugSnag CLI create build command (#100)