|
1 | 1 | #! /usr/bin/env node
|
2 |
| -/* eslint-disable no-console */ |
3 | 2 | const SentryCli = require('@sentry/cli');
|
4 | 3 | const argv = require('yargs/yargs')(process.argv.slice(2))
|
5 |
| - .option('release', { type: 'string', describe: 'The release number', demandOption: true }) |
| 4 | + .option('release', { type: 'string', describe: 'The release number' }) |
6 | 5 | .option('urlPrefix', { type: 'string', describe: 'The url prefix for the sourcemaps' })
|
7 | 6 | .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'; |
| 7 | + .usage( |
| 8 | + 'Usage: $0 [--release RELEASE] [--urlPrefix URL_PREFIX] [--buildPath BUILD_PATH] \n\n' + |
| 9 | + 'If you need a more advanced configuration, you can use `sentry-cli` instead.\n' + |
| 10 | + 'https://github.com/getsentry/sentry-cli', |
| 11 | + ).argv; |
19 | 12 |
|
20 | 13 | const sentry = new SentryCli();
|
21 | 14 |
|
22 | 15 | async function createRelease() {
|
| 16 | + const RELEASE = argv.release || (await sentry.releases.proposeVersion()); |
| 17 | + const URL_PREFIX = argv.urlPrefix || '~/build/'; |
| 18 | + const BUILD_PATH = argv.buildPath || 'public/build'; |
| 19 | + |
23 | 20 | await sentry.releases.new(RELEASE);
|
24 | 21 |
|
25 | 22 | await sentry.releases.uploadSourceMaps(RELEASE, {
|
|
0 commit comments