@sentry/wizard 2.7.0 → 3.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -3
- package/bin.ts +9 -2
- package/dist/NextJs/configs/next.config.template.js +1 -1
- package/dist/bin.js +16 -4
- package/dist/bin.js.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/Constants.js +1 -1
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/BottomBar.js +2 -2
- package/dist/lib/Helper/BottomBar.js.map +1 -1
- package/dist/lib/Helper/File.js +10 -12
- package/dist/lib/Helper/File.js.map +1 -1
- package/dist/lib/Helper/Logging.js +1 -1
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Helper/MergeConfig.js +1 -0
- package/dist/lib/Helper/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/Package.js +10 -10
- package/dist/lib/Helper/Package.js.map +1 -1
- package/dist/lib/Helper/PackageManager.js +6 -9
- package/dist/lib/Helper/PackageManager.js.map +1 -1
- package/dist/lib/Helper/SentryCli.d.ts +3 -3
- package/dist/lib/Helper/SentryCli.js +3 -3
- package/dist/lib/Helper/SentryCli.js.map +1 -1
- package/dist/lib/Helper/Wizard.d.ts +4 -4
- package/dist/lib/Helper/Wizard.js +11 -11
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/File.js +5 -5
- package/dist/lib/Helper/__tests__/File.js.map +1 -1
- package/dist/lib/Helper/__tests__/MergeConfig.js +9 -9
- package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Setup.js +11 -9
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/BaseStep.d.ts +2 -2
- package/dist/lib/Steps/BaseStep.js +3 -3
- package/dist/lib/Steps/BaseStep.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.d.ts +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +7 -5
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/ConfigureProject.d.ts +1 -1
- package/dist/lib/Steps/ConfigureProject.js +5 -3
- package/dist/lib/Steps/ConfigureProject.js.map +1 -1
- package/dist/lib/Steps/Initial.d.ts +1 -1
- package/dist/lib/Steps/Initial.js +7 -4
- package/dist/lib/Steps/Initial.js.map +1 -1
- package/dist/lib/Steps/Integrations/BaseIntegration.d.ts +2 -2
- package/dist/lib/Steps/Integrations/BaseIntegration.js +7 -4
- package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.d.ts +2 -2
- package/dist/lib/Steps/Integrations/Cordova.js +13 -10
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.d.ts +2 -2
- package/dist/lib/Steps/Integrations/Electron.js +25 -21
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.d.ts +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js +8 -5
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/Integrations/NextJs.d.ts +2 -2
- package/dist/lib/Steps/Integrations/NextJs.js +57 -52
- package/dist/lib/Steps/Integrations/NextJs.js.map +1 -1
- package/dist/lib/Steps/Integrations/ReactNative.d.ts +2 -2
- package/dist/lib/Steps/Integrations/ReactNative.js +54 -52
- package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
- package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +1 -1
- package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +1 -1
- package/dist/lib/Steps/OpenSentry.d.ts +1 -1
- package/dist/lib/Steps/OpenSentry.js +19 -17
- package/dist/lib/Steps/OpenSentry.js.map +1 -1
- package/dist/lib/Steps/PromptForParameters.d.ts +1 -1
- package/dist/lib/Steps/PromptForParameters.js +21 -19
- package/dist/lib/Steps/PromptForParameters.js.map +1 -1
- package/dist/lib/Steps/Result.d.ts +1 -1
- package/dist/lib/Steps/Result.js +8 -5
- package/dist/lib/Steps/Result.js.map +1 -1
- package/dist/lib/Steps/SentryProjectSelector.d.ts +1 -1
- package/dist/lib/Steps/SentryProjectSelector.js +6 -4
- package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
- package/dist/lib/Steps/ShouldConfigure.d.ts +1 -1
- package/dist/lib/Steps/ShouldConfigure.js +5 -3
- package/dist/lib/Steps/ShouldConfigure.js.map +1 -1
- package/dist/lib/Steps/WaitForSentry.d.ts +1 -1
- package/dist/lib/Steps/WaitForSentry.js +47 -50
- package/dist/lib/Steps/WaitForSentry.js.map +1 -1
- package/dist/lib/Steps/Welcome.d.ts +1 -1
- package/dist/lib/Steps/Welcome.js +8 -6
- package/dist/lib/Steps/Welcome.js.map +1 -1
- package/dist/lib/Steps/index.js +1 -0
- package/dist/lib/Steps/index.js.map +1 -1
- package/dist/lib/__tests__/Env.js +1 -1
- package/dist/lib/__tests__/Env.js.map +1 -1
- package/dist/lib/__tests__/Setup.js +1 -1
- package/dist/lib/__tests__/Setup.js.map +1 -1
- package/dist/src/clack-utils.d.ts +40 -0
- package/dist/src/clack-utils.js +329 -0
- package/dist/src/clack-utils.js.map +1 -0
- package/dist/src/nextjs-wizard.d.ts +5 -0
- package/dist/src/nextjs-wizard.js +346 -0
- package/dist/src/nextjs-wizard.js.map +1 -0
- package/lib/Helper/File.ts +2 -8
- package/lib/Helper/MergeConfig.ts +1 -0
- package/lib/Helper/SentryCli.ts +3 -3
- package/lib/Helper/Wizard.ts +6 -5
- package/lib/Helper/__tests__/File.ts +5 -5
- package/lib/Helper/__tests__/SentryCli.ts +3 -2
- package/lib/Helper/test-fixtures/next.config.1-merged.js +1 -1
- package/lib/Helper/test-fixtures/next.config.3-merged.js +1 -1
- package/lib/Helper/test-fixtures/next.config.4-merged.js +1 -1
- package/lib/Steps/BaseStep.ts +4 -4
- package/lib/Steps/ChooseIntegration.ts +2 -1
- package/lib/Steps/ConfigureProject.ts +1 -1
- package/lib/Steps/Initial.ts +2 -1
- package/lib/Steps/Integrations/BaseIntegration.ts +5 -3
- package/lib/Steps/Integrations/Cordova.ts +7 -6
- package/lib/Steps/Integrations/Electron.ts +10 -7
- package/lib/Steps/Integrations/MobileProject.ts +3 -1
- package/lib/Steps/Integrations/NextJs.ts +8 -6
- package/lib/Steps/Integrations/ReactNative.ts +47 -26
- package/lib/Steps/Integrations/__tests__/ReactNative.ts +3 -2
- package/lib/Steps/OpenSentry.ts +1 -1
- package/lib/Steps/PromptForParameters.ts +3 -2
- package/lib/Steps/Result.ts +2 -1
- package/lib/Steps/SentryProjectSelector.ts +3 -2
- package/lib/Steps/ShouldConfigure.ts +1 -1
- package/lib/Steps/WaitForSentry.ts +4 -4
- package/lib/Steps/Welcome.ts +3 -2
- package/lib/__tests__/Setup.ts +1 -1
- package/package.json +17 -14
- package/scripts/NextJs/configs/next.config.template.js +1 -1
- package/src/clack-utils.ts +346 -0
- package/src/nextjs-wizard.ts +619 -0
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
1
|
+
import type { Answers } from 'inquirer';
|
|
2
2
|
import * as _ from 'lodash';
|
|
3
3
|
|
|
4
|
-
import { Args } from '../../Constants';
|
|
4
|
+
import type { Args } from '../../Constants';
|
|
5
5
|
import { BaseStep } from '../BaseStep';
|
|
6
6
|
|
|
7
7
|
export abstract class BaseIntegration extends BaseStep {
|
|
8
8
|
public type: string;
|
|
9
9
|
protected _shouldConfigure: Promise<Answers>;
|
|
10
10
|
|
|
11
|
-
constructor(protected _argv: Args) {
|
|
11
|
+
public constructor(protected _argv: Args) {
|
|
12
12
|
super(_argv);
|
|
13
13
|
// @ts-ignore property construct does not exist on BaseIntegration
|
|
14
14
|
this.type = this.construct;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
17
18
|
public async uninstall(_answers: Answers): Promise<Answers> {
|
|
18
19
|
return {};
|
|
19
20
|
}
|
|
@@ -24,6 +25,7 @@ export abstract class BaseIntegration extends BaseStep {
|
|
|
24
25
|
* Basically this will be merged into answers so it can be checked by a later step.
|
|
25
26
|
*/
|
|
26
27
|
public async shouldConfigure(_answers: Answers): Promise<Answers> {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
27
29
|
if (this._shouldConfigure) {
|
|
28
30
|
return this._shouldConfigure;
|
|
29
31
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
-
import { Answers } from 'inquirer';
|
|
2
|
+
import type { Answers } from 'inquirer';
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
|
|
5
|
-
import { Args } from '../../Constants';
|
|
5
|
+
import type { Args } from '../../Constants';
|
|
6
6
|
import { exists, matchesContent, patchMatchingFile } from '../../Helper/File';
|
|
7
7
|
import { green } from '../../Helper/Logging';
|
|
8
8
|
import { SentryCli } from '../../Helper/SentryCli';
|
|
@@ -12,10 +12,10 @@ const xcode = require('xcode');
|
|
|
12
12
|
|
|
13
13
|
export class Cordova extends BaseIntegration {
|
|
14
14
|
protected _sentryCli: SentryCli;
|
|
15
|
-
protected _folderPrefix
|
|
15
|
+
protected _folderPrefix = 'platforms';
|
|
16
16
|
protected _pluginFolder: string[] = ['.'];
|
|
17
17
|
|
|
18
|
-
constructor(protected _argv: Args) {
|
|
18
|
+
public constructor(protected _argv: Args) {
|
|
19
19
|
super(_argv);
|
|
20
20
|
this._sentryCli = new SentryCli(this._argv);
|
|
21
21
|
}
|
|
@@ -35,7 +35,7 @@ export class Cordova extends BaseIntegration {
|
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
await this._addSentryProperties(sentryCliProperties);
|
|
38
|
-
green(
|
|
38
|
+
green('Successfully set up for cordova');
|
|
39
39
|
|
|
40
40
|
return {};
|
|
41
41
|
}
|
|
@@ -50,6 +50,7 @@ export class Cordova extends BaseIntegration {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
public async shouldConfigure(_answers: Answers): Promise<Answers> {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
53
54
|
if (this._shouldConfigure) {
|
|
54
55
|
return this._shouldConfigure;
|
|
55
56
|
}
|
|
@@ -57,7 +58,7 @@ export class Cordova extends BaseIntegration {
|
|
|
57
58
|
let result = false;
|
|
58
59
|
if (!exists(path.join('sentry.properties'))) {
|
|
59
60
|
result = true;
|
|
60
|
-
this.debug(
|
|
61
|
+
this.debug('sentry.properties not exists');
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
if (
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
-
import { Answers
|
|
2
|
+
import type { Answers} from 'inquirer';
|
|
3
|
+
import { prompt } from 'inquirer';
|
|
3
4
|
import * as _ from 'lodash';
|
|
4
5
|
import * as path from 'path';
|
|
5
6
|
|
|
6
|
-
import { Args } from '../../Constants';
|
|
7
|
-
import {
|
|
7
|
+
import type { Args } from '../../Constants';
|
|
8
|
+
import { dim, green, l, nl, red } from '../../Helper/Logging';
|
|
8
9
|
import { SentryCli } from '../../Helper/SentryCli';
|
|
9
10
|
import { BaseIntegration } from './BaseIntegration';
|
|
10
11
|
|
|
@@ -23,7 +24,7 @@ Sentry.init({
|
|
|
23
24
|
|
|
24
25
|
let appPackage: any = {};
|
|
25
26
|
|
|
26
|
-
function printExample(example: string, title
|
|
27
|
+
function printExample(example: string, title = ''): void {
|
|
27
28
|
if (title) {
|
|
28
29
|
l(title);
|
|
29
30
|
}
|
|
@@ -42,11 +43,12 @@ try {
|
|
|
42
43
|
export class Electron extends BaseIntegration {
|
|
43
44
|
protected _sentryCli: SentryCli;
|
|
44
45
|
|
|
45
|
-
constructor(protected _argv: Args) {
|
|
46
|
+
public constructor(protected _argv: Args) {
|
|
46
47
|
super(_argv);
|
|
47
48
|
this._sentryCli = new SentryCli(this._argv);
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
50
52
|
public async emit(answers: Answers): Promise<Answers> {
|
|
51
53
|
const dsn = _.get(answers, ['config', 'dsn', 'public'], null);
|
|
52
54
|
nl();
|
|
@@ -56,7 +58,7 @@ export class Electron extends BaseIntegration {
|
|
|
56
58
|
'./sentry.properties',
|
|
57
59
|
this._sentryCli.dumpProperties(sentryCliProps),
|
|
58
60
|
);
|
|
59
|
-
green(
|
|
61
|
+
green('Successfully created sentry.properties');
|
|
60
62
|
nl();
|
|
61
63
|
|
|
62
64
|
printExample(
|
|
@@ -71,6 +73,7 @@ export class Electron extends BaseIntegration {
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
public async shouldConfigure(_answers: Answers): Promise<Answers> {
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
74
77
|
if (this._shouldConfigure) {
|
|
75
78
|
return this._shouldConfigure;
|
|
76
79
|
}
|
|
@@ -122,7 +125,7 @@ export class Electron extends BaseIntegration {
|
|
|
122
125
|
!_.get(appPackage, `devDependencies.${packageName}`, false)
|
|
123
126
|
) {
|
|
124
127
|
red(`✗ ${packageName} isn't in your dependencies`);
|
|
125
|
-
red(
|
|
128
|
+
red(' please install it with yarn/npm');
|
|
126
129
|
return false;
|
|
127
130
|
} else if (
|
|
128
131
|
minVersion &&
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Answers
|
|
1
|
+
import type { Answers} from 'inquirer';
|
|
2
|
+
import { prompt } from 'inquirer';
|
|
2
3
|
import * as _ from 'lodash';
|
|
3
4
|
|
|
4
5
|
import { getPlatformChoices, Platform } from '../../Constants';
|
|
@@ -32,6 +33,7 @@ export abstract class MobileProject extends BaseIntegration {
|
|
|
32
33
|
: (await this._platformSelector()).platform;
|
|
33
34
|
|
|
34
35
|
const shouldConfigurePlatforms: any = {};
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
35
37
|
_.keys(Platform).forEach(async (platform: Platform) => {
|
|
36
38
|
shouldConfigurePlatforms[platform] =
|
|
37
39
|
_.indexOf(this._platforms, platform) >= 0
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
import Chalk from 'chalk';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { Answers
|
|
4
|
+
import type { Answers } from 'inquirer';
|
|
5
|
+
import { prompt } from 'inquirer';
|
|
5
6
|
import * as _ from 'lodash';
|
|
6
7
|
import * as path from 'path';
|
|
7
|
-
import { satisfies, subset, valid, validRange } from 'semver';
|
|
8
8
|
|
|
9
|
-
import { Args } from '../../Constants';
|
|
9
|
+
import type { Args } from '../../Constants';
|
|
10
10
|
import { debug, green, l, nl, red } from '../../Helper/Logging';
|
|
11
11
|
import { mergeConfigFile } from '../../Helper/MergeConfig';
|
|
12
12
|
import { checkPackageVersion } from '../../Helper/Package';
|
|
13
13
|
import { getPackageMangerChoice } from '../../Helper/PackageManager';
|
|
14
|
-
import {
|
|
14
|
+
import type { SentryCliProps } from '../../Helper/SentryCli';
|
|
15
|
+
import { SentryCli } from '../../Helper/SentryCli';
|
|
15
16
|
import { BaseIntegration } from './BaseIntegration';
|
|
16
17
|
|
|
17
18
|
const COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <14.0.0';
|
|
@@ -43,7 +44,7 @@ try {
|
|
|
43
44
|
export class NextJs extends BaseIntegration {
|
|
44
45
|
protected _sentryCli: SentryCli;
|
|
45
46
|
|
|
46
|
-
constructor(protected _argv: Args) {
|
|
47
|
+
public constructor(protected _argv: Args) {
|
|
47
48
|
super(_argv);
|
|
48
49
|
this._sentryCli = new SentryCli(this._argv);
|
|
49
50
|
}
|
|
@@ -101,6 +102,7 @@ export class NextJs extends BaseIntegration {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
public async shouldConfigure(_answers: Answers): Promise<Answers> {
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
104
106
|
if (this._shouldConfigure) {
|
|
105
107
|
return this._shouldConfigure;
|
|
106
108
|
}
|
|
@@ -206,7 +208,7 @@ export class NextJs extends BaseIntegration {
|
|
|
206
208
|
`./${PROPERTIES_FILENAME}`,
|
|
207
209
|
this._sentryCli.dumpProperties(cliPropsToWrite),
|
|
208
210
|
);
|
|
209
|
-
green(
|
|
211
|
+
green('✓ Successfully created sentry.properties');
|
|
210
212
|
} catch {
|
|
211
213
|
red(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);
|
|
212
214
|
l(
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
import { exec } from 'child_process';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { Answers
|
|
4
|
+
import type { Answers} from 'inquirer';
|
|
5
|
+
import { prompt } from 'inquirer';
|
|
5
6
|
import * as _ from 'lodash';
|
|
6
7
|
import * as path from 'path';
|
|
7
8
|
import { promisify } from 'util';
|
|
8
9
|
|
|
9
|
-
import { Args } from '../../Constants';
|
|
10
|
-
import {
|
|
10
|
+
import type { Args } from '../../Constants';
|
|
11
|
+
import {
|
|
12
|
+
exists,
|
|
13
|
+
matchesContent,
|
|
14
|
+
matchFiles,
|
|
15
|
+
patchMatchingFile,
|
|
16
|
+
} from '../../Helper/File';
|
|
11
17
|
import { dim, green, nl, red } from '../../Helper/Logging';
|
|
12
18
|
import { checkPackageVersion } from '../../Helper/Package';
|
|
13
19
|
import { getPackageMangerChoice } from '../../Helper/PackageManager';
|
|
@@ -22,19 +28,19 @@ export const COMPATIBLE_SDK_VERSION = '>= 5.0.0';
|
|
|
22
28
|
export const SENTRY_REACT_NATIVE_PACKAGE = '@sentry/react-native';
|
|
23
29
|
export const REACT_NATIVE_PACKAGE = 'react-native';
|
|
24
30
|
|
|
25
|
-
export const DOCS_MANUAL_STEPS =
|
|
31
|
+
export const DOCS_MANUAL_STEPS =
|
|
32
|
+
'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/';
|
|
26
33
|
|
|
27
34
|
export class ReactNative extends MobileProject {
|
|
28
|
-
|
|
29
35
|
/**
|
|
30
36
|
* All React Native versions have app/build.gradle with android section.
|
|
31
37
|
*/
|
|
32
|
-
private static _buildGradleAndroidSectionBeginning
|
|
38
|
+
private static _buildGradleAndroidSectionBeginning = /^android {/m;
|
|
33
39
|
|
|
34
40
|
protected _answers: Answers;
|
|
35
41
|
protected _sentryCli: SentryCli;
|
|
36
42
|
|
|
37
|
-
constructor(protected _argv: Args) {
|
|
43
|
+
public constructor(protected _argv: Args) {
|
|
38
44
|
super(_argv);
|
|
39
45
|
this._sentryCli = new SentryCli(this._argv);
|
|
40
46
|
}
|
|
@@ -59,7 +65,7 @@ export class ReactNative extends MobileProject {
|
|
|
59
65
|
);
|
|
60
66
|
if (!hasCompatibleReactNativeVersion && !this._argv.quiet) {
|
|
61
67
|
userAnswers = await prompt({
|
|
62
|
-
message:
|
|
68
|
+
message: 'Your version of React Native is not compatible with Sentry\'s React Native SDK. Do you want to continue?',
|
|
63
69
|
name: 'continue',
|
|
64
70
|
default: false,
|
|
65
71
|
type: 'confirm',
|
|
@@ -67,7 +73,9 @@ export class ReactNative extends MobileProject {
|
|
|
67
73
|
nl();
|
|
68
74
|
}
|
|
69
75
|
if (!userAnswers.continue) {
|
|
70
|
-
throw new Error(
|
|
76
|
+
throw new Error(
|
|
77
|
+
`Please upgrade to a version that is compatible with ${COMPATIBLE_REACT_NATIVE_VERSIONS}. Or use ${DOCS_MANUAL_STEPS}`,
|
|
78
|
+
);
|
|
71
79
|
}
|
|
72
80
|
|
|
73
81
|
if (packageManager) {
|
|
@@ -89,7 +97,9 @@ export class ReactNative extends MobileProject {
|
|
|
89
97
|
nl();
|
|
90
98
|
}
|
|
91
99
|
if (!userAnswers.continue) {
|
|
92
|
-
throw new Error(
|
|
100
|
+
throw new Error(
|
|
101
|
+
`Please upgrade to a version that is compatible with ${COMPATIBLE_SDK_VERSION}.`,
|
|
102
|
+
);
|
|
93
103
|
}
|
|
94
104
|
|
|
95
105
|
const sentryCliProperties = this._sentryCli.convertAnswersToProperties(
|
|
@@ -104,15 +114,15 @@ export class ReactNative extends MobileProject {
|
|
|
104
114
|
'ios/*.xcodeproj/project.pbxproj',
|
|
105
115
|
this._patchXcodeProj.bind(this),
|
|
106
116
|
);
|
|
107
|
-
green(
|
|
117
|
+
green('✓ Patched build script in Xcode project.');
|
|
108
118
|
await this._podInstall();
|
|
109
|
-
green(
|
|
119
|
+
green('✓ Pods installed.');
|
|
110
120
|
} else {
|
|
111
121
|
await patchMatchingFile(
|
|
112
122
|
'**/app/build.gradle',
|
|
113
123
|
this._patchBuildGradle.bind(this),
|
|
114
124
|
);
|
|
115
|
-
green(
|
|
125
|
+
green('✓ Patched build.gradle file.');
|
|
116
126
|
}
|
|
117
127
|
await this._patchJsSentryInit(platform, answers);
|
|
118
128
|
await this._addSentryProperties(platform, sentryCliProperties);
|
|
@@ -140,6 +150,7 @@ export class ReactNative extends MobileProject {
|
|
|
140
150
|
return {};
|
|
141
151
|
}
|
|
142
152
|
|
|
153
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
143
154
|
protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {
|
|
144
155
|
let result = false;
|
|
145
156
|
|
|
@@ -184,7 +195,9 @@ export class ReactNative extends MobileProject {
|
|
|
184
195
|
let appPackage: Record<string, unknown> = {};
|
|
185
196
|
|
|
186
197
|
try {
|
|
187
|
-
appPackage = JSON.parse(
|
|
198
|
+
appPackage = JSON.parse(
|
|
199
|
+
fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'),
|
|
200
|
+
);
|
|
188
201
|
} catch {
|
|
189
202
|
// We don't need to have this
|
|
190
203
|
}
|
|
@@ -282,9 +295,9 @@ export class ReactNative extends MobileProject {
|
|
|
282
295
|
// eslint-disable-next-line prefer-template
|
|
283
296
|
match +
|
|
284
297
|
"\n\nimport * as Sentry from '@sentry/react-native';\n\n" +
|
|
285
|
-
|
|
298
|
+
'Sentry.init({ \n' +
|
|
286
299
|
` dsn: '${dsn}', \n` +
|
|
287
|
-
|
|
300
|
+
'});\n',
|
|
288
301
|
),
|
|
289
302
|
);
|
|
290
303
|
}
|
|
@@ -321,23 +334,21 @@ export class ReactNative extends MobileProject {
|
|
|
321
334
|
private _patchExistingXcodeBuildScripts(buildScripts: any): void {
|
|
322
335
|
for (const script of buildScripts) {
|
|
323
336
|
if (
|
|
324
|
-
!script.shellScript.match(
|
|
325
|
-
/\/scripts\/react-native-xcode\.sh/i,
|
|
326
|
-
) ||
|
|
337
|
+
!script.shellScript.match(/\/scripts\/react-native-xcode\.sh/i) ||
|
|
327
338
|
script.shellScript.match(/sentry-cli\s+react-native\s+xcode/i)
|
|
328
339
|
) {
|
|
329
340
|
continue;
|
|
330
341
|
}
|
|
331
342
|
let code = JSON.parse(script.shellScript);
|
|
332
343
|
code =
|
|
333
|
-
// eslint-disable-next-line prefer-template
|
|
344
|
+
// eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands
|
|
334
345
|
'export SENTRY_PROPERTIES=sentry.properties\n' +
|
|
335
346
|
'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' +
|
|
336
347
|
code.replace(
|
|
337
348
|
'$REACT_NATIVE_XCODE',
|
|
338
349
|
() =>
|
|
339
350
|
// eslint-disable-next-line no-useless-escape
|
|
340
|
-
'
|
|
351
|
+
'\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\"',
|
|
341
352
|
) +
|
|
342
353
|
'\n/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh\n';
|
|
343
354
|
script.shellScript = JSON.stringify(code);
|
|
@@ -346,7 +357,11 @@ export class ReactNative extends MobileProject {
|
|
|
346
357
|
|
|
347
358
|
private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {
|
|
348
359
|
for (const script of buildScripts) {
|
|
349
|
-
if (
|
|
360
|
+
if (
|
|
361
|
+
script.shellScript.match(
|
|
362
|
+
/sentry-cli\s+(upload-dsym|debug-files upload)/,
|
|
363
|
+
)
|
|
364
|
+
) {
|
|
350
365
|
return;
|
|
351
366
|
}
|
|
352
367
|
}
|
|
@@ -358,7 +373,7 @@ export class ReactNative extends MobileProject {
|
|
|
358
373
|
null,
|
|
359
374
|
{
|
|
360
375
|
shellPath: '/bin/sh',
|
|
361
|
-
shellScript
|
|
376
|
+
shellScript: `
|
|
362
377
|
export SENTRY_PROPERTIES=sentry.properties
|
|
363
378
|
[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
|
|
364
379
|
../node_modules/@sentry/cli/bin/sentry-cli debug-files upload "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH"
|
|
@@ -367,7 +382,10 @@ export SENTRY_PROPERTIES=sentry.properties
|
|
|
367
382
|
);
|
|
368
383
|
}
|
|
369
384
|
|
|
370
|
-
private _patchXcodeProj(
|
|
385
|
+
private _patchXcodeProj(
|
|
386
|
+
contents: string,
|
|
387
|
+
filename: string,
|
|
388
|
+
): Promise<string | undefined> {
|
|
371
389
|
const proj = xcode.project(filename);
|
|
372
390
|
return new Promise((resolve, reject) => {
|
|
373
391
|
proj.parse((err: any) => {
|
|
@@ -409,7 +427,7 @@ export SENTRY_PROPERTIES=sentry.properties
|
|
|
409
427
|
// continue prompt.
|
|
410
428
|
const newContents = proj.writeSync();
|
|
411
429
|
if (newContents === contents) {
|
|
412
|
-
resolve();
|
|
430
|
+
resolve(undefined);
|
|
413
431
|
} else {
|
|
414
432
|
resolve(newContents);
|
|
415
433
|
}
|
|
@@ -442,7 +460,10 @@ export SENTRY_PROPERTIES=sentry.properties
|
|
|
442
460
|
JSON.parse(script.shellScript)
|
|
443
461
|
// remove sentry properties export
|
|
444
462
|
.replace(/^export SENTRY_PROPERTIES=sentry.properties\r?\n/m, '')
|
|
445
|
-
.replace(
|
|
463
|
+
.replace(
|
|
464
|
+
/^\/bin\/sh ..\/node_modules\/@sentry\/react-native\/scripts\/collect-modules.sh\r?\n/m,
|
|
465
|
+
'',
|
|
466
|
+
)
|
|
446
467
|
// unwrap react-native-xcode.sh command. In case someone replaced it
|
|
447
468
|
// entirely with the sentry-cli command we need to put the original
|
|
448
469
|
// version back in.
|
|
@@ -2,12 +2,13 @@ jest.mock('../../../Helper/Logging.ts'); // We mock logging to not pollute the o
|
|
|
2
2
|
jest.mock('child_process');
|
|
3
3
|
import * as child_process from 'child_process';
|
|
4
4
|
import * as fs from 'fs';
|
|
5
|
-
import { Answers } from 'inquirer';
|
|
5
|
+
import type { Answers } from 'inquirer';
|
|
6
6
|
import * as path from 'path';
|
|
7
7
|
import * as process from 'process';
|
|
8
8
|
import * as rimraf from 'rimraf';
|
|
9
9
|
|
|
10
|
-
import { Args
|
|
10
|
+
import type { Args} from '../../../Constants';
|
|
11
|
+
import { Integration, Platform } from '../../../Constants';
|
|
11
12
|
import { ReactNative } from '../ReactNative';
|
|
12
13
|
|
|
13
14
|
const testDir = 'rn-test';
|
package/lib/Steps/OpenSentry.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Answers
|
|
1
|
+
import type { Answers } from 'inquirer';
|
|
2
|
+
import { prompt } from 'inquirer';
|
|
2
3
|
import * as _ from 'lodash';
|
|
3
4
|
|
|
4
5
|
import { dim } from '../Helper/Logging';
|
|
@@ -130,7 +131,7 @@ export class PromptForParameters extends BaseStep {
|
|
|
130
131
|
return 'Please copy the slug from the url, it should be all lowercase';
|
|
131
132
|
}
|
|
132
133
|
if (input.length === 0) {
|
|
133
|
-
return
|
|
134
|
+
return "Can't be empty";
|
|
134
135
|
}
|
|
135
136
|
return true;
|
|
136
137
|
}
|
package/lib/Steps/Result.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
1
|
+
import type { Answers } from 'inquirer';
|
|
2
2
|
|
|
3
3
|
import { green, nl } from '../Helper/Logging';
|
|
4
4
|
import { BaseStep } from './BaseStep';
|
|
5
5
|
|
|
6
6
|
export class Result extends BaseStep {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
7
8
|
public async emit(answers: Answers): Promise<Answers> {
|
|
8
9
|
this.debug(answers);
|
|
9
10
|
nl();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Answers
|
|
1
|
+
import type { Answers } from 'inquirer';
|
|
2
|
+
import { prompt } from 'inquirer';
|
|
2
3
|
import * as _ from 'lodash';
|
|
3
4
|
|
|
4
5
|
import { BaseStep } from './BaseStep';
|
|
5
6
|
|
|
6
7
|
function sleep(n: number): Promise<void> {
|
|
7
|
-
return new Promise(resolve => setTimeout(resolve, n));
|
|
8
|
+
return new Promise((resolve) => setTimeout(resolve, n));
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export class SentryProjectSelector extends BaseStep {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
1
|
+
import type { Answers } from 'inquirer';
|
|
2
2
|
|
|
3
3
|
import { BottomBar } from '../Helper/BottomBar';
|
|
4
4
|
import { getCurrentIntegration } from '../Helper/Wizard';
|
|
@@ -16,7 +16,7 @@ export class WaitForSentry extends BaseStep {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
// eslint-disable-next-line no-async-promise-executor
|
|
19
|
-
return new Promise(
|
|
19
|
+
return new Promise((resolve, _reject) => {
|
|
20
20
|
this.debug(answers);
|
|
21
21
|
|
|
22
22
|
BottomBar.show('Waiting for Sentry...');
|
|
@@ -28,7 +28,7 @@ export class WaitForSentry extends BaseStep {
|
|
|
28
28
|
const response = await r2.get(
|
|
29
29
|
`${baseUrl}api/0/wizard/${answers.hash}/`,
|
|
30
30
|
).response;
|
|
31
|
-
this.debug(
|
|
31
|
+
this.debug('Polling received data');
|
|
32
32
|
if (response.status !== 200) {
|
|
33
33
|
throw new Error(`Received status ${response.status}`);
|
|
34
34
|
}
|
|
@@ -36,7 +36,7 @@ export class WaitForSentry extends BaseStep {
|
|
|
36
36
|
// Delete the wizard hash since we were able to fetch the data
|
|
37
37
|
await r2.delete(`${baseUrl}api/0/wizard/${answers.hash}/`);
|
|
38
38
|
BottomBar.hide();
|
|
39
|
-
this.debug(
|
|
39
|
+
this.debug('Polling Success!');
|
|
40
40
|
resolve({ wizard: data });
|
|
41
41
|
} catch (e) {
|
|
42
42
|
this.debug('Polling received:');
|
package/lib/Steps/Welcome.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { Answers } from 'inquirer';
|
|
1
|
+
import type { Answers } from 'inquirer';
|
|
2
2
|
|
|
3
3
|
import { dim, green } from '../Helper/Logging';
|
|
4
4
|
import { BaseStep } from './BaseStep';
|
|
5
5
|
|
|
6
6
|
export class Welcome extends BaseStep {
|
|
7
|
-
private static _didShow
|
|
7
|
+
private static _didShow = false;
|
|
8
8
|
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
9
10
|
public async emit(_answers: Answers): Promise<Answers> {
|
|
10
11
|
if (Welcome._didShow) {
|
|
11
12
|
return {};
|
package/lib/__tests__/Setup.ts
CHANGED
|
@@ -12,7 +12,7 @@ const restoreExec = (): void => {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
const mockExec = (): void => {
|
|
15
|
-
(
|
|
15
|
+
(child_process.exec as unknown as jest.Mock).mockImplementation(
|
|
16
16
|
(_command, callback) => callback(null, { stdout: '' }),
|
|
17
17
|
);
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0-beta.0",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -23,11 +23,14 @@
|
|
|
23
23
|
"definition": "dist/index.d.ts"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
+
"@clack/prompts": "0.6.3",
|
|
26
27
|
"@sentry/cli": "^1.72.0",
|
|
28
|
+
"axios": "1.3.5",
|
|
27
29
|
"chalk": "^2.4.1",
|
|
28
30
|
"glob": "^7.1.3",
|
|
29
31
|
"inquirer": "^6.2.0",
|
|
30
32
|
"lodash": "^4.17.15",
|
|
33
|
+
"magicast": "0.2.3",
|
|
31
34
|
"opn": "^5.4.0",
|
|
32
35
|
"r2": "^2.0.1",
|
|
33
36
|
"read-env": "^1.3.0",
|
|
@@ -36,25 +39,25 @@
|
|
|
36
39
|
"yargs": "^16.2.0"
|
|
37
40
|
},
|
|
38
41
|
"devDependencies": {
|
|
39
|
-
"@sentry-internal/eslint-config-sdk": "^
|
|
42
|
+
"@sentry-internal/eslint-config-sdk": "^7.48.0",
|
|
40
43
|
"@types/glob": "^7.2.0",
|
|
41
44
|
"@types/inquirer": "^0.0.43",
|
|
42
|
-
"@types/jest": "^
|
|
45
|
+
"@types/jest": "^29.5.0",
|
|
43
46
|
"@types/lodash": "^4.14.144",
|
|
44
47
|
"@types/node": "^10.11.0",
|
|
45
48
|
"@types/rimraf": "^3.0.2",
|
|
46
49
|
"@types/semver": "^7.3.7",
|
|
47
|
-
"eslint": "^
|
|
48
|
-
"jest": "^
|
|
49
|
-
"prettier": "^
|
|
50
|
+
"eslint": "^8.18.0",
|
|
51
|
+
"jest": "^29.5.0",
|
|
52
|
+
"prettier": "^2.8.7",
|
|
50
53
|
"rimraf": "^3.0.2",
|
|
51
|
-
"ts-jest": "^
|
|
52
|
-
"ts-node": "^
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
54
|
+
"ts-jest": "^29.1.0",
|
|
55
|
+
"ts-node": "^10.9.1",
|
|
56
|
+
"typescript": "^5.0.4",
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.13.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.13.0",
|
|
59
|
+
"eslint-config-prettier": "^8.3.0",
|
|
60
|
+
"eslint-plugin-jest": "^25.3.0"
|
|
58
61
|
},
|
|
59
62
|
"resolutions": {
|
|
60
63
|
"**/xmldom": "^0.6.0"
|
|
@@ -87,7 +90,7 @@
|
|
|
87
90
|
"dist"
|
|
88
91
|
],
|
|
89
92
|
"transform": {
|
|
90
|
-
"^.+\\.tsx?$": "
|
|
93
|
+
"^.+\\.tsx?$": "ts-jest"
|
|
91
94
|
},
|
|
92
95
|
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
|
93
96
|
"moduleFileExtensions": [
|