@sentry/wizard 3.15.0 → 3.16.1
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 +11 -0
- package/dist/lib/Steps/ChooseIntegration.js +1 -1
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js +7 -0
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/ReactNative.d.ts +7 -32
- package/dist/lib/Steps/Integrations/ReactNative.js +17 -485
- package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/android/android-wizard.js +13 -18
- package/dist/src/android/android-wizard.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +11 -4
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/cocoapod.d.ts +1 -0
- package/dist/src/apple/cocoapod.js +36 -13
- package/dist/src/apple/cocoapod.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/react-native/glob.d.ts +3 -0
- package/dist/src/react-native/glob.js +18 -0
- package/dist/src/react-native/glob.js.map +1 -0
- package/dist/src/react-native/gradle.d.ts +4 -0
- package/dist/src/react-native/gradle.js +49 -0
- package/dist/src/react-native/gradle.js.map +1 -0
- package/dist/src/react-native/javascript.d.ts +8 -0
- package/dist/src/react-native/javascript.js +25 -0
- package/dist/src/react-native/javascript.js.map +1 -0
- package/dist/src/react-native/options.d.ts +4 -0
- package/dist/src/react-native/options.js +3 -0
- package/dist/src/react-native/options.js.map +1 -0
- package/dist/src/react-native/react-native-wizard.d.ts +9 -0
- package/dist/src/react-native/react-native-wizard.js +356 -0
- package/dist/src/react-native/react-native-wizard.js.map +1 -0
- package/dist/src/react-native/uninstall.d.ts +2 -0
- package/dist/src/react-native/uninstall.js +130 -0
- package/dist/src/react-native/uninstall.js.map +1 -0
- package/dist/src/react-native/xcode.d.ts +18 -0
- package/dist/src/react-native/xcode.js +170 -0
- package/dist/src/react-native/xcode.js.map +1 -0
- package/dist/src/remix/remix-wizard.js +1 -1
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.js +3 -3
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +19 -3
- package/dist/src/utils/clack-utils.js +141 -39
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/semver.d.ts +5 -0
- package/dist/src/utils/semver.js +27 -0
- package/dist/src/utils/semver.js.map +1 -0
- package/dist/src/utils/sentrycli-utils.js +4 -1
- package/dist/src/utils/sentrycli-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +3 -0
- package/dist/src/utils/types.js.map +1 -1
- package/dist/test/react-native/gradle.test.js +57 -0
- package/dist/test/react-native/gradle.test.js.map +1 -0
- package/dist/test/react-native/javascript.test.js +47 -0
- package/dist/test/react-native/javascript.test.js.map +1 -0
- package/dist/test/react-native/xcode.test.d.ts +1 -0
- package/dist/test/react-native/xcode.test.js +144 -0
- package/dist/test/react-native/xcode.test.js.map +1 -0
- package/lib/Steps/ChooseIntegration.ts +1 -1
- package/lib/Steps/Integrations/Cordova.ts +7 -0
- package/lib/Steps/Integrations/ReactNative.ts +17 -573
- package/package.json +1 -1
- package/src/android/android-wizard.ts +3 -18
- package/src/apple/apple-wizard.ts +12 -3
- package/src/apple/cocoapod.ts +20 -9
- package/src/nextjs/nextjs-wizard.ts +1 -1
- package/src/react-native/glob.ts +13 -0
- package/src/react-native/gradle.ts +26 -0
- package/src/react-native/javascript.ts +33 -0
- package/src/react-native/options.ts +5 -0
- package/src/react-native/react-native-wizard.ts +369 -0
- package/src/react-native/uninstall.ts +107 -0
- package/src/react-native/xcode.ts +228 -0
- package/src/remix/remix-wizard.ts +2 -2
- package/src/sourcemaps/tools/nextjs.ts +6 -6
- package/src/sourcemaps/tools/sentry-cli.ts +1 -1
- package/src/sveltekit/sveltekit-wizard.ts +1 -1
- package/src/utils/clack-utils.ts +229 -74
- package/src/utils/semver.ts +33 -0
- package/src/utils/sentrycli-utils.ts +3 -1
- package/src/utils/types.ts +3 -0
- package/test/react-native/gradle.test.ts +310 -0
- package/test/react-native/javascript.test.ts +131 -0
- package/test/react-native/xcode.test.ts +238 -0
- package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +0 -198
- package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +0 -1
- package/dist/lib/__tests__/Setup.js +0 -57
- package/dist/lib/__tests__/Setup.js.map +0 -1
- package/lib/Steps/Integrations/__tests__/ReactNative.ts +0 -136
- package/lib/__tests__/Setup.ts +0 -42
- /package/dist/{lib/Steps/Integrations/__tests__/ReactNative.d.ts → test/react-native/gradle.test.d.ts} +0 -0
- /package/dist/{lib/__tests__/Setup.d.ts → test/react-native/javascript.test.d.ts} +0 -0
|
@@ -14,29 +14,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
15
|
};
|
|
16
16
|
})();
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
20
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
21
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
22
|
-
}
|
|
23
|
-
Object.defineProperty(o, k2, desc);
|
|
24
|
-
}) : (function(o, m, k, k2) {
|
|
25
|
-
if (k2 === undefined) k2 = k;
|
|
26
|
-
o[k2] = m[k];
|
|
27
|
-
}));
|
|
28
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
29
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
30
|
-
}) : function(o, v) {
|
|
31
|
-
o["default"] = v;
|
|
32
|
-
});
|
|
33
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
17
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
18
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
19
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -74,488 +51,43 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
74
51
|
}
|
|
75
52
|
};
|
|
76
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77
|
-
exports.ReactNative =
|
|
78
|
-
|
|
79
|
-
var
|
|
80
|
-
var
|
|
81
|
-
var inquirer_1 = require("inquirer");
|
|
82
|
-
var _ = __importStar(require("lodash"));
|
|
83
|
-
var path = __importStar(require("path"));
|
|
84
|
-
var util_1 = require("util");
|
|
85
|
-
var File_1 = require("../../Helper/File");
|
|
86
|
-
var Logging_1 = require("../../Helper/Logging");
|
|
87
|
-
var Package_1 = require("../../Helper/Package");
|
|
88
|
-
var package_manager_1 = require("../../../src/utils/package-manager");
|
|
89
|
-
var SentryCli_1 = require("../../Helper/SentryCli");
|
|
90
|
-
var MobileProject_1 = require("./MobileProject");
|
|
91
|
-
var BottomBar_1 = require("../../Helper/BottomBar");
|
|
92
|
-
var url_1 = require("url");
|
|
93
|
-
var xcode = require('xcode');
|
|
94
|
-
exports.COMPATIBLE_REACT_NATIVE_VERSIONS = '>=0.69.0';
|
|
95
|
-
exports.COMPATIBLE_SDK_VERSION = '>= 5.0.0';
|
|
96
|
-
exports.SENTRY_REACT_NATIVE_PACKAGE = '@sentry/react-native';
|
|
97
|
-
exports.REACT_NATIVE_PACKAGE = 'react-native';
|
|
98
|
-
exports.DOCS_MANUAL_STEPS = 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/';
|
|
99
|
-
var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
|
|
54
|
+
exports.ReactNative = void 0;
|
|
55
|
+
var BaseIntegration_1 = require("./BaseIntegration");
|
|
56
|
+
var react_native_wizard_1 = require("../../../src/react-native/react-native-wizard");
|
|
57
|
+
var ReactNative = /** @class */ (function (_super) {
|
|
100
58
|
__extends(ReactNative, _super);
|
|
101
59
|
function ReactNative(_argv) {
|
|
102
60
|
var _this = _super.call(this, _argv) || this;
|
|
103
61
|
_this._argv = _argv;
|
|
104
|
-
_this.
|
|
105
|
-
_this._sentryCli = new SentryCli_1.SentryCli(_this._argv);
|
|
62
|
+
_this.argv = _argv;
|
|
106
63
|
return _this;
|
|
107
64
|
}
|
|
108
|
-
ReactNative.prototype.emit = function (
|
|
65
|
+
ReactNative.prototype.emit = function (_answers) {
|
|
109
66
|
return __awaiter(this, void 0, void 0, function () {
|
|
110
|
-
var userAnswers, packageManager, hasCompatibleReactNativeVersion, hasCompatibleSentryReactNativeVersion, sentryCliProperties, promises, host, orgSlug, projectId, projectIssuesUrl;
|
|
111
|
-
var _this = this;
|
|
112
67
|
return __generator(this, function (_a) {
|
|
113
68
|
switch (_a.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
69
|
+
case 0: return [4 /*yield*/, (0, react_native_wizard_1.runReactNativeWizard)({
|
|
70
|
+
promoCode: this._argv.promoCode,
|
|
71
|
+
url: this._argv.url,
|
|
72
|
+
telemetryEnabled: !this._argv.disableTelemetry,
|
|
73
|
+
uninstall: this._argv.uninstall,
|
|
74
|
+
// eslint-disable-next-line no-console
|
|
75
|
+
}).catch(console.error)];
|
|
119
76
|
case 1:
|
|
120
|
-
if (!(_a.sent())) {
|
|
121
|
-
return [2 /*return*/, {}];
|
|
122
|
-
}
|
|
123
|
-
(0, Logging_1.nl)();
|
|
124
|
-
userAnswers = { continue: true };
|
|
125
|
-
packageManager = (0, package_manager_1.detectPackageManger)();
|
|
126
|
-
hasCompatibleReactNativeVersion = (0, Package_1.checkPackageVersion)(this._readAppPackage(), exports.REACT_NATIVE_PACKAGE, exports.COMPATIBLE_REACT_NATIVE_VERSIONS, true);
|
|
127
|
-
if (!(!hasCompatibleReactNativeVersion && !this._argv.quiet)) return [3 /*break*/, 3];
|
|
128
|
-
return [4 /*yield*/, (0, inquirer_1.prompt)({
|
|
129
|
-
message: "Your version of React Native is not compatible with Sentry's React Native SDK. Do you want to continue?",
|
|
130
|
-
name: 'continue',
|
|
131
|
-
default: false,
|
|
132
|
-
type: 'confirm',
|
|
133
|
-
})];
|
|
134
|
-
case 2:
|
|
135
|
-
userAnswers = _a.sent();
|
|
136
|
-
(0, Logging_1.nl)();
|
|
137
|
-
_a.label = 3;
|
|
138
|
-
case 3:
|
|
139
|
-
if (!userAnswers.continue) {
|
|
140
|
-
throw new Error("Please upgrade to a version that is compatible with ".concat(exports.COMPATIBLE_REACT_NATIVE_VERSIONS, ". Or use ").concat(exports.DOCS_MANUAL_STEPS));
|
|
141
|
-
}
|
|
142
|
-
if (!packageManager) return [3 /*break*/, 5];
|
|
143
|
-
BottomBar_1.BottomBar.show("Adding ".concat(exports.SENTRY_REACT_NATIVE_PACKAGE, "..."));
|
|
144
|
-
return [4 /*yield*/, (0, package_manager_1.installPackageWithPackageManager)(packageManager, exports.SENTRY_REACT_NATIVE_PACKAGE)];
|
|
145
|
-
case 4:
|
|
146
|
-
_a.sent();
|
|
147
|
-
BottomBar_1.BottomBar.hide();
|
|
148
|
-
(0, Logging_1.green)("\u2713 Added `".concat(exports.SENTRY_REACT_NATIVE_PACKAGE, "`"));
|
|
149
|
-
_a.label = 5;
|
|
150
|
-
case 5:
|
|
151
|
-
hasCompatibleSentryReactNativeVersion = (0, Package_1.checkPackageVersion)(this._readAppPackage(), exports.SENTRY_REACT_NATIVE_PACKAGE, exports.COMPATIBLE_SDK_VERSION, true);
|
|
152
|
-
if (!(!hasCompatibleSentryReactNativeVersion && !this._argv.quiet)) return [3 /*break*/, 7];
|
|
153
|
-
return [4 /*yield*/, (0, inquirer_1.prompt)({
|
|
154
|
-
message: "Your version of ".concat(exports.SENTRY_REACT_NATIVE_PACKAGE, " is not compatible with this wizard. Do you want to continue?"),
|
|
155
|
-
name: 'continue',
|
|
156
|
-
default: false,
|
|
157
|
-
type: 'confirm',
|
|
158
|
-
})];
|
|
159
|
-
case 6:
|
|
160
|
-
userAnswers = _a.sent();
|
|
161
|
-
(0, Logging_1.nl)();
|
|
162
|
-
_a.label = 7;
|
|
163
|
-
case 7:
|
|
164
|
-
if (!userAnswers.continue) {
|
|
165
|
-
throw new Error("Please upgrade to a version that is compatible with ".concat(exports.COMPATIBLE_SDK_VERSION, "."));
|
|
166
|
-
}
|
|
167
|
-
sentryCliProperties = this._sentryCli.convertAnswersToProperties(answers);
|
|
168
|
-
promises = this.getPlatforms(answers).map(function (platform) { return __awaiter(_this, void 0, void 0, function () {
|
|
169
|
-
var e_1;
|
|
170
|
-
return __generator(this, function (_a) {
|
|
171
|
-
switch (_a.label) {
|
|
172
|
-
case 0:
|
|
173
|
-
_a.trys.push([0, 8, , 9]);
|
|
174
|
-
if (!(platform === 'ios')) return [3 /*break*/, 3];
|
|
175
|
-
return [4 /*yield*/, (0, File_1.patchMatchingFile)('ios/*.xcodeproj/project.pbxproj', this._patchXcodeProj.bind(this))];
|
|
176
|
-
case 1:
|
|
177
|
-
_a.sent();
|
|
178
|
-
(0, Logging_1.green)('✓ Patched build script in Xcode project.');
|
|
179
|
-
BottomBar_1.BottomBar.show('Adding Sentry pods...');
|
|
180
|
-
return [4 /*yield*/, this._podInstall()];
|
|
181
|
-
case 2:
|
|
182
|
-
_a.sent();
|
|
183
|
-
BottomBar_1.BottomBar.hide();
|
|
184
|
-
(0, Logging_1.green)('✓ Pods installed.');
|
|
185
|
-
return [3 /*break*/, 5];
|
|
186
|
-
case 3: return [4 /*yield*/, (0, File_1.patchMatchingFile)('**/app/build.gradle', this._patchBuildGradle.bind(this))];
|
|
187
|
-
case 4:
|
|
188
|
-
_a.sent();
|
|
189
|
-
(0, Logging_1.green)('✓ Patched build.gradle file.');
|
|
190
|
-
_a.label = 5;
|
|
191
|
-
case 5: return [4 /*yield*/, this._patchJsSentryInit(platform, answers)];
|
|
192
|
-
case 6:
|
|
193
|
-
_a.sent();
|
|
194
|
-
return [4 /*yield*/, this._addSentryProperties(platform, sentryCliProperties)];
|
|
195
|
-
case 7:
|
|
196
|
-
_a.sent();
|
|
197
|
-
(0, Logging_1.green)("\u2713 Added sentry.properties file to ".concat(platform));
|
|
198
|
-
return [3 /*break*/, 9];
|
|
199
|
-
case 8:
|
|
200
|
-
e_1 = _a.sent();
|
|
201
|
-
(0, Logging_1.red)(e_1);
|
|
202
|
-
return [3 /*break*/, 9];
|
|
203
|
-
case 9: return [2 /*return*/];
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}); });
|
|
207
|
-
return [4 /*yield*/, Promise.all(promises)];
|
|
208
|
-
case 8:
|
|
209
|
-
_a.sent();
|
|
210
|
-
host = null;
|
|
211
|
-
try {
|
|
212
|
-
host = new url_1.URL(this.url || '').host;
|
|
213
|
-
}
|
|
214
|
-
catch (_error) {
|
|
215
|
-
// ignore
|
|
216
|
-
}
|
|
217
|
-
orgSlug = _.get(answers, 'config.organization.slug', null);
|
|
218
|
-
projectId = _.get(answers, 'config.project.id', null);
|
|
219
|
-
projectIssuesUrl = host && orgSlug && projectId
|
|
220
|
-
? "https://".concat(orgSlug, ".").concat(host, "/issues/?project=").concat(projectId)
|
|
221
|
-
: null;
|
|
222
|
-
(0, Logging_1.l)("\nTo make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n");
|
|
223
|
-
if (projectIssuesUrl) {
|
|
224
|
-
(0, Logging_1.l)("After that check your project issues:");
|
|
225
|
-
(0, Logging_1.l)(projectIssuesUrl);
|
|
226
|
-
(0, Logging_1.nl)();
|
|
227
|
-
}
|
|
228
|
-
(0, Logging_1.l)("<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>");
|
|
229
|
-
(0, Logging_1.nl)();
|
|
230
|
-
if (!!this._argv.quiet) return [3 /*break*/, 10];
|
|
231
|
-
return [4 /*yield*/, (0, inquirer_1.prompt)({
|
|
232
|
-
message: 'Have you successfully sent a test event?',
|
|
233
|
-
name: 'snippet',
|
|
234
|
-
default: true,
|
|
235
|
-
type: 'confirm',
|
|
236
|
-
})];
|
|
237
|
-
case 9:
|
|
238
|
-
_a.sent();
|
|
239
|
-
_a.label = 10;
|
|
240
|
-
case 10: return [2 /*return*/, answers];
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
};
|
|
245
|
-
ReactNative.prototype.uninstall = function (_answers) {
|
|
246
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
247
|
-
return __generator(this, function (_a) {
|
|
248
|
-
switch (_a.label) {
|
|
249
|
-
case 0: return [4 /*yield*/, (0, File_1.patchMatchingFile)('**/*.xcodeproj/project.pbxproj', this._unpatchXcodeProj.bind(this))];
|
|
250
|
-
case 1:
|
|
251
|
-
_a.sent();
|
|
252
|
-
return [4 /*yield*/, (0, File_1.patchMatchingFile)('**/app/build.gradle', this._unpatchBuildGradle.bind(this))];
|
|
253
|
-
case 2:
|
|
254
77
|
_a.sent();
|
|
255
78
|
return [2 /*return*/, {}];
|
|
256
79
|
}
|
|
257
80
|
});
|
|
258
81
|
});
|
|
259
82
|
};
|
|
260
|
-
|
|
261
|
-
ReactNative.prototype._shouldConfigurePlatform = function (platform) {
|
|
83
|
+
ReactNative.prototype.shouldConfigure = function (_answers) {
|
|
262
84
|
return __awaiter(this, void 0, void 0, function () {
|
|
263
|
-
var result, regex;
|
|
264
85
|
return __generator(this, function (_a) {
|
|
265
|
-
|
|
266
|
-
if (!(0, File_1.exists)("".concat(platform, "/sentry.properties"))) {
|
|
267
|
-
result = true;
|
|
268
|
-
this.debug("".concat(platform, "/sentry.properties not exists"));
|
|
269
|
-
}
|
|
270
|
-
if (!(0, File_1.matchesContent)('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {
|
|
271
|
-
result = true;
|
|
272
|
-
this.debug('**/*.xcodeproj/project.pbxproj not matched');
|
|
273
|
-
}
|
|
274
|
-
if (!(0, File_1.matchesContent)('**/app/build.gradle', /sentry\.gradle/gi)) {
|
|
275
|
-
result = true;
|
|
276
|
-
this.debug('**/app/build.gradle not matched');
|
|
277
|
-
}
|
|
278
|
-
regex = /Sentry/gi;
|
|
279
|
-
if ((0, File_1.exists)("index.".concat(platform, ".js")) &&
|
|
280
|
-
!(0, File_1.matchesContent)("index.".concat(platform, ".js"), regex)) {
|
|
281
|
-
result = true;
|
|
282
|
-
this.debug("index.".concat(platform, ".js not matched"));
|
|
283
|
-
}
|
|
284
|
-
if ((0, File_1.exists)('App.js') && !(0, File_1.matchesContent)('App.js', regex)) {
|
|
285
|
-
result = true;
|
|
286
|
-
this.debug('index.js or App.js not matched');
|
|
287
|
-
}
|
|
288
|
-
if (this._argv.uninstall) {
|
|
289
|
-
// if we uninstall we need to invert the result so we remove already patched
|
|
290
|
-
// but leave untouched platforms as they are
|
|
291
|
-
return [2 /*return*/, !result];
|
|
292
|
-
}
|
|
293
|
-
return [2 /*return*/, result];
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
};
|
|
297
|
-
ReactNative.prototype._readAppPackage = function () {
|
|
298
|
-
var appPackage = {};
|
|
299
|
-
try {
|
|
300
|
-
appPackage = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
|
|
301
|
-
}
|
|
302
|
-
catch (_a) {
|
|
303
|
-
// We don't need to have this
|
|
304
|
-
}
|
|
305
|
-
return appPackage;
|
|
306
|
-
};
|
|
307
|
-
ReactNative.prototype._podInstall = function () {
|
|
308
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
309
|
-
return __generator(this, function (_a) {
|
|
310
|
-
switch (_a.label) {
|
|
311
|
-
case 0: return [4 /*yield*/, (0, util_1.promisify)(child_process_1.exec)('npx --yes pod-install --non-interactive --quiet')];
|
|
312
|
-
case 1:
|
|
313
|
-
_a.sent();
|
|
314
|
-
return [2 /*return*/];
|
|
315
|
-
}
|
|
316
|
-
});
|
|
317
|
-
});
|
|
318
|
-
};
|
|
319
|
-
ReactNative.prototype._patchJsSentryInit = function (platform, answers) {
|
|
320
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
321
|
-
var prefixGlob, suffixGlob, platformGlob, universalGlob, jsFileGlob, jsFileToPatch;
|
|
322
|
-
return __generator(this, function (_a) {
|
|
323
|
-
switch (_a.label) {
|
|
324
|
-
case 0:
|
|
325
|
-
prefixGlob = '{.,./src}';
|
|
326
|
-
suffixGlob = '@(j|t|cj|mj)s?(x)';
|
|
327
|
-
platformGlob = "index.".concat(platform, ".").concat(suffixGlob);
|
|
328
|
-
universalGlob = "App.".concat(suffixGlob);
|
|
329
|
-
jsFileGlob = "".concat(prefixGlob, "/+(").concat(platformGlob, "|").concat(universalGlob, ")");
|
|
330
|
-
jsFileToPatch = (0, File_1.matchFiles)(jsFileGlob);
|
|
331
|
-
if (!(jsFileToPatch.length !== 0)) return [3 /*break*/, 2];
|
|
332
|
-
return [4 /*yield*/, (0, File_1.patchMatchingFile)(jsFileGlob, this._patchJs.bind(this), answers, platform)];
|
|
333
|
-
case 1:
|
|
334
|
-
_a.sent();
|
|
335
|
-
(0, Logging_1.green)("\u2713 Patched ".concat(jsFileToPatch.join(', '), " file(s)."));
|
|
336
|
-
return [3 /*break*/, 3];
|
|
337
|
-
case 2:
|
|
338
|
-
(0, Logging_1.red)("\u2717 Could not find ".concat(platformGlob, " nor ").concat(universalGlob, " files."));
|
|
339
|
-
(0, Logging_1.red)('✗ Please, visit https://docs.sentry.io/platforms/react-native');
|
|
340
|
-
_a.label = 3;
|
|
341
|
-
case 3: return [2 /*return*/];
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
};
|
|
346
|
-
ReactNative.prototype._addSentryProperties = function (platform, properties) {
|
|
347
|
-
var _this = this;
|
|
348
|
-
var rv = Promise.resolve();
|
|
349
|
-
// This will create the ios/android folder before trying to write
|
|
350
|
-
// sentry.properties in it which would fail otherwise
|
|
351
|
-
if (!fs.existsSync(platform)) {
|
|
352
|
-
(0, Logging_1.dim)("".concat(platform, " folder did not exist, creating it."));
|
|
353
|
-
fs.mkdirSync(platform);
|
|
354
|
-
}
|
|
355
|
-
var fn = path.join(platform, 'sentry.properties');
|
|
356
|
-
if (platform === 'android' && properties['cli/executable']) {
|
|
357
|
-
// We don't need to write the sentry-cli path in the properties file
|
|
358
|
-
// since our gradle plugins already pick it up on the correct spot
|
|
359
|
-
delete properties['cli/executable'];
|
|
360
|
-
}
|
|
361
|
-
rv = rv.then(function () {
|
|
362
|
-
return fs.writeFileSync(fn, _this._sentryCli.dumpProperties(properties));
|
|
363
|
-
});
|
|
364
|
-
return rv;
|
|
365
|
-
};
|
|
366
|
-
ReactNative.prototype._patchJs = function (contents, _filename, answers, platform) {
|
|
367
|
-
// since the init call could live in other places too, we really only
|
|
368
|
-
// want to do this if we managed to patch any of the other files as well.
|
|
369
|
-
if (contents.match(/Sentry.config\(/)) {
|
|
370
|
-
return Promise.resolve(null);
|
|
371
|
-
}
|
|
372
|
-
// if we match @sentry\/react-native somewhere, we already patched the file
|
|
373
|
-
// and no longer need to
|
|
374
|
-
if (contents.match('@sentry/react-native')) {
|
|
375
|
-
return Promise.resolve(contents);
|
|
376
|
-
}
|
|
377
|
-
var dsn = '__DSN__';
|
|
378
|
-
this.getPlatforms(answers).forEach(function (selectedPlatform) {
|
|
379
|
-
if (platform && selectedPlatform === platform) {
|
|
380
|
-
dsn = _.get(answers, 'config.dsn.public', null);
|
|
381
|
-
}
|
|
382
|
-
else if (platform === undefined) {
|
|
383
|
-
dsn = _.get(answers, 'config.dsn.public', null);
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
return Promise.resolve(contents.replace(/^([^]*)(import\s+[^;]*?;$)/m, function (match) {
|
|
387
|
-
// eslint-disable-next-line prefer-template
|
|
388
|
-
return match +
|
|
389
|
-
"\n\nimport * as Sentry from '@sentry/react-native';\n\n" +
|
|
390
|
-
'Sentry.init({ \n' +
|
|
391
|
-
" dsn: '".concat(dsn, "', \n") +
|
|
392
|
-
'});\n';
|
|
393
|
-
}));
|
|
394
|
-
};
|
|
395
|
-
// ANDROID -----------------------------------------
|
|
396
|
-
ReactNative.prototype._patchBuildGradle = function (contents) {
|
|
397
|
-
var applyFrom = 'apply from: "../../node_modules/@sentry/react-native/sentry.gradle"';
|
|
398
|
-
if (contents.indexOf(applyFrom) >= 0) {
|
|
399
|
-
return Promise.resolve(null);
|
|
400
|
-
}
|
|
401
|
-
return Promise.resolve(contents.replace(ReactNative._buildGradleAndroidSectionBeginning,
|
|
402
|
-
// eslint-disable-next-line prefer-template
|
|
403
|
-
function (match) { return applyFrom + '\n' + match; }));
|
|
404
|
-
};
|
|
405
|
-
ReactNative.prototype._unpatchBuildGradle = function (contents) {
|
|
406
|
-
return Promise.resolve(contents.replace(/^\s*apply from: ["']..\/..\/node_modules\/@sentry\/react-native\/sentry.gradle["'];?\s*?\r?\n/m, ''));
|
|
407
|
-
};
|
|
408
|
-
// IOS -----------------------------------------
|
|
409
|
-
ReactNative.prototype._patchExistingXcodeBuildScripts = function (buildScripts) {
|
|
410
|
-
for (var _i = 0, buildScripts_1 = buildScripts; _i < buildScripts_1.length; _i++) {
|
|
411
|
-
var script = buildScripts_1[_i];
|
|
412
|
-
if (!script.shellScript.match(/\/scripts\/react-native-xcode\.sh/i) ||
|
|
413
|
-
script.shellScript.match(/sentry-cli\s+react-native\s+xcode/i)) {
|
|
414
|
-
continue;
|
|
415
|
-
}
|
|
416
|
-
var code = JSON.parse(script.shellScript);
|
|
417
|
-
code =
|
|
418
|
-
// eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands
|
|
419
|
-
'export SENTRY_PROPERTIES=sentry.properties\n' +
|
|
420
|
-
'export EXTRA_PACKAGER_ARGS="--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map"\n' +
|
|
421
|
-
code.replace('$REACT_NATIVE_XCODE', function () {
|
|
422
|
-
// eslint-disable-next-line no-useless-escape
|
|
423
|
-
return '\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\"';
|
|
424
|
-
}) +
|
|
425
|
-
'\n/bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"\n';
|
|
426
|
-
script.shellScript = JSON.stringify(code);
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
ReactNative.prototype._addNewXcodeBuildPhaseForSymbols = function (buildScripts, proj) {
|
|
430
|
-
for (var _i = 0, buildScripts_2 = buildScripts; _i < buildScripts_2.length; _i++) {
|
|
431
|
-
var script = buildScripts_2[_i];
|
|
432
|
-
if (script.shellScript.match(/sentry-cli\s+(upload-dsym|debug-files upload)/)) {
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Upload Debug Symbols to Sentry', null, {
|
|
437
|
-
shellPath: '/bin/sh',
|
|
438
|
-
shellScript: "\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi \nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n",
|
|
439
|
-
});
|
|
440
|
-
};
|
|
441
|
-
ReactNative.prototype._patchXcodeProj = function (contents, filename) {
|
|
442
|
-
var _this = this;
|
|
443
|
-
var proj = xcode.project(filename);
|
|
444
|
-
return new Promise(function (resolve, reject) {
|
|
445
|
-
proj.parse(function (err) {
|
|
446
|
-
if (err) {
|
|
447
|
-
reject(err);
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
var buildScripts = [];
|
|
451
|
-
for (var key in proj.hash.project.objects.PBXShellScriptBuildPhase ||
|
|
452
|
-
{}) {
|
|
453
|
-
if (
|
|
454
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
455
|
-
proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(key)) {
|
|
456
|
-
var val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];
|
|
457
|
-
if (val.isa) {
|
|
458
|
-
buildScripts.push(val);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
try {
|
|
463
|
-
_this._patchExistingXcodeBuildScripts(buildScripts);
|
|
464
|
-
}
|
|
465
|
-
catch (e) {
|
|
466
|
-
(0, Logging_1.red)(e);
|
|
467
|
-
}
|
|
468
|
-
try {
|
|
469
|
-
_this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);
|
|
470
|
-
}
|
|
471
|
-
catch (e) {
|
|
472
|
-
(0, Logging_1.red)(e);
|
|
473
|
-
}
|
|
474
|
-
// we always modify the xcode file in memory but we only want to save it
|
|
475
|
-
// in case the user wants configuration for ios. This is why we check
|
|
476
|
-
// here first if changes are made before we might prompt the platform
|
|
477
|
-
// continue prompt.
|
|
478
|
-
var newContents = proj.writeSync();
|
|
479
|
-
if (newContents === contents) {
|
|
480
|
-
resolve(undefined);
|
|
481
|
-
}
|
|
482
|
-
else {
|
|
483
|
-
resolve(newContents);
|
|
484
|
-
}
|
|
485
|
-
});
|
|
486
|
-
});
|
|
487
|
-
};
|
|
488
|
-
ReactNative.prototype._unpatchXcodeBuildScripts = function (proj) {
|
|
489
|
-
var scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};
|
|
490
|
-
var firstTarget = proj.getFirstTarget().uuid;
|
|
491
|
-
var nativeTargets = proj.hash.project.objects.PBXNativeTarget;
|
|
492
|
-
// scripts to patch partially. Run this first so that we don't
|
|
493
|
-
// accidentally delete some scripts later entirely that we only want to
|
|
494
|
-
// rewrite.
|
|
495
|
-
for (var _i = 0, _a = Object.keys(scripts); _i < _a.length; _i++) {
|
|
496
|
-
var key = _a[_i];
|
|
497
|
-
var script = scripts[key];
|
|
498
|
-
// ignore comments
|
|
499
|
-
if (typeof script === 'string') {
|
|
500
|
-
continue;
|
|
501
|
-
}
|
|
502
|
-
// ignore scripts that do not invoke the react-native-xcode command.
|
|
503
|
-
if (!script.shellScript.match(/sentry-cli\s+react-native\s+xcode/i)) {
|
|
504
|
-
continue;
|
|
505
|
-
}
|
|
506
|
-
script.shellScript = JSON.stringify(JSON.parse(script.shellScript)
|
|
507
|
-
// remove sentry properties export
|
|
508
|
-
.replace(/^export SENTRY_PROPERTIES=sentry.properties\r?\n/m, '')
|
|
509
|
-
.replace(/^\/bin\/sh .*?..\/node_modules\/@sentry\/react-native\/scripts\/collect-modules.sh"?\r?\n/m, '')
|
|
510
|
-
// unwrap react-native-xcode.sh command. In case someone replaced it
|
|
511
|
-
// entirely with the sentry-cli command we need to put the original
|
|
512
|
-
// version back in.
|
|
513
|
-
.replace(/\.\.\/node_modules\/@sentry\/cli\/bin\/sentry-cli\s+react-native\s+xcode\s+\$REACT_NATIVE_XCODE/i, '$REACT_NATIVE_XCODE'));
|
|
514
|
-
}
|
|
515
|
-
// scripts to kill entirely.
|
|
516
|
-
for (var _b = 0, _c = Object.keys(scripts); _b < _c.length; _b++) {
|
|
517
|
-
var key = _c[_b];
|
|
518
|
-
var script = scripts[key];
|
|
519
|
-
// ignore comments and keys that got deleted
|
|
520
|
-
if (typeof script === 'string' || script === undefined) {
|
|
521
|
-
continue;
|
|
522
|
-
}
|
|
523
|
-
if (script.shellScript.match(/@sentry\/cli\/bin\/sentry-cli\s+(upload-dsym|debug-files upload)\b/)) {
|
|
524
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
525
|
-
delete scripts[key];
|
|
526
|
-
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
|
527
|
-
delete scripts["".concat(key, "_comment")];
|
|
528
|
-
var phases = nativeTargets[firstTarget].buildPhases;
|
|
529
|
-
if (phases) {
|
|
530
|
-
for (var i = 0; i < phases.length; i++) {
|
|
531
|
-
if (phases[i].value === key) {
|
|
532
|
-
phases.splice(i, 1);
|
|
533
|
-
break;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
continue;
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
};
|
|
541
|
-
ReactNative.prototype._unpatchXcodeProj = function (_contents, filename) {
|
|
542
|
-
var _this = this;
|
|
543
|
-
var proj = xcode.project(filename);
|
|
544
|
-
return new Promise(function (resolve, reject) {
|
|
545
|
-
proj.parse(function (err) {
|
|
546
|
-
if (err) {
|
|
547
|
-
reject(err);
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
_this._unpatchXcodeBuildScripts(proj);
|
|
551
|
-
resolve(proj.writeSync());
|
|
86
|
+
return [2 /*return*/, this._shouldConfigure];
|
|
552
87
|
});
|
|
553
88
|
});
|
|
554
89
|
};
|
|
555
|
-
/**
|
|
556
|
-
* All React Native versions have app/build.gradle with android section.
|
|
557
|
-
*/
|
|
558
|
-
ReactNative._buildGradleAndroidSectionBeginning = /^android {/m;
|
|
559
90
|
return ReactNative;
|
|
560
|
-
}(
|
|
91
|
+
}(BaseIntegration_1.BaseIntegration));
|
|
92
|
+
exports.ReactNative = ReactNative;
|
|
561
93
|
//# sourceMappingURL=ReactNative.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+CAAqC;AACrC,qCAAyB;AAEzB,qCAAkC;AAClC,wCAA4B;AAC5B,yCAA6B;AAC7B,6BAAiC;AAGjC,0CAK2B;AAC3B,gDAA8D;AAC9D,gDAA2D;AAC3D,sEAG4C;AAC5C,oDAAmD;AACnD,iDAAgD;AAChD,oDAAmD;AACnD,2BAA0B;AAE1B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAElB,QAAA,gCAAgC,GAAG,UAAU,CAAC;AAC9C,QAAA,sBAAsB,GAAG,UAAU,CAAC;AAEpC,QAAA,2BAA2B,GAAG,sBAAsB,CAAC;AACrD,QAAA,oBAAoB,GAAG,cAAc,CAAC;AAEtC,QAAA,iBAAiB,GAC5B,0EAA0E,CAAC;AAE7E;IAAiC,+BAAa;IAW5C,qBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAGb;QAJ4B,WAAK,GAAL,KAAK,CAAM;QAEtC,KAAI,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC;QACrB,KAAI,CAAC,UAAU,GAAG,IAAI,qBAAS,CAAC,KAAI,CAAC,KAAK,CAAC,CAAC;;IAC9C,CAAC;IAEY,0BAAI,GAAjB,UAAkB,OAAgB;;;;;;;wBAChC,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;4BACxB,sBAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAC;yBAChC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I,GAAG,EAAE;oBACP,MAAM,CAAC,GAAG,CAAC,CAAC;oBACZ,OAAO;iBACR;gBAED,KAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;gBACrC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IA/hBD;;OAEG;IACY,+CAAmC,GAAG,aAAa,CAAC;IA6hBrE,kBAAC;CAAA,AAjiBD,CAAiC,6BAAa,GAiiB7C","sourcesContent":["/* eslint-disable max-lines */\nimport { exec } from 'child_process';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\nimport { promisify } from 'util';\n\nimport type { Args } from '../../Constants';\nimport {\n exists,\n matchesContent,\n matchFiles,\n patchMatchingFile,\n} from '../../Helper/File';\nimport { dim, green, l, nl, red } from '../../Helper/Logging';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport {\n detectPackageManger,\n installPackageWithPackageManager,\n} from '../../../src/utils/package-manager';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { MobileProject } from './MobileProject';\nimport { BottomBar } from '../../Helper/BottomBar';\nimport { URL } from 'url';\n\nconst xcode = require('xcode');\n\nexport const COMPATIBLE_REACT_NATIVE_VERSIONS = '>=0.69.0';\nexport const COMPATIBLE_SDK_VERSION = '>= 5.0.0';\n\nexport const SENTRY_REACT_NATIVE_PACKAGE = '@sentry/react-native';\nexport const REACT_NATIVE_PACKAGE = 'react-native';\n\nexport const DOCS_MANUAL_STEPS =\n 'https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/';\n\nexport class ReactNative extends MobileProject {\n /**\n * All React Native versions have app/build.gradle with android section.\n */\n private static _buildGradleAndroidSectionBeginning = /^android {/m;\n\n private url: string | undefined;\n\n protected _answers: Answers;\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this.url = _argv.url;\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n if (this._argv.uninstall) {\n return this.uninstall(answers);\n }\n if (!(await this.shouldEmit(answers))) {\n return {};\n }\n nl();\n\n let userAnswers: Answers = { continue: true };\n const packageManager = detectPackageManger();\n\n const hasCompatibleReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n REACT_NATIVE_PACKAGE,\n COMPATIBLE_REACT_NATIVE_VERSIONS,\n true,\n );\n if (!hasCompatibleReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n \"Your version of React Native is not compatible with Sentry's React Native SDK. Do you want to continue?\",\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_REACT_NATIVE_VERSIONS}. Or use ${DOCS_MANUAL_STEPS}`,\n );\n }\n\n if (packageManager) {\n BottomBar.show(`Adding ${SENTRY_REACT_NATIVE_PACKAGE}...`);\n await installPackageWithPackageManager(\n packageManager,\n SENTRY_REACT_NATIVE_PACKAGE,\n );\n BottomBar.hide();\n green(`✓ Added \\`${SENTRY_REACT_NATIVE_PACKAGE}\\``);\n }\n const hasCompatibleSentryReactNativeVersion = checkPackageVersion(\n this._readAppPackage(),\n SENTRY_REACT_NATIVE_PACKAGE,\n COMPATIBLE_SDK_VERSION,\n true,\n );\n if (!hasCompatibleSentryReactNativeVersion && !this._argv.quiet) {\n userAnswers = await prompt({\n message: `Your version of ${SENTRY_REACT_NATIVE_PACKAGE} is not compatible with this wizard. Do you want to continue?`,\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n nl();\n }\n if (!userAnswers.continue) {\n throw new Error(\n `Please upgrade to a version that is compatible with ${COMPATIBLE_SDK_VERSION}.`,\n );\n }\n\n const sentryCliProperties =\n this._sentryCli.convertAnswersToProperties(answers);\n\n const promises = this.getPlatforms(answers).map(\n async (platform: string) => {\n try {\n if (platform === 'ios') {\n await patchMatchingFile(\n 'ios/*.xcodeproj/project.pbxproj',\n this._patchXcodeProj.bind(this),\n );\n green('✓ Patched build script in Xcode project.');\n BottomBar.show('Adding Sentry pods...');\n await this._podInstall();\n BottomBar.hide();\n green('✓ Pods installed.');\n } else {\n await patchMatchingFile(\n '**/app/build.gradle',\n this._patchBuildGradle.bind(this),\n );\n green('✓ Patched build.gradle file.');\n }\n await this._patchJsSentryInit(platform, answers);\n await this._addSentryProperties(platform, sentryCliProperties);\n green(`✓ Added sentry.properties file to ${platform}`);\n } catch (e) {\n red(e);\n }\n },\n );\n\n await Promise.all(promises);\n\n let host: string | null = null;\n try {\n host = new URL(this.url || '').host;\n } catch (_error) {\n // ignore\n }\n const orgSlug = _.get(answers, 'config.organization.slug', null);\n const projectId = _.get(answers, 'config.project.id', null);\n const projectIssuesUrl =\n host && orgSlug && projectId\n ? `https://${orgSlug}.${host}/issues/?project=${projectId}`\n : null;\n\n l(`\nTo make sure everything is set up correctly, put the following code snippet into your application.\nThe snippet will create a button that, when tapped, sends a test event to Sentry.\n`);\n\n if (projectIssuesUrl) {\n l(`After that check your project issues:`);\n l(projectIssuesUrl);\n nl();\n }\n\n l(\n `<Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>`,\n );\n nl();\n\n if (!this._argv.quiet) {\n await prompt({\n message: 'Have you successfully sent a test event?',\n name: 'snippet',\n default: true,\n type: 'confirm',\n });\n }\n\n return answers;\n }\n\n public async uninstall(_answers: Answers): Promise<Answers> {\n await patchMatchingFile(\n '**/*.xcodeproj/project.pbxproj',\n this._unpatchXcodeProj.bind(this),\n );\n await patchMatchingFile(\n '**/app/build.gradle',\n this._unpatchBuildGradle.bind(this),\n );\n return {};\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n protected async _shouldConfigurePlatform(platform: string): Promise<boolean> {\n let result = false;\n\n if (!exists(`${platform}/sentry.properties`)) {\n result = true;\n this.debug(`${platform}/sentry.properties not exists`);\n }\n\n if (!matchesContent('**/*.xcodeproj/project.pbxproj', /sentry-cli/gi)) {\n result = true;\n this.debug('**/*.xcodeproj/project.pbxproj not matched');\n }\n\n if (!matchesContent('**/app/build.gradle', /sentry\\.gradle/gi)) {\n result = true;\n this.debug('**/app/build.gradle not matched');\n }\n\n const regex = /Sentry/gi;\n if (\n exists(`index.${platform}.js`) &&\n !matchesContent(`index.${platform}.js`, regex)\n ) {\n result = true;\n this.debug(`index.${platform}.js not matched`);\n }\n if (exists('App.js') && !matchesContent('App.js', regex)) {\n result = true;\n this.debug('index.js or App.js not matched');\n }\n\n if (this._argv.uninstall) {\n // if we uninstall we need to invert the result so we remove already patched\n // but leave untouched platforms as they are\n return !result;\n }\n\n return result;\n }\n\n private _readAppPackage(): Record<string, unknown> {\n let appPackage: Record<string, unknown> = {};\n\n try {\n appPackage = JSON.parse(\n fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'),\n );\n } catch {\n // We don't need to have this\n }\n\n return appPackage;\n }\n\n private async _podInstall(): Promise<void> {\n await promisify(exec)('npx --yes pod-install --non-interactive --quiet');\n }\n\n private async _patchJsSentryInit(\n platform: string,\n answers: Answers,\n ): Promise<void> {\n const prefixGlob = '{.,./src}';\n const suffixGlob = '@(j|t|cj|mj)s?(x)';\n const platformGlob = `index.${platform}.${suffixGlob}`;\n // rm 0.49 introduced an App.js for both platforms\n const universalGlob = `App.${suffixGlob}`;\n const jsFileGlob = `${prefixGlob}/+(${platformGlob}|${universalGlob})`;\n\n const jsFileToPatch = matchFiles(jsFileGlob);\n if (jsFileToPatch.length !== 0) {\n await patchMatchingFile(\n jsFileGlob,\n this._patchJs.bind(this),\n answers,\n platform,\n );\n green(`✓ Patched ${jsFileToPatch.join(', ')} file(s).`);\n } else {\n red(`✗ Could not find ${platformGlob} nor ${universalGlob} files.`);\n red('✗ Please, visit https://docs.sentry.io/platforms/react-native');\n }\n }\n\n private _addSentryProperties(\n platform: string,\n properties: any,\n ): Promise<void> {\n let rv = Promise.resolve();\n\n // This will create the ios/android folder before trying to write\n // sentry.properties in it which would fail otherwise\n if (!fs.existsSync(platform)) {\n dim(`${platform} folder did not exist, creating it.`);\n fs.mkdirSync(platform);\n }\n const fn = path.join(platform, 'sentry.properties');\n\n if (platform === 'android' && properties['cli/executable']) {\n // We don't need to write the sentry-cli path in the properties file\n // since our gradle plugins already pick it up on the correct spot\n delete properties['cli/executable'];\n }\n rv = rv.then(() =>\n fs.writeFileSync(fn, this._sentryCli.dumpProperties(properties)),\n );\n\n return rv;\n }\n\n private _patchJs(\n contents: string,\n _filename: string,\n answers: Answers,\n platform?: string,\n ): Promise<string | null> {\n // since the init call could live in other places too, we really only\n // want to do this if we managed to patch any of the other files as well.\n if (contents.match(/Sentry.config\\(/)) {\n return Promise.resolve(null);\n }\n\n // if we match @sentry\\/react-native somewhere, we already patched the file\n // and no longer need to\n if (contents.match('@sentry/react-native')) {\n return Promise.resolve(contents);\n }\n\n let dsn = '__DSN__';\n this.getPlatforms(answers).forEach((selectedPlatform: string) => {\n if (platform && selectedPlatform === platform) {\n dsn = _.get(answers, 'config.dsn.public', null);\n } else if (platform === undefined) {\n dsn = _.get(answers, 'config.dsn.public', null);\n }\n });\n\n return Promise.resolve(\n contents.replace(\n /^([^]*)(import\\s+[^;]*?;$)/m,\n (match) =>\n // eslint-disable-next-line prefer-template\n match +\n \"\\n\\nimport * as Sentry from '@sentry/react-native';\\n\\n\" +\n 'Sentry.init({ \\n' +\n ` dsn: '${dsn}', \\n` +\n '});\\n',\n ),\n );\n }\n\n // ANDROID -----------------------------------------\n\n private _patchBuildGradle(contents: string): Promise<string | null> {\n const applyFrom =\n 'apply from: \"../../node_modules/@sentry/react-native/sentry.gradle\"';\n if (contents.indexOf(applyFrom) >= 0) {\n return Promise.resolve(null);\n }\n\n return Promise.resolve(\n contents.replace(\n ReactNative._buildGradleAndroidSectionBeginning,\n // eslint-disable-next-line prefer-template\n (match) => applyFrom + '\\n' + match,\n ),\n );\n }\n\n private _unpatchBuildGradle(contents: string): Promise<string> {\n return Promise.resolve(\n contents.replace(\n /^\\s*apply from: [\"']..\\/..\\/node_modules\\/@sentry\\/react-native\\/sentry.gradle[\"'];?\\s*?\\r?\\n/m,\n '',\n ),\n );\n }\n\n // IOS -----------------------------------------\n\n private _patchExistingXcodeBuildScripts(buildScripts: any): void {\n for (const script of buildScripts) {\n if (\n !script.shellScript.match(/\\/scripts\\/react-native-xcode\\.sh/i) ||\n script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)\n ) {\n continue;\n }\n let code = JSON.parse(script.shellScript);\n code =\n // eslint-disable-next-line prefer-template, @typescript-eslint/restrict-plus-operands\n 'export SENTRY_PROPERTIES=sentry.properties\\n' +\n 'export EXTRA_PACKAGER_ARGS=\"--sourcemap-output $DERIVED_FILE_DIR/main.jsbundle.map\"\\n' +\n code.replace(\n '$REACT_NATIVE_XCODE',\n () =>\n // eslint-disable-next-line no-useless-escape\n '\\\\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\\\\"',\n ) +\n '\\n/bin/sh -c \"$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh\"\\n';\n script.shellScript = JSON.stringify(code);\n }\n }\n\n private _addNewXcodeBuildPhaseForSymbols(buildScripts: any, proj: any): void {\n for (const script of buildScripts) {\n if (\n script.shellScript.match(\n /sentry-cli\\s+(upload-dsym|debug-files upload)/,\n )\n ) {\n return;\n }\n }\n\n proj.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n shellPath: '/bin/sh',\n shellScript: `\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n . \"$WITH_ENVIRONMENT\"\nfi \nexport SENTRY_PROPERTIES=sentry.properties\n[ \"$SENTRY_INCLUDE_NATIVE_SOURCES\" = \"true\" ] && INCLUDE_SOURCES_FLAG=\"--include-sources\" || INCLUDE_SOURCES_FLAG=\"\"\n../node_modules/@sentry/cli/bin/sentry-cli debug-files upload \"$INCLUDE_SOURCES_FLAG\" \"$DWARF_DSYM_FOLDER_PATH\"\n`,\n },\n );\n }\n\n private _patchXcodeProj(\n contents: string,\n filename: string,\n ): Promise<string | undefined> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n const buildScripts = [];\n for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||\n {}) {\n if (\n // eslint-disable-next-line no-prototype-builtins\n proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(\n key,\n )\n ) {\n const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];\n if (val.isa) {\n buildScripts.push(val);\n }\n }\n }\n\n try {\n this._patchExistingXcodeBuildScripts(buildScripts);\n } catch (e) {\n red(e);\n }\n try {\n this._addNewXcodeBuildPhaseForSymbols(buildScripts, proj);\n } catch (e) {\n red(e);\n }\n\n // we always modify the xcode file in memory but we only want to save it\n // in case the user wants configuration for ios. This is why we check\n // here first if changes are made before we might prompt the platform\n // continue prompt.\n const newContents = proj.writeSync();\n if (newContents === contents) {\n resolve(undefined);\n } else {\n resolve(newContents);\n }\n });\n });\n }\n\n private _unpatchXcodeBuildScripts(proj: any): void {\n const scripts = proj.hash.project.objects.PBXShellScriptBuildPhase || {};\n const firstTarget = proj.getFirstTarget().uuid;\n const nativeTargets = proj.hash.project.objects.PBXNativeTarget;\n\n // scripts to patch partially. Run this first so that we don't\n // accidentally delete some scripts later entirely that we only want to\n // rewrite.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments\n if (typeof script === 'string') {\n continue;\n }\n\n // ignore scripts that do not invoke the react-native-xcode command.\n if (!script.shellScript.match(/sentry-cli\\s+react-native\\s+xcode/i)) {\n continue;\n }\n\n script.shellScript = JSON.stringify(\n JSON.parse(script.shellScript)\n // remove sentry properties export\n .replace(/^export SENTRY_PROPERTIES=sentry.properties\\r?\\n/m, '')\n .replace(\n /^\\/bin\\/sh .*?..\\/node_modules\\/@sentry\\/react-native\\/scripts\\/collect-modules.sh\"?\\r?\\n/m,\n '',\n )\n // unwrap react-native-xcode.sh command. In case someone replaced it\n // entirely with the sentry-cli command we need to put the original\n // version back in.\n .replace(\n /\\.\\.\\/node_modules\\/@sentry\\/cli\\/bin\\/sentry-cli\\s+react-native\\s+xcode\\s+\\$REACT_NATIVE_XCODE/i,\n '$REACT_NATIVE_XCODE',\n ),\n );\n }\n\n // scripts to kill entirely.\n for (const key of Object.keys(scripts)) {\n const script = scripts[key];\n\n // ignore comments and keys that got deleted\n if (typeof script === 'string' || script === undefined) {\n continue;\n }\n\n if (\n script.shellScript.match(\n /@sentry\\/cli\\/bin\\/sentry-cli\\s+(upload-dsym|debug-files upload)\\b/,\n )\n ) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[key];\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete scripts[`${key}_comment`];\n const phases = nativeTargets[firstTarget].buildPhases;\n if (phases) {\n for (let i = 0; i < phases.length; i++) {\n if (phases[i].value === key) {\n phases.splice(i, 1);\n break;\n }\n }\n }\n continue;\n }\n }\n }\n\n private _unpatchXcodeProj(\n _contents: string,\n filename: string,\n ): Promise<string> {\n const proj = xcode.project(filename);\n return new Promise((resolve, reject) => {\n proj.parse((err: any) => {\n if (err) {\n reject(err);\n return;\n }\n\n this._unpatchXcodeBuildScripts(proj);\n resolve(proj.writeSync());\n });\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ReactNative.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/ReactNative.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qDAAoD;AACpD,qFAAqF;AAErF;IAAiC,+BAAe;IAE9C,qBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SAEb;QAH4B,WAAK,GAAL,KAAK,CAAM;QAEtC,KAAI,CAAC,IAAI,GAAG,KAAK,CAAC;;IACpB,CAAC;IAEY,0BAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,0CAAoB,EAAC;4BACzB,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;4BAC/B,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG;4BACnB,gBAAgB,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB;4BAC9C,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS;4BAC/B,sCAAsC;yBACvC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAA;;wBANvB,SAMuB,CAAC;wBAExB,sBAAO,EAAE,EAAC;;;;KACX;IAEY,qCAAe,GAA5B,UAA6B,QAAiB;;;gBAC5C,sBAAO,IAAI,CAAC,gBAAgB,EAAC;;;KAC9B;IACH,kBAAC;AAAD,CAAC,AAtBD,CAAiC,iCAAe,GAsB/C;AAtBY,kCAAW","sourcesContent":["import { Answers } from 'inquirer';\nimport { type Args } from '../../Constants';\nimport { BaseIntegration } from './BaseIntegration';\nimport { runReactNativeWizard } from '../../../src/react-native/react-native-wizard';\n\nexport class ReactNative extends BaseIntegration {\n argv: Args;\n public constructor(protected _argv: Args) {\n super(_argv);\n this.argv = _argv;\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runReactNativeWizard({\n promoCode: this._argv.promoCode,\n url: this._argv.url,\n telemetryEnabled: !this._argv.disableTelemetry,\n uninstall: this._argv.uninstall,\n // eslint-disable-next-line no-console\n }).catch(console.error);\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n return this._shouldConfigure;\n }\n}\n"]}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.1",
|
|
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",
|