Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 18 additions & 26 deletions bin/update-bugsnag.js
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you run the script?

Copy link
Copy Markdown
Contributor Author

@ryancbahan ryancbahan Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Works as intended

ryan@Mac cli % node bin/update-bugsnag.js cli
Preparing @shopify/cli
Copying to temporary directory
Uploading to Bugsnag
Cleaning sourcemaps from @shopify/cli
[bugsnag-build-reporter] no source control info found (looked in package.json, .git, .hg)
[bugsnag-build-reporter] sending {
  apiKey: '******5e0fae',
  appVersion: '3.93.0',
  builderName: 'ryan',
  buildTool: 'bugsnag-build-reporter',
}
[bugsnag-build-reporter] build info sent
Build reported!
ryan@Mac cli %

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { fileURLToPath } from 'url';
import { node } from "@bugsnag/source-maps";
import reportBuild from 'bugsnag-build-reporter';
import glob from 'fast-glob';
import tmp from 'tmp';
import os from 'os';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
Expand All @@ -27,34 +27,26 @@ if (!packageName) {

console.log(`Preparing @shopify/${packageName}`);

await new Promise((resolve, reject) => {
tmp.dir({unsafeCleanup: true}, async (err, temporaryDirectory) => {
if (err) {
reject(err);
}
try {
const temporaryShopifyPackage = await fsPromise.mkdir(path.join(temporaryDirectory, '@shopify'), { recursive: true});
const temporaryPackageCopy = await fsPromise.mkdir(path.join(temporaryShopifyPackage, `${packageName}`), { recursive: true });
const temporaryDirectory = await fsPromise.mkdtemp(path.join(os.tmpdir(), 'bugsnag-'));
try {
const temporaryShopifyPackage = await fsPromise.mkdir(path.join(temporaryDirectory, '@shopify'), { recursive: true});
const temporaryPackageCopy = await fsPromise.mkdir(path.join(temporaryShopifyPackage, `${packageName}`), { recursive: true });

console.log('Copying to temporary directory');
fs.cpSync(sourceDirectory, temporaryPackageCopy, {recursive: true});
console.log('Copying to temporary directory');
fs.cpSync(sourceDirectory, temporaryPackageCopy, {recursive: true});

console.log('Uploading to Bugsnag');
process.chdir(temporaryDirectory);
await node.uploadMultiple({
apiKey,
appVersion,
overwrite: true,
directory: '.',
endpoint: 'https://error-analytics-production.shopifysvc.com/api/v1/sourcemap/browser'
});

resolve();
} catch (e) {
reject(e);
}
console.log('Uploading to Bugsnag');
process.chdir(temporaryDirectory);
await node.uploadMultiple({
apiKey,
appVersion,
overwrite: true,
directory: '.',
endpoint: 'https://error-analytics-production.shopifysvc.com/api/v1/sourcemap/browser'
});
});
} finally {
await fsPromise.rm(temporaryDirectory, {recursive: true, force: true});
}

console.log(`Cleaning sourcemaps from @shopify/${packageName}`);

Expand Down
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@shopify/eslint-plugin-cli": "file:packages/eslint-plugin-cli",
"@shopify/generate-docs": "0.15.6",
"@types/node": "18.19.70",
"@types/tmp": "^0.2.5",
"@typescript-eslint/parser": "8.56.1",
"@vitest/coverage-istanbul": "^3.1.4",
"ansi-colors": "^4.1.3",
Expand All @@ -75,7 +74,6 @@
"pathe": "1.1.1",
"pin-github-action": "^3.3.1",
"rimraf": "^6.1.3",
"tmp": "^0.2.5",
"ts-node": "^10.9.1",
"typescript": "5.9.3",
"vitest": "^3.1.4",
Expand Down
11 changes: 0 additions & 11 deletions pnpm-lock.yaml

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

Loading