@sentry/wizard 3.1.0 → 3.2.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/bin.ts +5 -1
  3. package/dist/bin.js +6 -1
  4. package/dist/bin.js.map +1 -1
  5. package/dist/lib/Constants.d.ts +2 -1
  6. package/dist/lib/Constants.js +5 -0
  7. package/dist/lib/Constants.js.map +1 -1
  8. package/dist/lib/Helper/File.js +25 -2
  9. package/dist/lib/Helper/File.js.map +1 -1
  10. package/dist/lib/Helper/Git.d.ts +7 -0
  11. package/dist/lib/Helper/Git.js +94 -0
  12. package/dist/lib/Helper/Git.js.map +1 -0
  13. package/dist/lib/Helper/Logging.d.ts +1 -0
  14. package/dist/lib/Helper/Logging.js +9 -2
  15. package/dist/lib/Helper/Logging.js.map +1 -1
  16. package/dist/lib/Helper/MergeConfig.js +24 -1
  17. package/dist/lib/Helper/MergeConfig.js.map +1 -1
  18. package/dist/lib/Helper/Package.d.ts +9 -0
  19. package/dist/lib/Helper/Package.js +39 -2
  20. package/dist/lib/Helper/Package.js.map +1 -1
  21. package/dist/lib/Helper/PackageManager.d.ts +1 -1
  22. package/dist/lib/Helper/PackageManager.js +32 -11
  23. package/dist/lib/Helper/PackageManager.js.map +1 -1
  24. package/dist/lib/Helper/SentryCli.d.ts +11 -0
  25. package/dist/lib/Helper/SentryCli.js +141 -2
  26. package/dist/lib/Helper/SentryCli.js.map +1 -1
  27. package/dist/lib/Helper/Wizard.js +24 -1
  28. package/dist/lib/Helper/Wizard.js.map +1 -1
  29. package/dist/lib/Helper/__tests__/MergeConfig.js +25 -2
  30. package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
  31. package/dist/lib/Setup.js +25 -2
  32. package/dist/lib/Setup.js.map +1 -1
  33. package/dist/lib/Steps/ChooseIntegration.js +28 -1
  34. package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
  35. package/dist/lib/Steps/Initial.js +25 -2
  36. package/dist/lib/Steps/Initial.js.map +1 -1
  37. package/dist/lib/Steps/Integrations/BaseIntegration.js +24 -1
  38. package/dist/lib/Steps/Integrations/BaseIntegration.js.map +1 -1
  39. package/dist/lib/Steps/Integrations/Cordova.js +25 -2
  40. package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
  41. package/dist/lib/Steps/Integrations/Electron.js +26 -3
  42. package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
  43. package/dist/lib/Steps/Integrations/MobileProject.js +24 -1
  44. package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
  45. package/dist/lib/Steps/Integrations/NextJs.d.ts +5 -11
  46. package/dist/lib/Steps/Integrations/NextJs.js +14 -343
  47. package/dist/lib/Steps/Integrations/NextJs.js.map +1 -1
  48. package/dist/lib/Steps/Integrations/ReactNative.d.ts +1 -0
  49. package/dist/lib/Steps/Integrations/ReactNative.js +67 -6
  50. package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
  51. package/dist/lib/Steps/Integrations/SvelteKit.d.ts +13 -0
  52. package/dist/lib/Steps/Integrations/SvelteKit.js +95 -0
  53. package/dist/lib/Steps/Integrations/SvelteKit.js.map +1 -0
  54. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +28 -5
  55. package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +1 -1
  56. package/dist/lib/Steps/PromptForParameters.js +24 -1
  57. package/dist/lib/Steps/PromptForParameters.js.map +1 -1
  58. package/dist/lib/Steps/SentryProjectSelector.js +25 -1
  59. package/dist/lib/Steps/SentryProjectSelector.js.map +1 -1
  60. package/dist/lib/__tests__/Setup.js +24 -1
  61. package/dist/lib/__tests__/Setup.js.map +1 -1
  62. package/dist/src/{nextjs-wizard.js → nextjs/nextjs-wizard.js} +113 -108
  63. package/dist/src/nextjs/nextjs-wizard.js.map +1 -0
  64. package/dist/src/sveltekit/sdk-example.d.ts +10 -0
  65. package/dist/src/sveltekit/sdk-example.js +106 -0
  66. package/dist/src/sveltekit/sdk-example.js.map +1 -0
  67. package/dist/src/sveltekit/sdk-setup.d.ts +13 -0
  68. package/dist/src/sveltekit/sdk-setup.js +452 -0
  69. package/dist/src/sveltekit/sdk-setup.js.map +1 -0
  70. package/dist/src/sveltekit/sentry-cli-setup.d.ts +2 -0
  71. package/dist/src/sveltekit/sentry-cli-setup.js +71 -0
  72. package/dist/src/sveltekit/sentry-cli-setup.js.map +1 -0
  73. package/dist/src/sveltekit/sveltekit-wizard.d.ts +5 -0
  74. package/dist/src/sveltekit/sveltekit-wizard.js +147 -0
  75. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -0
  76. package/dist/src/templates/nextjs-templates.js +2 -2
  77. package/dist/src/templates/nextjs-templates.js.map +1 -1
  78. package/dist/src/templates/sveltekit-templates.d.ts +12 -0
  79. package/dist/src/templates/sveltekit-templates.js +26 -0
  80. package/dist/src/templates/sveltekit-templates.js.map +1 -0
  81. package/dist/src/{clack-utils.d.ts → utils/clack-utils.d.ts} +7 -0
  82. package/dist/src/{clack-utils.js → utils/clack-utils.js} +127 -42
  83. package/dist/src/utils/clack-utils.js.map +1 -0
  84. package/lib/Constants.ts +5 -0
  85. package/lib/Helper/Git.ts +39 -0
  86. package/lib/Helper/Logging.ts +4 -0
  87. package/lib/Helper/Package.ts +17 -0
  88. package/lib/Helper/PackageManager.ts +4 -9
  89. package/lib/Helper/SentryCli.ts +74 -0
  90. package/lib/Steps/ChooseIntegration.ts +4 -0
  91. package/lib/Steps/Integrations/NextJs.ts +7 -397
  92. package/lib/Steps/Integrations/ReactNative.ts +49 -3
  93. package/lib/Steps/Integrations/SvelteKit.ts +29 -0
  94. package/lib/Steps/SentryProjectSelector.ts +1 -0
  95. package/package.json +2 -2
  96. package/src/{nextjs-wizard.ts → nextjs/nextjs-wizard.ts} +13 -44
  97. package/src/sveltekit/sdk-example.ts +56 -0
  98. package/src/sveltekit/sdk-setup.ts +431 -0
  99. package/src/sveltekit/sentry-cli-setup.ts +27 -0
  100. package/src/sveltekit/sveltekit-wizard.ts +116 -0
  101. package/src/templates/nextjs-templates.ts +2 -2
  102. package/src/templates/sveltekit-templates.ts +172 -0
  103. package/src/{clack-utils.ts → utils/clack-utils.ts} +73 -11
  104. package/dist/src/clack-utils.js.map +0 -1
  105. package/dist/src/nextjs-wizard.js.map +0 -1
  106. /package/dist/src/{nextjs-wizard.d.ts → nextjs/nextjs-wizard.d.ts} +0 -0
@@ -50,371 +50,42 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
50
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
51
  }
52
52
  };
53
- var __rest = (this && this.__rest) || function (s, e) {
54
- var t = {};
55
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
56
- t[p] = s[p];
57
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
58
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
59
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
60
- t[p[i]] = s[p[i]];
61
- }
62
- return t;
63
- };
64
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
65
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
66
- if (ar || !(i in from)) {
67
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
68
- ar[i] = from[i];
69
- }
70
- }
71
- return to.concat(ar || Array.prototype.slice.call(from));
72
- };
73
53
  Object.defineProperty(exports, "__esModule", { value: true });
74
54
  exports.NextJs = void 0;
75
- /* eslint-disable max-lines */
76
- var chalk_1 = require("chalk");
77
- var fs = require("fs");
78
- var inquirer_1 = require("inquirer");
79
- var _ = require("lodash");
80
- var path = require("path");
81
- var Logging_1 = require("../../Helper/Logging");
82
- var MergeConfig_1 = require("../../Helper/MergeConfig");
83
- var Package_1 = require("../../Helper/Package");
84
- var PackageManager_1 = require("../../Helper/PackageManager");
85
- var SentryCli_1 = require("../../Helper/SentryCli");
55
+ var nextjs_wizard_1 = require("../../../src/nextjs/nextjs-wizard");
86
56
  var BaseIntegration_1 = require("./BaseIntegration");
87
- var COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <14.0.0';
88
- var COMPATIBLE_SDK_VERSIONS = '>=7.3.0';
89
- var PROPERTIES_FILENAME = 'sentry.properties';
90
- var SENTRYCLIRC_FILENAME = '.sentryclirc';
91
- var GITIGNORE_FILENAME = '.gitignore';
92
- var CONFIG_DIR = 'configs/';
93
- var MERGEABLE_CONFIG_INFIX = 'wizardcopy';
94
- // for those files which can go in more than one place, the list of places they
95
- // could go (the first one which works will be used)
96
- var TEMPLATE_DESTINATIONS = {
97
- '_error.js': ['pages', 'src/pages'],
98
- 'next.config.js': ['.'],
99
- 'sentry.server.config.js': ['.'],
100
- 'sentry.client.config.js': ['.'],
101
- 'sentry.edge.config.js': ['.'],
102
- };
103
- var appPackage = {};
104
- try {
105
- appPackage = require(path.join(process.cwd(), 'package.json'));
106
- }
107
- catch (_a) {
108
- // We don't need to have this
109
- }
57
+ /**
58
+ * This class just redirects to the new `nextjs-wizard.ts` flow
59
+ * for anyone calling the wizard without the '-i nextjs' flag.
60
+ */
110
61
  var NextJs = /** @class */ (function (_super) {
111
62
  __extends(NextJs, _super);
112
63
  function NextJs(_argv) {
113
64
  var _this = _super.call(this, _argv) || this;
114
65
  _this._argv = _argv;
115
- _this._sentryCli = new SentryCli_1.SentryCli(_this._argv);
116
66
  return _this;
117
67
  }
118
- NextJs.prototype.emit = function (answers) {
119
- var _a, _b, _c, _d, _e, _f;
68
+ NextJs.prototype.emit = function (_answers) {
120
69
  return __awaiter(this, void 0, void 0, function () {
121
- var dsn, sentryCliProps, templateDirectory, configDirectory, selectedProjectSlug, hasFirstEvent;
122
- return __generator(this, function (_g) {
123
- switch (_g.label) {
124
- case 0:
125
- dsn = _.get(answers, ['config', 'dsn', 'public'], null);
126
- (0, Logging_1.nl)();
127
- sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);
128
- return [4 /*yield*/, this._createSentryCliConfig(sentryCliProps)];
129
- case 1:
130
- _g.sent();
131
- templateDirectory = path.join(__dirname, '..', '..', '..', 'NextJs');
132
- configDirectory = path.join(templateDirectory, CONFIG_DIR);
133
- if (!fs.existsSync(configDirectory)) return [3 /*break*/, 3];
134
- return [4 /*yield*/, this._createNextConfig(configDirectory, dsn)];
135
- case 2:
136
- _g.sent();
137
- return [3 /*break*/, 4];
138
- case 3:
139
- (0, Logging_1.debug)("Couldn't find ".concat(configDirectory, ", probably because you ran this from inside of `/lib` rather than `/dist`"));
140
- (0, Logging_1.nl)();
141
- _g.label = 4;
142
- case 4:
143
- selectedProjectSlug = (_b = (_a = answers.config) === null || _a === void 0 ? void 0 : _a.project) === null || _b === void 0 ? void 0 : _b.slug;
144
- if (!selectedProjectSlug) return [3 /*break*/, 6];
145
- hasFirstEvent = (_f = (_e = (_d = (_c = answers.wizard) === null || _c === void 0 ? void 0 : _c.projects) === null || _d === void 0 ? void 0 : _d.find) === null || _e === void 0 ? void 0 : _e.call(_d, function (p) { return p.slug === selectedProjectSlug; })) === null || _f === void 0 ? void 0 : _f.firstEvent;
146
- if (!!hasFirstEvent) return [3 /*break*/, 6];
147
- return [4 /*yield*/, this._setTemplate(templateDirectory, 'sentry_sample_error.js', ['pages', 'src/pages'], dsn)];
148
- case 5:
149
- _g.sent();
150
- (0, Logging_1.l)(chalk_1.default.bgYellowBright("\n|------------------------------------------------------------------------|\n| Installation Complete |\n| To verify your installation and finish onboarding, launch your Next.js |\n| application, navigate to http://localhost:3000/sentry_sample_error |\n| and send us a sample error. |\n|------------------------------------------------------------------------|\n"));
151
- _g.label = 6;
152
- case 6:
153
- (0, Logging_1.l)('For more information, see https://docs.sentry.io/platforms/javascript/guides/nextjs/');
154
- (0, Logging_1.nl)();
155
- return [2 /*return*/, {}];
156
- }
157
- });
158
- });
159
- };
160
- NextJs.prototype.shouldConfigure = function (_answers) {
161
- return __awaiter(this, void 0, void 0, function () {
162
- var userAnswers, hasCompatibleNextjsVersion, packageManager, hasSdkInstalled, hasCompatibleSdkVersion, hasAllPackagesCompatible;
163
70
  return __generator(this, function (_a) {
164
71
  switch (_a.label) {
165
- case 0:
166
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
167
- if (this._shouldConfigure) {
168
- return [2 /*return*/, this._shouldConfigure];
169
- }
170
- (0, Logging_1.nl)();
171
- userAnswers = { continue: true };
172
- hasCompatibleNextjsVersion = (0, Package_1.checkPackageVersion)(appPackage, 'next', COMPATIBLE_NEXTJS_VERSIONS, true);
173
- packageManager = (0, PackageManager_1.getPackageMangerChoice)();
174
- hasSdkInstalled = this._hasPackageInstalled('@sentry/nextjs');
175
- hasCompatibleSdkVersion = false;
176
- if (!(!hasSdkInstalled && packageManager && hasCompatibleNextjsVersion)) return [3 /*break*/, 2];
177
- return [4 /*yield*/, packageManager.installPackage('@sentry/nextjs')];
72
+ case 0: return [4 /*yield*/, (0, nextjs_wizard_1.runNextjsWizard)({ promoCode: this._argv.promoCode })];
178
73
  case 1:
179
74
  _a.sent();
180
- // can assume it's compatible since we just installed it
181
- hasCompatibleSdkVersion = true;
182
- return [3 /*break*/, 3];
183
- case 2:
184
- // otherwise, let's check the version and spit out the appropriate error
185
- hasCompatibleSdkVersion = (0, Package_1.checkPackageVersion)(appPackage, '@sentry/nextjs', COMPATIBLE_SDK_VERSIONS, true);
186
- _a.label = 3;
187
- case 3:
188
- hasAllPackagesCompatible = hasCompatibleNextjsVersion && hasCompatibleSdkVersion;
189
- if (!(!hasAllPackagesCompatible && !this._argv.quiet)) return [3 /*break*/, 5];
190
- return [4 /*yield*/, (0, inquirer_1.prompt)({
191
- message: 'There were errors during your project checkup, do you still want to continue?',
192
- name: 'continue',
193
- default: false,
194
- type: 'confirm',
195
- })];
196
- case 4:
197
- userAnswers = _a.sent();
198
- _a.label = 5;
199
- case 5:
200
- (0, Logging_1.nl)();
201
- if (!userAnswers['continue']) {
202
- throw new Error('Please install the required dependencies to continue.');
203
- }
204
- this._shouldConfigure = Promise.resolve({ nextjs: true });
205
- // eslint-disable-next-line @typescript-eslint/unbound-method
206
- return [2 /*return*/, this.shouldConfigure];
207
- }
208
- });
209
- });
210
- };
211
- NextJs.prototype._createSentryCliConfig = function (cliProps) {
212
- return __awaiter(this, void 0, void 0, function () {
213
- var authToken, cliPropsToWrite, _a, _b;
214
- return __generator(this, function (_c) {
215
- switch (_c.label) {
216
- case 0:
217
- authToken = cliProps["auth/token"], cliPropsToWrite = __rest(cliProps, ['auth/token']);
218
- if (!authToken) return [3 /*break*/, 5];
219
- _c.label = 1;
220
- case 1:
221
- _c.trys.push([1, 3, , 4]);
222
- return [4 /*yield*/, fs.promises.appendFile(SENTRYCLIRC_FILENAME, this._sentryCli.dumpConfig({ auth: { token: authToken } }))];
223
- case 2:
224
- _c.sent();
225
- (0, Logging_1.green)("\u2713 Successfully added the auth token to ".concat(SENTRYCLIRC_FILENAME));
226
- return [3 /*break*/, 4];
227
- case 3:
228
- _a = _c.sent();
229
- (0, Logging_1.red)("\u26A0 Could not add the auth token to ".concat(SENTRYCLIRC_FILENAME, ", ") +
230
- "please add it to identify your user account:\n".concat(authToken));
231
- (0, Logging_1.nl)();
232
- return [3 /*break*/, 4];
233
- case 4: return [3 /*break*/, 6];
234
- case 5:
235
- (0, Logging_1.red)("\u26A0 Did not find an auth token, please add your token to ".concat(SENTRYCLIRC_FILENAME));
236
- (0, Logging_1.l)('To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/');
237
- (0, Logging_1.l)('To learn how to configure Sentry CLI, visit ' +
238
- 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli');
239
- _c.label = 6;
240
- case 6: return [4 /*yield*/, this._addToGitignore(SENTRYCLIRC_FILENAME, "\u26A0 Could not add ".concat(SENTRYCLIRC_FILENAME, " to ").concat(GITIGNORE_FILENAME, ", ") +
241
- 'please add it to not commit your auth key.')];
242
- case 7:
243
- _c.sent();
244
- _c.label = 8;
245
- case 8:
246
- _c.trys.push([8, 10, , 11]);
247
- return [4 /*yield*/, fs.promises.writeFile("./".concat(PROPERTIES_FILENAME), this._sentryCli.dumpProperties(cliPropsToWrite))];
248
- case 9:
249
- _c.sent();
250
- (0, Logging_1.green)('✓ Successfully created sentry.properties');
251
- return [3 /*break*/, 11];
252
- case 10:
253
- _b = _c.sent();
254
- (0, Logging_1.red)("\u26A0 Could not add org and project data to ".concat(PROPERTIES_FILENAME));
255
- (0, Logging_1.l)('See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli');
256
- return [3 /*break*/, 11];
257
- case 11:
258
- (0, Logging_1.nl)();
259
- return [2 /*return*/];
260
- }
261
- });
262
- });
263
- };
264
- NextJs.prototype._addToGitignore = function (filepath, errorMsg) {
265
- return __awaiter(this, void 0, void 0, function () {
266
- var _a;
267
- return __generator(this, function (_b) {
268
- switch (_b.label) {
269
- case 0:
270
- _b.trys.push([0, 2, , 3]);
271
- return [4 /*yield*/, fs.promises.appendFile(GITIGNORE_FILENAME, "\n# Sentry\n".concat(filepath, "\n"))];
272
- case 1:
273
- _b.sent();
274
- (0, Logging_1.green)("\u2713 ".concat(filepath, " added to ").concat(GITIGNORE_FILENAME));
275
- return [3 /*break*/, 3];
276
- case 2:
277
- _a = _b.sent();
278
- (0, Logging_1.red)(errorMsg);
279
- return [3 /*break*/, 3];
280
- case 3: return [2 /*return*/];
281
- }
282
- });
283
- });
284
- };
285
- NextJs.prototype._createNextConfig = function (configDirectory, dsn) {
286
- return __awaiter(this, void 0, void 0, function () {
287
- var templates, filteredTemplates, _i, filteredTemplates_1, template;
288
- return __generator(this, function (_a) {
289
- switch (_a.label) {
290
- case 0:
291
- templates = fs.readdirSync(configDirectory);
292
- filteredTemplates = templates.filter(function (template) { return template !== 'next.config.template.js'; });
293
- _i = 0, filteredTemplates_1 = filteredTemplates;
294
- _a.label = 1;
295
- case 1:
296
- if (!(_i < filteredTemplates_1.length)) return [3 /*break*/, 4];
297
- template = filteredTemplates_1[_i];
298
- return [4 /*yield*/, this._setTemplate(configDirectory, template, TEMPLATE_DESTINATIONS[template], dsn)];
299
- case 2:
300
- _a.sent();
301
- _a.label = 3;
302
- case 3:
303
- _i++;
304
- return [3 /*break*/, 1];
305
- case 4:
306
- (0, Logging_1.red)('⚠ Performance monitoring is enabled capturing 100% of transactions.\n' +
307
- ' Learn more in https://docs.sentry.io/product/performance/');
308
- (0, Logging_1.nl)();
309
- return [2 /*return*/];
310
- }
311
- });
312
- });
313
- };
314
- NextJs.prototype._setTemplate = function (configDirectory, templateFile, destinationOptions, dsn) {
315
- return __awaiter(this, void 0, void 0, function () {
316
- var templatePath, _i, destinationOptions_1, destinationDir, destinationPath, mergeableFilePath;
317
- return __generator(this, function (_a) {
318
- switch (_a.label) {
319
- case 0:
320
- templatePath = path.join(configDirectory, templateFile);
321
- _i = 0, destinationOptions_1 = destinationOptions;
322
- _a.label = 1;
323
- case 1:
324
- if (!(_i < destinationOptions_1.length)) return [3 /*break*/, 5];
325
- destinationDir = destinationOptions_1[_i];
326
- if (!fs.existsSync(destinationDir)) {
327
- return [3 /*break*/, 4];
328
- }
329
- destinationPath = path.join(destinationDir, templateFile);
330
- mergeableFilePath = path.join(destinationDir, this._spliceInPlace(templateFile.split('.'), -1, 0, MERGEABLE_CONFIG_INFIX).join('.'));
331
- if (!(templateFile === 'next.config.js')) return [3 /*break*/, 3];
332
- return [4 /*yield*/, this._mergeNextConfig(destinationPath, templatePath, destinationDir, templateFile, configDirectory, mergeableFilePath)];
333
- case 2:
334
- _a.sent();
335
- return [2 /*return*/];
336
- case 3:
337
- if (!fs.existsSync(destinationPath)) {
338
- this._fillAndCopyTemplate(templatePath, destinationPath, dsn);
339
- }
340
- else if (!fs.existsSync(mergeableFilePath)) {
341
- this._fillAndCopyTemplate(templatePath, mergeableFilePath, dsn);
342
- (0, Logging_1.red)("File `".concat(templateFile, "` already exists, so created `").concat(mergeableFilePath, "`.\n") +
343
- 'Please merge those files.');
344
- (0, Logging_1.nl)();
345
- }
346
- else {
347
- (0, Logging_1.red)("Both `".concat(templateFile, "` and `").concat(mergeableFilePath, "` already exist.\n") +
348
- 'Please merge those files.');
349
- (0, Logging_1.nl)();
350
- }
351
- return [2 /*return*/];
352
- case 4:
353
- _i++;
354
- return [3 /*break*/, 1];
355
- case 5:
356
- (0, Logging_1.red)("Could not find appropriate destination for `".concat(templateFile, "`. Tried: ").concat(destinationOptions, "."));
357
- (0, Logging_1.nl)();
358
- return [2 /*return*/];
75
+ return [2 /*return*/, {}];
359
76
  }
360
77
  });
361
78
  });
362
79
  };
363
- NextJs.prototype._fillAndCopyTemplate = function (sourcePath, targetPath, dsn) {
364
- var templateContent = fs.readFileSync(sourcePath).toString();
365
- var filledTemplate = templateContent.replace('___DSN___', dsn);
366
- fs.writeFileSync(targetPath, filledTemplate);
367
- };
368
- NextJs.prototype._hasPackageInstalled = function (packageName) {
369
- var depsVersion = _.get(appPackage, ['dependencies', packageName]);
370
- var devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);
371
- return !!depsVersion || !!devDepsVersion;
372
- };
373
- NextJs.prototype._spliceInPlace = function (arr, start, deleteCount) {
374
- var inserts = [];
375
- for (var _i = 3; _i < arguments.length; _i++) {
376
- inserts[_i - 3] = arguments[_i];
377
- }
378
- arr.splice.apply(arr, __spreadArray([start, deleteCount], inserts, false));
379
- return arr;
380
- };
381
- NextJs.prototype._mergeNextConfig = function (destinationPath, templatePath, destinationDir, templateFile, configDirectory, mergeableFilePath) {
80
+ NextJs.prototype.shouldConfigure = function (_answers) {
382
81
  return __awaiter(this, void 0, void 0, function () {
383
- var originalFileName, originalFilePath, mergedTemplatePath;
384
82
  return __generator(this, function (_a) {
385
- switch (_a.label) {
386
- case 0:
387
- if (!!fs.existsSync(destinationPath)) return [3 /*break*/, 1];
388
- fs.copyFileSync(templatePath, destinationPath);
389
- (0, Logging_1.green)('Created File `next.config.js`');
390
- (0, Logging_1.nl)();
391
- return [3 /*break*/, 5];
392
- case 1:
393
- originalFileName = this._spliceInPlace(templateFile.split('.'), -1, 0, 'original').join('.');
394
- originalFilePath = path.join(destinationDir, originalFileName);
395
- // makes copy of original next.config.js
396
- fs.writeFileSync(originalFilePath, fs.readFileSync(destinationPath));
397
- return [4 /*yield*/, this._addToGitignore(originalFilePath, 'Unable to add next.config.original.js to gitignore')];
398
- case 2:
399
- _a.sent();
400
- mergedTemplatePath = path.join(configDirectory, 'next.config.template.js');
401
- if (!(0, MergeConfig_1.mergeConfigFile)(destinationPath, mergedTemplatePath)) return [3 /*break*/, 3];
402
- (0, Logging_1.green)("Updated `".concat(templateFile, "` with Sentry. The original ").concat(templateFile, " was saved as `next.config.original.js`.\n") +
403
- 'Information on the changes made to the Next.js configuration file an be found at https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/');
404
- (0, Logging_1.nl)();
405
- return [3 /*break*/, 5];
406
- case 3:
407
- // if merge fails, we'll create a copy of the `next.config.js` template and ask them to merge
408
- fs.copyFileSync(templatePath, mergeableFilePath);
409
- return [4 /*yield*/, this._addToGitignore(mergeableFilePath, 'Unable to add next.config.wizard.js template to gitignore')];
410
- case 4:
411
- _a.sent();
412
- (0, Logging_1.red)("Unable to merge `".concat(templateFile, "`, so created `").concat(mergeableFilePath, "`.\n") +
413
- 'Please integrate next.config.wizardcopy.js into your next.config.js or next.config.ts file');
414
- (0, Logging_1.nl)();
415
- _a.label = 5;
416
- case 5: return [2 /*return*/];
83
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
84
+ if (this._shouldConfigure) {
85
+ return [2 /*return*/, this._shouldConfigure];
417
86
  }
87
+ // eslint-disable-next-line @typescript-eslint/unbound-method
88
+ return [2 /*return*/, this.shouldConfigure];
418
89
  });
419
90
  });
420
91
  };
@@ -1 +1 @@
1
- {"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;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AAC;;;;;;KAGV;IACH,aAAC;AAAD,CAAC,AAvXD,CAA4B,iCAAe,GAuX1C;AAvXY,wBAAM","sourcesContent":["/* eslint-disable max-lines */\nimport Chalk from 'chalk';\nimport * as fs from 'fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as _ from 'lodash';\nimport * as path from 'path';\n\nimport type { Args } from '../../Constants';\nimport { debug, green, l, nl, red } from '../../Helper/Logging';\nimport { mergeConfigFile } from '../../Helper/MergeConfig';\nimport { checkPackageVersion } from '../../Helper/Package';\nimport { getPackageMangerChoice } from '../../Helper/PackageManager';\nimport type { SentryCliProps } from '../../Helper/SentryCli';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\n\nconst COMPATIBLE_NEXTJS_VERSIONS = '>=10.0.8 <14.0.0';\nconst COMPATIBLE_SDK_VERSIONS = '>=7.3.0';\nconst PROPERTIES_FILENAME = 'sentry.properties';\nconst SENTRYCLIRC_FILENAME = '.sentryclirc';\nconst GITIGNORE_FILENAME = '.gitignore';\nconst CONFIG_DIR = 'configs/';\nconst MERGEABLE_CONFIG_INFIX = 'wizardcopy';\n\n// for those files which can go in more than one place, the list of places they\n// could go (the first one which works will be used)\nconst TEMPLATE_DESTINATIONS: { [key: string]: string[] } = {\n '_error.js': ['pages', 'src/pages'],\n 'next.config.js': ['.'],\n 'sentry.server.config.js': ['.'],\n 'sentry.client.config.js': ['.'],\n 'sentry.edge.config.js': ['.'],\n};\n\nlet appPackage: any = {};\n\ntry {\n appPackage = require(path.join(process.cwd(), 'package.json'));\n} catch {\n // We don't need to have this\n}\n\nexport class NextJs extends BaseIntegration {\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this._sentryCli = new SentryCli(this._argv);\n }\n\n public async emit(answers: Answers): Promise<Answers> {\n const dsn = _.get(answers, ['config', 'dsn', 'public'], null);\n nl();\n\n const sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);\n await this._createSentryCliConfig(sentryCliProps);\n\n const templateDirectory = path.join(__dirname, '..', '..', '..', 'NextJs');\n const configDirectory = path.join(templateDirectory, CONFIG_DIR);\n\n if (fs.existsSync(configDirectory)) {\n await this._createNextConfig(configDirectory, dsn);\n } else {\n debug(\n `Couldn't find ${configDirectory}, probably because you ran this from inside of \\`/lib\\` rather than \\`/dist\\``,\n );\n nl();\n }\n\n const selectedProjectSlug: string | null = answers.config?.project?.slug;\n if (selectedProjectSlug) {\n const hasFirstEvent = answers.wizard?.projects?.find?.(\n (p: { slug: string }) => p.slug === selectedProjectSlug,\n )?.firstEvent;\n if (!hasFirstEvent) {\n await this._setTemplate(\n templateDirectory,\n 'sentry_sample_error.js',\n ['pages', 'src/pages'],\n dsn,\n );\n l(\n Chalk.bgYellowBright(`\n|------------------------------------------------------------------------|\n| Installation Complete |\n| To verify your installation and finish onboarding, launch your Next.js |\n| application, navigate to http://localhost:3000/sentry_sample_error |\n| and send us a sample error. |\n|------------------------------------------------------------------------|\n`),\n );\n }\n }\n\n l(\n 'For more information, see https://docs.sentry.io/platforms/javascript/guides/nextjs/',\n );\n nl();\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n nl();\n\n let userAnswers: Answers = { continue: true };\n const hasCompatibleNextjsVersion = checkPackageVersion(\n appPackage,\n 'next',\n COMPATIBLE_NEXTJS_VERSIONS,\n true,\n );\n\n const packageManager = getPackageMangerChoice();\n const hasSdkInstalled = this._hasPackageInstalled('@sentry/nextjs');\n\n let hasCompatibleSdkVersion = false;\n // if no package but we have nextjs, let's add it if we can\n if (!hasSdkInstalled && packageManager && hasCompatibleNextjsVersion) {\n await packageManager.installPackage('@sentry/nextjs');\n // can assume it's compatible since we just installed it\n hasCompatibleSdkVersion = true;\n } else {\n // otherwise, let's check the version and spit out the appropriate error\n hasCompatibleSdkVersion = checkPackageVersion(\n appPackage,\n '@sentry/nextjs',\n COMPATIBLE_SDK_VERSIONS,\n true,\n );\n }\n const hasAllPackagesCompatible =\n hasCompatibleNextjsVersion && hasCompatibleSdkVersion;\n\n if (!hasAllPackagesCompatible && !this._argv.quiet) {\n userAnswers = await prompt({\n message:\n 'There were errors during your project checkup, do you still want to continue?',\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n }\n\n nl();\n\n if (!userAnswers['continue']) {\n throw new Error('Please install the required dependencies to continue.');\n }\n\n this._shouldConfigure = Promise.resolve({ nextjs: true });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private async _createSentryCliConfig(\n cliProps: SentryCliProps,\n ): Promise<void> {\n const { 'auth/token': authToken, ...cliPropsToWrite } = cliProps;\n\n /**\n * To not commit the auth token to the VCS, instead of adding it to the\n * properties file (like the rest of props), it's added to the Sentry CLI\n * config, which is added to the gitignore. This way makes the properties\n * file safe to commit without exposing any auth tokens.\n */\n if (authToken) {\n try {\n await fs.promises.appendFile(\n SENTRYCLIRC_FILENAME,\n this._sentryCli.dumpConfig({ auth: { token: authToken } }),\n );\n green(`✓ Successfully added the auth token to ${SENTRYCLIRC_FILENAME}`);\n } catch {\n red(\n `⚠ Could not add the auth token to ${SENTRYCLIRC_FILENAME}, ` +\n `please add it to identify your user account:\\n${authToken}`,\n );\n nl();\n }\n } else {\n red(\n `⚠ Did not find an auth token, please add your token to ${SENTRYCLIRC_FILENAME}`,\n );\n l(\n 'To generate an auth token, visit https://sentry.io/settings/account/api/auth-tokens/',\n );\n l(\n 'To learn how to configure Sentry CLI, visit ' +\n 'https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n\n await this._addToGitignore(\n SENTRYCLIRC_FILENAME,\n `⚠ Could not add ${SENTRYCLIRC_FILENAME} to ${GITIGNORE_FILENAME}, ` +\n 'please add it to not commit your auth key.',\n );\n\n try {\n await fs.promises.writeFile(\n `./${PROPERTIES_FILENAME}`,\n this._sentryCli.dumpProperties(cliPropsToWrite),\n );\n green('✓ Successfully created sentry.properties');\n } catch {\n red(`⚠ Could not add org and project data to ${PROPERTIES_FILENAME}`);\n l(\n 'See docs for a manual setup: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli',\n );\n }\n nl();\n }\n\n private async _addToGitignore(\n filepath: string,\n errorMsg: string,\n ): Promise<void> {\n /**\n * Don't check whether the given file is ignored because:\n * 1. It's tricky to check it without git.\n * 2. Git might not be installed or accessible.\n * 3. It's convenient to use a module to interact with git, but it would\n * increase the size x2 approximately. Docs say to run the Wizard without\n * installing it, and duplicating the size would slow the set-up down.\n * 4. The Wizard is meant to be run once.\n * 5. A message is logged informing users it's been added to the gitignore.\n * 6. It will be added to the gitignore as many times as it runs - not a big\n * deal.\n * 7. It's straightforward to remove it from the gitignore.\n */\n try {\n await fs.promises.appendFile(\n GITIGNORE_FILENAME,\n `\\n# Sentry\\n${filepath}\\n`,\n );\n green(`✓ ${filepath} added to ${GITIGNORE_FILENAME}`);\n } catch {\n red(errorMsg);\n }\n }\n\n private async _createNextConfig(\n configDirectory: string,\n dsn: any,\n ): Promise<void> {\n const templates = fs.readdirSync(configDirectory);\n // next.config.template.js used for merging next.config.js , not its own template,\n // so it shouldn't have a setTemplate call\n const filteredTemplates = templates.filter(\n (template) => template !== 'next.config.template.js',\n );\n for (const template of filteredTemplates) {\n await this._setTemplate(\n configDirectory,\n template,\n TEMPLATE_DESTINATIONS[template],\n dsn,\n );\n }\n red(\n '⚠ Performance monitoring is enabled capturing 100% of transactions.\\n' +\n ' Learn more in https://docs.sentry.io/product/performance/',\n );\n nl();\n }\n\n private async _setTemplate(\n configDirectory: string,\n templateFile: string,\n destinationOptions: string[],\n dsn: string,\n ): Promise<void> {\n const templatePath = path.join(configDirectory, templateFile);\n\n for (const destinationDir of destinationOptions) {\n if (!fs.existsSync(destinationDir)) {\n continue;\n }\n const destinationPath = path.join(destinationDir, templateFile);\n // in case the file in question already exists, we'll make a copy with\n // `MERGEABLE_CONFIG_INFIX` inserted just before the extension, so as not\n // to overwrite the existing file\n const mergeableFilePath = path.join(\n destinationDir,\n this._spliceInPlace(\n templateFile.split('.'),\n -1,\n 0,\n MERGEABLE_CONFIG_INFIX,\n ).join('.'),\n );\n\n if (templateFile === 'next.config.js') {\n await this._mergeNextConfig(\n destinationPath,\n templatePath,\n destinationDir,\n templateFile,\n configDirectory,\n mergeableFilePath,\n );\n return;\n } else {\n if (!fs.existsSync(destinationPath)) {\n this._fillAndCopyTemplate(templatePath, destinationPath, dsn);\n } else if (!fs.existsSync(mergeableFilePath)) {\n this._fillAndCopyTemplate(templatePath, mergeableFilePath, dsn);\n red(\n `File \\`${templateFile}\\` already exists, so created \\`${mergeableFilePath}\\`.\\n` +\n 'Please merge those files.',\n );\n nl();\n } else {\n red(\n `Both \\`${templateFile}\\` and \\`${mergeableFilePath}\\` already exist.\\n` +\n 'Please merge those files.',\n );\n nl();\n }\n return;\n }\n }\n\n red(\n `Could not find appropriate destination for \\`${templateFile}\\`. Tried: ${destinationOptions}.`,\n );\n nl();\n }\n\n private _fillAndCopyTemplate(\n sourcePath: string,\n targetPath: string,\n dsn: string,\n ): void {\n const templateContent = fs.readFileSync(sourcePath).toString();\n const filledTemplate = templateContent.replace('___DSN___', dsn);\n fs.writeFileSync(targetPath, filledTemplate);\n }\n\n private _hasPackageInstalled(packageName: string): boolean {\n const depsVersion = _.get(appPackage, ['dependencies', packageName]);\n const devDepsVersion = _.get(appPackage, ['devDependencies', packageName]);\n return !!depsVersion || !!devDepsVersion;\n }\n\n private _spliceInPlace(\n arr: Array<any>,\n start: number,\n deleteCount: number,\n ...inserts: any[]\n ): Array<any> {\n arr.splice(start, deleteCount, ...inserts);\n return arr;\n }\n\n private async _mergeNextConfig(\n destinationPath: string,\n templatePath: string,\n destinationDir: string,\n templateFile: string,\n configDirectory: string,\n mergeableFilePath: string,\n ): Promise<void> {\n // if no next.config.js exists, we'll create one\n if (!fs.existsSync(destinationPath)) {\n fs.copyFileSync(templatePath, destinationPath);\n green('Created File `next.config.js`');\n nl();\n } else {\n // creates a file name for the copy of the original next.config.js file\n // with the name `next.config.original.js`\n const originalFileName = this._spliceInPlace(\n templateFile.split('.'),\n -1,\n 0,\n 'original',\n ).join('.');\n const originalFilePath = path.join(destinationDir, originalFileName);\n // makes copy of original next.config.js\n fs.writeFileSync(originalFilePath, fs.readFileSync(destinationPath));\n await this._addToGitignore(\n originalFilePath,\n 'Unable to add next.config.original.js to gitignore',\n );\n\n const mergedTemplatePath = path.join(\n configDirectory,\n 'next.config.template.js',\n );\n // attempts to merge with existing next.config.js, if true -> success\n if (mergeConfigFile(destinationPath, mergedTemplatePath)) {\n green(\n `Updated \\`${templateFile}\\` with Sentry. The original ${templateFile} was saved as \\`next.config.original.js\\`.\\n` +\n 'Information on the changes made to the Next.js configuration file an be found at https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/',\n );\n nl();\n } else {\n // if merge fails, we'll create a copy of the `next.config.js` template and ask them to merge\n fs.copyFileSync(templatePath, mergeableFilePath);\n await this._addToGitignore(\n mergeableFilePath,\n 'Unable to add next.config.wizard.js template to gitignore',\n );\n red(\n `Unable to merge \\`${templateFile}\\`, so created \\`${mergeableFilePath}\\`.\\n` +\n 'Please integrate next.config.wizardcopy.js into your next.config.js or next.config.ts file',\n );\n nl();\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"NextJs.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/NextJs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,mEAAoE;AAGpE,qDAAoD;AAEpD;;;GAGG;AACH;IAA4B,0BAAe;IACzC,gBAA6B,KAAW;QAAxC,YACE,kBAAM,KAAK,CAAC,SACb;QAF4B,WAAK,GAAL,KAAK,CAAM;;IAExC,CAAC;IAEY,qBAAI,GAAjB,UAAkB,QAAiB;;;;4BACjC,qBAAM,IAAA,+BAAe,EAAC,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,EAAA;;wBAA1D,SAA0D,CAAC;wBAC3D,sBAAO,EAAE,EAAC;;;;KACX;IAEY,gCAAe,GAA5B,UAA6B,QAAiB;;;gBAC5C,kEAAkE;gBAClE,IAAI,IAAI,CAAC,gBAAgB,EAAE;oBACzB,sBAAO,IAAI,CAAC,gBAAgB,EAAC;iBAC9B;gBACD,6DAA6D;gBAC7D,sBAAO,IAAI,CAAC,eAAe,EAAC;;;KAC7B;IACH,aAAC;AAAD,CAAC,AAlBD,CAA4B,iCAAe,GAkB1C;AAlBY,wBAAM","sourcesContent":["import type { Answers } from 'inquirer';\nimport { runNextjsWizard } from '../../../src/nextjs/nextjs-wizard';\n\nimport type { Args } from '../../Constants';\nimport { BaseIntegration } from './BaseIntegration';\n\n/**\n * This class just redirects to the new `nextjs-wizard.ts` flow\n * for anyone calling the wizard without the '-i nextjs' flag.\n */\nexport class NextJs extends BaseIntegration {\n public constructor(protected _argv: Args) {\n super(_argv);\n }\n\n public async emit(_answers: Answers): Promise<Answers> {\n await runNextjsWizard({ promoCode: this._argv.promoCode });\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n}\n"]}
@@ -13,6 +13,7 @@ export declare class ReactNative extends MobileProject {
13
13
  * All React Native versions have app/build.gradle with android section.
14
14
  */
15
15
  private static _buildGradleAndroidSectionBeginning;
16
+ private url;
16
17
  protected _answers: Answers;
17
18
  protected _sentryCli: SentryCli;
18
19
  constructor(_argv: Args);
@@ -14,6 +14,29 @@ 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
+ };
17
40
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
41
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
42
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -54,10 +77,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
54
77
  exports.ReactNative = exports.DOCS_MANUAL_STEPS = exports.REACT_NATIVE_PACKAGE = exports.SENTRY_REACT_NATIVE_PACKAGE = exports.COMPATIBLE_SDK_VERSION = exports.COMPATIBLE_REACT_NATIVE_VERSIONS = void 0;
55
78
  /* eslint-disable max-lines */
56
79
  var child_process_1 = require("child_process");
57
- var fs = require("fs");
80
+ var fs = __importStar(require("fs"));
58
81
  var inquirer_1 = require("inquirer");
59
- var _ = require("lodash");
60
- var path = require("path");
82
+ var _ = __importStar(require("lodash"));
83
+ var path = __importStar(require("path"));
61
84
  var util_1 = require("util");
62
85
  var File_1 = require("../../Helper/File");
63
86
  var Logging_1 = require("../../Helper/Logging");
@@ -65,6 +88,8 @@ var Package_1 = require("../../Helper/Package");
65
88
  var PackageManager_1 = require("../../Helper/PackageManager");
66
89
  var SentryCli_1 = require("../../Helper/SentryCli");
67
90
  var MobileProject_1 = require("./MobileProject");
91
+ var BottomBar_1 = require("../../Helper/BottomBar");
92
+ var url_1 = require("url");
68
93
  var xcode = require('xcode');
69
94
  exports.COMPATIBLE_REACT_NATIVE_VERSIONS = '>=0.69.0';
70
95
  exports.COMPATIBLE_SDK_VERSION = '>= 5.0.0';
@@ -76,12 +101,13 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
76
101
  function ReactNative(_argv) {
77
102
  var _this = _super.call(this, _argv) || this;
78
103
  _this._argv = _argv;
104
+ _this.url = _argv.url;
79
105
  _this._sentryCli = new SentryCli_1.SentryCli(_this._argv);
80
106
  return _this;
81
107
  }
82
108
  ReactNative.prototype.emit = function (answers) {
83
109
  return __awaiter(this, void 0, void 0, function () {
84
- var userAnswers, packageManager, hasCompatibleReactNativeVersion, hasCompatibleSentryReactNativeVersion, sentryCliProperties, promises;
110
+ var userAnswers, packageManager, hasCompatibleReactNativeVersion, hasCompatibleSentryReactNativeVersion, sentryCliProperties, promises, host, orgSlug, projectId, projectIssuesUrl;
85
111
  var _this = this;
86
112
  return __generator(this, function (_a) {
87
113
  switch (_a.label) {
@@ -96,7 +122,7 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
96
122
  }
97
123
  (0, Logging_1.nl)();
98
124
  userAnswers = { continue: true };
99
- packageManager = (0, PackageManager_1.getPackageMangerChoice)();
125
+ packageManager = (0, PackageManager_1.getPackageManagerChoice)();
100
126
  hasCompatibleReactNativeVersion = (0, Package_1.checkPackageVersion)(this._readAppPackage(), exports.REACT_NATIVE_PACKAGE, exports.COMPATIBLE_REACT_NATIVE_VERSIONS, true);
101
127
  if (!(!hasCompatibleReactNativeVersion && !this._argv.quiet)) return [3 /*break*/, 3];
102
128
  return [4 /*yield*/, (0, inquirer_1.prompt)({
@@ -114,9 +140,12 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
114
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));
115
141
  }
116
142
  if (!packageManager) return [3 /*break*/, 5];
143
+ BottomBar_1.BottomBar.show("Adding ".concat(exports.SENTRY_REACT_NATIVE_PACKAGE, "..."));
117
144
  return [4 /*yield*/, packageManager.installPackage(exports.SENTRY_REACT_NATIVE_PACKAGE)];
118
145
  case 4:
119
146
  _a.sent();
147
+ BottomBar_1.BottomBar.hide();
148
+ (0, Logging_1.green)("\u2713 Added `".concat(exports.SENTRY_REACT_NATIVE_PACKAGE, "`"));
120
149
  _a.label = 5;
121
150
  case 5:
122
151
  hasCompatibleSentryReactNativeVersion = (0, Package_1.checkPackageVersion)(this._readAppPackage(), exports.SENTRY_REACT_NATIVE_PACKAGE, exports.COMPATIBLE_SDK_VERSION, true);
@@ -147,9 +176,11 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
147
176
  case 1:
148
177
  _a.sent();
149
178
  (0, Logging_1.green)('✓ Patched build script in Xcode project.');
179
+ BottomBar_1.BottomBar.show('Adding Sentry pods...');
150
180
  return [4 /*yield*/, this._podInstall()];
151
181
  case 2:
152
182
  _a.sent();
183
+ BottomBar_1.BottomBar.hide();
153
184
  (0, Logging_1.green)('✓ Pods installed.');
154
185
  return [3 /*break*/, 5];
155
186
  case 3: return [4 /*yield*/, (0, File_1.patchMatchingFile)('**/app/build.gradle', this._patchBuildGradle.bind(this))];
@@ -176,7 +207,37 @@ var ReactNative = exports.ReactNative = /** @class */ (function (_super) {
176
207
  return [4 /*yield*/, Promise.all(promises)];
177
208
  case 8:
178
209
  _a.sent();
179
- return [2 /*return*/, answers];
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];
180
241
  }
181
242
  });
182
243
  });