Skip to content

Commit f134b5d

Browse files
committed
feat(remix): Add release / sourcemap upload script.
1 parent f15fb00 commit f134b5d

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

packages/remix/package.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/remix",
77
"author": "Sentry",
88
"license": "MIT",
9+
"bin": {
10+
"sentry-upload-sourcemaps": "scripts/upload-sourcemaps.js"
11+
},
912
"engines": {
1013
"node": ">=14"
1114
},
@@ -28,19 +31,12 @@
2831
},
2932
"devDependencies": {
3033
"@remix-run/node": "^1.4.3",
31-
"@remix-run/react": "^1.4.3",
32-
"@types/webpack": "^4.41.31"
34+
"@remix-run/react": "^1.4.3"
3335
},
3436
"peerDependencies": {
3537
"@remix-run/node": "^1.4.3",
3638
"@remix-run/react": "^1.4.3",
37-
"react": "16.x || 17.x || 18.x",
38-
"webpack": ">=4.0.0"
39-
},
40-
"peerDependenciesMeta": {
41-
"webpack": {
42-
"optional": true
43-
}
39+
"react": "16.x || 17.x || 18.x"
4440
},
4541
"scripts": {
4642
"build": "run-p build:rollup build:types",
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#! /usr/bin/env node
2+
/* eslint-disable no-console */
3+
const SentryCli = require('@sentry/cli');
4+
const argv = require('yargs/yargs')(process.argv.slice(2))
5+
.option('release', { type: 'string', describe: 'The release number', demandOption: true })
6+
.option('urlPrefix', { type: 'string', describe: 'The url prefix for the sourcemaps' })
7+
.option('buildPath', { type: 'string', describe: 'The path to the build directory' })
8+
.usage('Usage: $0 --release RELEASE [--urlPrefix URL_PREFIX] [--buildPath BUILD_PATH]').argv;
9+
10+
const RELEASE = argv.release;
11+
12+
if (!RELEASE) {
13+
console.error('No release provided.');
14+
process.exit(1);
15+
}
16+
17+
const URL_PREFIX = argv.urlPrefix || '~/build/';
18+
const BUILD_PATH = argv.buildPath || 'public/build';
19+
20+
const sentry = new SentryCli();
21+
22+
async function createRelease() {
23+
await sentry.releases.new(RELEASE);
24+
25+
await sentry.releases.uploadSourceMaps(RELEASE, {
26+
urlPrefix: URL_PREFIX,
27+
include: [BUILD_PATH],
28+
});
29+
30+
await sentry.releases.finalize(RELEASE);
31+
}
32+
33+
createRelease();

0 commit comments

Comments
 (0)