Skip to content

Commit dbfaf4c

Browse files
committed
Improve help output.
1 parent e708c2a commit dbfaf4c

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

packages/remix/scripts/upload-sourcemaps.js

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
#! /usr/bin/env node
22
const SentryCli = require('@sentry/cli');
3-
const argv = require('yargs/yargs')(process.argv.slice(2))
4-
.option('release', { type: 'string', describe: 'The release number' })
5-
.option('urlPrefix', { type: 'string', describe: 'The url prefix for the sourcemaps' })
6-
.option('buildPath', { type: 'string', describe: 'The path to the build directory' })
3+
const yargs = require('yargs/yargs');
4+
5+
const DEFAULT_URL_PREFIX = '~/build/';
6+
const DEFAULT_BUILD_PATH = 'public/build';
7+
8+
const argv = yargs(process.argv.slice(2))
9+
.option('release', {
10+
type: 'string',
11+
describe:
12+
'The release number\n' +
13+
"If not provided, a new release id will be determined by Sentry CLI's `propose-version`.\n" +
14+
'See: https://docs.sentry.io/product/releases/suspect-commits/#using-the-cli\n',
15+
})
16+
.option('urlPrefix', {
17+
type: 'string',
18+
describe: 'URL prefix to add to the beginning of all filenames',
19+
default: DEFAULT_URL_PREFIX,
20+
})
21+
.option('buildPath', {
22+
type: 'string',
23+
describe: 'The path to the build directory',
24+
default: DEFAULT_BUILD_PATH,
25+
})
726
.usage(
8-
'Usage: $0 [--release RELEASE] [--urlPrefix URL_PREFIX] [--buildPath BUILD_PATH] \n\n' +
27+
'Usage: $0\n' +
28+
' [--release RELEASE]\n' +
29+
' [--urlPrefix URL_PREFIX]\n' +
30+
' [--buildPath BUILD_PATH]\n\n' +
31+
'This CLI tool will upload sourcemaps to Sentry for the given release.\n' +
32+
'It has defaults for URL prefix and build path for Remix builds, but you can override them.\n\n' +
933
'If you need a more advanced configuration, you can use `sentry-cli` instead.\n' +
1034
'https://github.com/getsentry/sentry-cli',
11-
).argv;
35+
)
36+
.wrap(120).argv;
1237

1338
const sentry = new SentryCli();
1439

1540
async function createRelease() {
1641
const RELEASE = argv.release || (await sentry.releases.proposeVersion());
17-
const URL_PREFIX = argv.urlPrefix || '~/build/';
18-
const BUILD_PATH = argv.buildPath || 'public/build';
42+
const URL_PREFIX = argv.urlPrefix || DEFAULT_URL_PREFIX;
43+
const BUILD_PATH = argv.buildPath || DEFAULT_BUILD_PATH;
1944

2045
await sentry.releases.new(RELEASE);
2146

0 commit comments

Comments
 (0)