Skip to content

Instantly share code, notes, and snippets.

@padupuy
Created November 30, 2018 15:21
Show Gist options
  • Save padupuy/ee626048364c9eba67aa1987bb88432d to your computer and use it in GitHub Desktop.
Save padupuy/ee626048364c9eba67aa1987bb88432d to your computer and use it in GitHub Desktop.
Upload JS sourcemap files to sentry
[defaults]
url=https://sentry.yourcompany.com
project=yourproject
org=yourcompany
[auth]
token = yourtoken
const SentryCli = require('@sentry/cli');
const { version } = require('./package.json');
async function uploadSourceMaps() {
//default config file is read from ~/.sentryclirc
const cli = new SentryCli();
// Use the version defined in package.json or ask sentry for a new one
// const releaseVersion = await cli.releases.proposeVersion();
console.log('Proposed version:\n', version);
const options = {
debug: false,
include: ['./build/'],
urlPrefix: '~',
rewrite: true,
ignore: ['node_modules']
};
console.log('upload options:\n', options);
await cli.releases.new(version);
await cli.releases.uploadSourceMaps(version, options);
await cli.releases.finalize(version);
}
uploadSourceMaps();
@gonzofish
Copy link

nice snippet! helped me out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment