Skip to content

Commit

Permalink
fix: make node-dump-syms optional
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbyg603 committed Mar 20, 2024
1 parent 767b61d commit 3b27cea
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
18 changes: 11 additions & 7 deletions bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { ApiClient, BugSplatApiClient, OAuthClientCredentialsClient, VersionsApi
import commandLineArgs, { CommandLineOptions } from 'command-line-args';
import commandLineUsage from 'command-line-usage';
import { glob } from 'glob';
import { dumpSyms as nodeDumpSyms } from 'node-dump-syms';
import { existsSync } from 'node:fs';
import { mkdir, readFile, stat } from 'node:fs/promises';
import { basename, join } from 'node:path';
Expand Down Expand Up @@ -109,12 +108,17 @@ import { CommandLineDefinition, argDefinitions, usageDefinitions } from './comma
console.log(`Found files:\n ${symbolFilePaths.join('\n')}`);

if (dumpSyms) {
symbolFilePaths = symbolFilePaths.map(file => {
console.log(`Dumping syms for ${file}...`);
const symFile = join(tmpDir, `${basename(file)}.sym`);
nodeDumpSyms(file, symFile);
return symFile;
});
try {
const nodeDumpSyms = (await import('node-dump-syms')).dumpSyms;
symbolFilePaths = symbolFilePaths.map(file => {
console.log(`Dumping syms for ${file}...`);
const symFile = join(tmpDir, `${basename(file)}.sym`);
nodeDumpSyms(file, symFile);
return symFile;
});
} catch (error) {
console.log('node-dump-syms not found, skipping sym dumping...');
}
}

await uploadSymbolFiles(bugsplat, database, application, version, directory, symbolFilePaths);
Expand Down
16 changes: 16 additions & 0 deletions package-lock.json

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

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
"outputPath": "./pkg",
"compress": "GZip",
"assets": [
"package.json"
"package.json",
"node_modules/node-dump-syms/dist/native/index.addon"
]
},
"devDependencies": {
Expand Down Expand Up @@ -91,5 +92,8 @@
"promise-retry": "^2.0.1",
"rxjs": "^7.8.1",
"workerpool": "^6.5.1"
},
"optionalDependencies": {
"node-dump-syms": "^3.0.6"
}
}

0 comments on commit 3b27cea

Please sign in to comment.