-
-
Notifications
You must be signed in to change notification settings - Fork 48
/
bin.ts
133 lines (125 loc) · 3.78 KB
/
bin.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env node
import { satisfies } from 'semver';
import { red } from './lib/Helper/Logging';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
const NODE_VERSION_RANGE = '>=14.18.0';
// Have to run this above the other imports because they are importing clack that
// has the problematic imports.
if (!satisfies(process.version, NODE_VERSION_RANGE)) {
red(
`Sentry wizard requires Node.js ${NODE_VERSION_RANGE}. You are using Node.js ${process.version}. Please upgrade your Node.js version.`,
);
process.exit(1);
}
import { Integration, Platform } from './lib/Constants';
import { run } from './src/run';
export * from './lib/Setup';
const PRESELECTED_PROJECT_OPTIONS = {
'preSelectedProject.authToken': {
describe: 'Preselected project auth token',
},
'preSelectedProject.selfHosted': {
describe: 'Preselected project is self-hosted',
},
'preSelectedProject.dsn': {
describe: 'Preselected project DSN',
},
'preSelectedProject.id': {
describe: 'Preselected project id',
},
'preSelectedProject.projectSlug': {
describe: 'Preselected project slug',
},
'preSelectedProject.projectName': {
describe: 'Preselected project name',
},
'preSelectedProject.orgId': {
describe: 'Preselected organization id',
},
'preSelectedProject.orgName': {
describe: 'Preselected organization name',
},
'preSelectedProject.orgSlug': {
describe: 'Preselected organization slug',
},
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
const argv = yargs(hideBin(process.argv)).options({
debug: {
default: false,
describe: 'Enable verbose logging\nenv: SENTRY_WIZARD_DEBUG',
type: 'boolean',
},
uninstall: {
default: false,
describe: 'Revert project setup process\nenv: SENTRY_WIZARD_UNINSTALL',
type: 'boolean',
},
'skip-connect': {
default: false,
describe:
'Skips the connection to the server\nenv: SENTRY_WIZARD_SKIP_CONNECT',
type: 'boolean',
},
quiet: {
default: false,
describe:
'Do not fallback to prompting user asking questions\nenv: SENTRY_WIZARD_QUIET',
type: 'boolean',
},
i: {
alias: 'integration',
choices: Object.keys(Integration),
describe: 'Choose the integration to setup\nenv: SENTRY_WIZARD_INTEGRATION',
},
p: {
alias: 'platform',
choices: Object.keys(Platform),
describe: 'Choose platform(s)\nenv: SENTRY_WIZARD_PLATFORM',
type: 'array',
},
u: {
alias: 'url',
describe: 'The url to your Sentry installation\nenv: SENTRY_WIZARD_URL',
},
project: {
type: 'string',
describe: 'The Sentry project slug to use',
defaultDescription: 'Select project during setup',
default: undefined,
},
org: {
type: 'string',
describe: 'The Sentry org slug to use',
defaultDescription: 'Select org during setup',
default: undefined,
},
saas: {
default: false,
describe: 'Skip the self-hosted or SaaS URL selection process',
defaultDescription: 'Select self-hosted or SaaS during setup',
type: 'boolean',
},
s: {
alias: 'signup',
default: false,
describe: 'Redirect to signup page if not logged in',
type: 'boolean',
},
'disable-telemetry': {
default: false,
describe: "Don't send telemetry data to Sentry",
type: 'boolean',
},
'promo-code': {
alias: 'promo-code',
describe: 'A promo code that will be applied during signup',
type: 'string',
},
...PRESELECTED_PROJECT_OPTIONS,
}).argv;
// @ts-expect-error - for some reason TS doesn't recognize the aliases as valid properties
// meaning it only knows e.g. u but not url. Maybe a bug in this old version of yargs?
// Can't upgrade yargs though without dropping support for Node 14.
void run(argv);