-
Notifications
You must be signed in to change notification settings - Fork 18
Conversation
No functionality was changed here, just splitting it up to make it easy to work on.
Tools that don't end up bundle JS into a single output file can leave many source maps on the filesystem (e.g. Babel, TypeScript). The added --directory flag can be used to tell bugsnag-sourcemaps to search the filesystem from a given path and upload every source map that it finds.
It's not entirely clear which changes are the |
The commits are discreet chunks of work so you should be able to see from that? I can separate into a different PR if necessary. I've updated the PR description adding directions on how to test the new feature. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this looks good to me. The majority of the changes are moving methods from index.js
into discrete modules, with a few changes to use graceful-fs
over built-in fs
. The upload
-> uploadOne
and uploadMany
makes sense, as well as the options in the README and cli.js
(which make up the --directory
change.
I've also tested using the attached examples, and can confirm it works as described with both an empty --directory
option and with an explicit path there (i.e. --directory lib/
I've left one comment on the readme, and I think it could do with a couple of things, namely:
- Unit tests for the
upload
,uploadOne
, &uploadMany
(stubbingsendRequest
, how difficult would this be?) - README's for the example apps.
Co-Authored-By: Sachin Pande <[email protected]>
|
You are correct, I read it wrong initially. |
Added readmes for the examples. I do want to add unit tests but I wanted to get it queued up for review first. Will add tests on Monday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Furthering my previous review, LGTM and tests pass :)
Tools that don't end up bundle JS into a single output file can leave many source maps on the filesystem (e.g. Babel, TypeScript). The added
--directory
flag can be used to tell bugsnag-sourcemaps to search the filesystem from a given path and upload every source map that itfinds.
I made quite a substantial refactor to the library – splitting out the large
index.js
into smaller modules. Other than that – refactor-wise the scope of the changes were on a "needed to facilicate this new feature" basis.In order to make the listr module output a reasonable amount of information to the CLI user, it would have necessitated tighter coupling between the uploader and the CLI and a further substantial refactor, so I removed that and implemented a simple logger instead. For this reason the CLI UI will appear very different to users. This may be a concern, but I felt it necessary for the bulk upload to show more than this amount of information:
Bulk upload outputs this kind of info:
Errors look like this:
Testing
To facilitate manually testing the new mode I've added two kinds of Node project to the examples directory: TypeScript and Babel. As you'll see after running the build on each one, TypeScript creates a source map alongside each source/output file in the tree whereas Babel copies the
src
structure and mimics it in the outputlib
.TypeScript
Be sure to replace the API key in
examples/typescript/package.json
andexamples/typescript/src/services/bugsnag.ts
before you begin.Babel
Be sure to replace the API key in
examples/babel/package.json
andexamples/babel/src/services/bugsnag.js
before you begin.You can run the local developement
bugsnag-sourcemaps
command from either example using a relative path (per the package.json scripts):../../cli.js upload --api-key --overwrite
etc.With each project, you should be able to see errors in the dashboad being successfully symbolicated – showing the original stacktraces.