@sentry/wizard 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/bin.ts +8 -9
- package/dist/bin.js +8 -5
- package/dist/bin.js.map +1 -1
- package/dist/lib/Constants.d.ts +2 -0
- package/dist/lib/Constants.js +5 -0
- package/dist/lib/Constants.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +2 -0
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/SentryCli.js +1 -0
- package/dist/lib/Helper/__tests__/SentryCli.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +4 -0
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Apple.d.ts +10 -0
- package/dist/lib/Steps/Integrations/Apple.js +92 -0
- package/dist/lib/Steps/Integrations/Apple.js.map +1 -0
- package/dist/lib/Steps/Integrations/NextJsShim.js +1 -0
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +1 -1
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +1 -0
- package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +1 -1
- package/dist/lib/Steps/Integrations/SvelteKitShim.js +1 -0
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +1 -1
- package/dist/package.json +2 -2
- package/dist/src/apple/apple-wizard.d.ts +2 -0
- package/dist/src/apple/apple-wizard.js +197 -0
- package/dist/src/apple/apple-wizard.js.map +1 -0
- package/dist/src/apple/code-tools.d.ts +1 -0
- package/dist/src/apple/code-tools.js +100 -0
- package/dist/src/apple/code-tools.js.map +1 -0
- package/dist/src/apple/templates.d.ts +4 -0
- package/dist/src/apple/templates.js +19 -0
- package/dist/src/apple/templates.js.map +1 -0
- package/dist/src/apple/xcode-manager.d.ts +4 -0
- package/dist/src/apple/xcode-manager.js +145 -0
- package/dist/src/apple/xcode-manager.js.map +1 -0
- package/dist/src/sourcemaps/sourcemaps-wizard.js +143 -71
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/angular.d.ts +1 -0
- package/dist/src/sourcemaps/tools/angular.js +76 -0
- package/dist/src/sourcemaps/tools/angular.js.map +1 -0
- package/dist/src/sourcemaps/tools/esbuild.js +2 -1
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -1
- package/dist/src/sourcemaps/tools/rollup.js +2 -1
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +2 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +2 -1
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sourcemaps/tools/webpack.js +2 -1
- package/dist/src/sourcemaps/tools/webpack.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.d.ts +3 -0
- package/dist/src/sourcemaps/utils/detect-tool.js +73 -0
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -0
- package/dist/src/sourcemaps/utils/other-wizards.d.ts +4 -0
- package/dist/src/sourcemaps/utils/other-wizards.js +183 -0
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -0
- package/dist/src/sourcemaps/utils/sdk-version.js +14 -13
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +2 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/telemetry.d.ts +1 -0
- package/dist/src/telemetry.js +7 -1
- package/dist/src/telemetry.js.map +1 -1
- package/dist/src/utils/bash.d.ts +3 -0
- package/dist/src/utils/bash.js +118 -0
- package/dist/src/utils/bash.js.map +1 -0
- package/dist/src/utils/clack-utils.d.ts +9 -8
- package/dist/src/utils/clack-utils.js +54 -21
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/package-json.d.ts +19 -0
- package/dist/src/utils/package-json.js +29 -0
- package/dist/src/utils/package-json.js.map +1 -0
- package/dist/src/utils/types.d.ts +4 -0
- package/dist/src/utils/types.js.map +1 -1
- package/lib/Constants.ts +6 -0
- package/lib/Helper/Wizard.ts +3 -0
- package/lib/Helper/__tests__/SentryCli.ts +2 -1
- package/lib/Steps/ChooseIntegration.ts +4 -0
- package/lib/Steps/Integrations/Apple.ts +27 -0
- package/lib/Steps/Integrations/NextJsShim.ts +1 -0
- package/lib/Steps/Integrations/SourceMapsShim.ts +1 -0
- package/lib/Steps/Integrations/SvelteKitShim.ts +1 -0
- package/package-lock.json +8910 -0
- package/package.json +2 -2
- package/src/apple/apple-wizard.ts +150 -0
- package/src/apple/code-tools.ts +81 -0
- package/src/apple/templates.ts +39 -0
- package/src/apple/xcode-manager.ts +147 -0
- package/src/sourcemaps/sourcemaps-wizard.ts +156 -91
- package/src/sourcemaps/tools/angular.ts +42 -0
- package/src/sourcemaps/tools/esbuild.ts +1 -1
- package/src/sourcemaps/tools/rollup.ts +2 -4
- package/src/sourcemaps/tools/sentry-cli.ts +1 -1
- package/src/sourcemaps/tools/vite.ts +1 -1
- package/src/sourcemaps/tools/webpack.ts +1 -1
- package/src/sourcemaps/utils/detect-tool.ts +41 -0
- package/src/sourcemaps/utils/other-wizards.ts +148 -0
- package/src/sourcemaps/utils/sdk-version.ts +9 -16
- package/src/sveltekit/sveltekit-wizard.ts +1 -1
- package/src/telemetry.ts +8 -0
- package/src/utils/bash.ts +44 -0
- package/src/utils/clack-utils.ts +44 -37
- package/src/utils/package-json.ts +45 -0
- package/src/utils/types.ts +5 -0
|
@@ -77,9 +77,25 @@ var rollup_1 = require("./tools/rollup");
|
|
|
77
77
|
var esbuild_1 = require("./tools/esbuild");
|
|
78
78
|
var create_react_app_1 = require("./tools/create-react-app");
|
|
79
79
|
var sdk_version_1 = require("./utils/sdk-version");
|
|
80
|
+
var telemetry_1 = require("../telemetry");
|
|
81
|
+
var url_1 = require("url");
|
|
82
|
+
var other_wizards_1 = require("./utils/other-wizards");
|
|
83
|
+
var angular_1 = require("./tools/angular");
|
|
84
|
+
var detect_tool_1 = require("./utils/detect-tool");
|
|
80
85
|
function runSourcemapsWizard(options) {
|
|
81
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
82
|
-
|
|
87
|
+
return __generator(this, function (_a) {
|
|
88
|
+
return [2 /*return*/, (0, telemetry_1.withTelemetry)({
|
|
89
|
+
enabled: options.telemetryEnabled,
|
|
90
|
+
integration: 'sourcemaps',
|
|
91
|
+
}, function () { return runSourcemapsWizardWithTelemetry(options); })];
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
exports.runSourcemapsWizard = runSourcemapsWizard;
|
|
96
|
+
function runSourcemapsWizardWithTelemetry(options) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
98
|
+
var moreSuitableWizard, _a, sentryUrl, selfHosted, _b, projects, apiKeys, selectedProject, selectedTool;
|
|
83
99
|
return __generator(this, function (_c) {
|
|
84
100
|
switch (_c.label) {
|
|
85
101
|
case 0:
|
|
@@ -88,76 +104,84 @@ function runSourcemapsWizard(options) {
|
|
|
88
104
|
message: 'This wizard will help you upload source maps to Sentry as part of your build.\nThank you for using Sentry :)\n\n(This setup wizard sends telemetry data and crash reports to Sentry.\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',
|
|
89
105
|
promoCode: options.promoCode,
|
|
90
106
|
});
|
|
91
|
-
return [4 /*yield*/, (0,
|
|
107
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('check-framework-wizard', other_wizards_1.checkIfMoreSuitableWizardExistsAndAskForRedirect)];
|
|
92
108
|
case 1:
|
|
93
|
-
_c.sent();
|
|
94
|
-
return [
|
|
109
|
+
moreSuitableWizard = _c.sent();
|
|
110
|
+
if (!moreSuitableWizard) return [3 /*break*/, 3];
|
|
111
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('run-framework-wizard', function () { return moreSuitableWizard(options); })];
|
|
95
112
|
case 2:
|
|
96
113
|
_c.sent();
|
|
97
|
-
return [
|
|
98
|
-
case 3:
|
|
114
|
+
return [2 /*return*/];
|
|
115
|
+
case 3: return [4 /*yield*/, (0, telemetry_1.traceStep)('detect-git', clack_utils_1.confirmContinueEvenThoughNoGitRepo)];
|
|
116
|
+
case 4:
|
|
117
|
+
_c.sent();
|
|
118
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('check-sdk-version', sdk_version_1.ensureMinimumSdkVersionIsInstalled)];
|
|
119
|
+
case 5:
|
|
120
|
+
_c.sent();
|
|
121
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('ask-self-hosted', function () { return (0, clack_utils_1.askForSelfHosted)(options.url); })];
|
|
122
|
+
case 6:
|
|
99
123
|
_a = _c.sent(), sentryUrl = _a.url, selfHosted = _a.selfHosted;
|
|
100
|
-
return [4 /*yield*/, (0,
|
|
101
|
-
|
|
102
|
-
|
|
124
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('login', function () {
|
|
125
|
+
return (0, clack_utils_1.askForWizardLogin)({
|
|
126
|
+
promoCode: options.promoCode,
|
|
127
|
+
url: sentryUrl,
|
|
128
|
+
});
|
|
103
129
|
})];
|
|
104
|
-
case
|
|
130
|
+
case 7:
|
|
105
131
|
_b = _c.sent(), projects = _b.projects, apiKeys = _b.apiKeys;
|
|
106
|
-
return [4 /*yield*/, (0,
|
|
107
|
-
|
|
132
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('select-project', function () {
|
|
133
|
+
return (0, clack_utils_1.askForProjectSelection)(projects);
|
|
134
|
+
})];
|
|
135
|
+
case 8:
|
|
108
136
|
selectedProject = _c.sent();
|
|
109
|
-
return [4 /*yield*/,
|
|
110
|
-
case
|
|
137
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('select-tool', askForUsedBundlerTool)];
|
|
138
|
+
case 9:
|
|
111
139
|
selectedTool = _c.sent();
|
|
112
140
|
Sentry.setTag('selected-tool', selectedTool);
|
|
113
|
-
return [4 /*yield*/,
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
141
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('tool-setup', function () {
|
|
142
|
+
return startToolSetupFlow(selectedTool, {
|
|
143
|
+
selfHosted: selfHosted,
|
|
144
|
+
orgSlug: selectedProject.organization.slug,
|
|
145
|
+
projectSlug: selectedProject.slug,
|
|
146
|
+
url: sentryUrl,
|
|
147
|
+
authToken: apiKeys.token,
|
|
148
|
+
});
|
|
119
149
|
})];
|
|
120
|
-
case
|
|
150
|
+
case 10:
|
|
121
151
|
_c.sent();
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
message: 'Did you configure CI as shown above?',
|
|
129
|
-
options: [
|
|
130
|
-
{ label: 'Yes, continue!', value: true },
|
|
131
|
-
{
|
|
132
|
-
label: "I'll do it later...",
|
|
133
|
-
value: false,
|
|
134
|
-
hint: chalk_1.default.yellow('You need to set the auth token to upload source maps in CI'),
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
initialValue: true,
|
|
138
|
-
}))];
|
|
139
|
-
case 8:
|
|
140
|
-
addedEnvVarToCI = _c.sent();
|
|
141
|
-
Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);
|
|
142
|
-
if (!addedEnvVarToCI) {
|
|
143
|
-
prompts_1.default.log.info("Don't forget! :)");
|
|
144
|
-
}
|
|
145
|
-
arrow = (0, is_unicorn_supported_1.isUnicodeSupported)() ? '→' : '->';
|
|
146
|
-
prompts_1.default.outro("".concat(chalk_1.default.green("That's it - everything is set up!"), "\n\n ").concat(chalk_1.default.cyan("Validate your setup with the following Steps:\n\n 1. Build your application in ".concat(chalk_1.default.bold('production mode'), ".\n ").concat(chalk_1.default.gray("".concat(arrow, " You should see source map upload logs in your console.")), "\n 2. Run your application and throw a test error.\n ").concat(chalk_1.default.gray("".concat(arrow, " The error should be visible in Sentry.")), "\n 3. Open the error in Sentry and verify that it's source-mapped.\n ").concat(chalk_1.default.gray("".concat(arrow, " The stack trace should show your original source code.")), "\n ")), "\n ").concat(chalk_1.default.dim("If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues"), "\n"));
|
|
152
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('ci-setup', function () { return setupCi(apiKeys.token); })];
|
|
153
|
+
case 11:
|
|
154
|
+
_c.sent();
|
|
155
|
+
(0, telemetry_1.traceStep)('outro', function () {
|
|
156
|
+
return printOutro(sentryUrl, selectedProject.organization.slug, selectedProject.id);
|
|
157
|
+
});
|
|
147
158
|
return [2 /*return*/];
|
|
148
159
|
}
|
|
149
160
|
});
|
|
150
161
|
});
|
|
151
162
|
}
|
|
152
|
-
exports.runSourcemapsWizard = runSourcemapsWizard;
|
|
153
163
|
function askForUsedBundlerTool() {
|
|
154
164
|
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
-
var selectedTool;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
var selectedTool, _a, _b, _c;
|
|
166
|
+
var _d;
|
|
167
|
+
return __generator(this, function (_e) {
|
|
168
|
+
switch (_e.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
_a = clack_utils_1.abortIfCancelled;
|
|
171
|
+
_c = (_b = prompts_1.default).select;
|
|
172
|
+
_d = {
|
|
173
|
+
message: 'Which framework, bundler or build tool are you using?',
|
|
160
174
|
options: [
|
|
175
|
+
{
|
|
176
|
+
label: 'Angular',
|
|
177
|
+
value: 'angular',
|
|
178
|
+
hint: 'Select this option if you are using Angular.',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
label: 'Create React App',
|
|
182
|
+
value: 'create-react-app',
|
|
183
|
+
hint: 'Select this option if you set up your app with Create React App.',
|
|
184
|
+
},
|
|
161
185
|
{
|
|
162
186
|
label: 'Webpack',
|
|
163
187
|
value: 'webpack',
|
|
@@ -183,20 +207,18 @@ function askForUsedBundlerTool() {
|
|
|
183
207
|
value: 'tsc',
|
|
184
208
|
hint: 'Configure source maps when using tsc as build tool',
|
|
185
209
|
},
|
|
186
|
-
{
|
|
187
|
-
label: 'Create React App',
|
|
188
|
-
value: 'create-react-app',
|
|
189
|
-
hint: 'Select this option if you set up your app with Create React App.',
|
|
190
|
-
},
|
|
191
210
|
{
|
|
192
211
|
label: 'None of the above',
|
|
193
212
|
value: 'sentry-cli',
|
|
194
213
|
hint: 'This will configure source maps upload for you using sentry-cli',
|
|
195
214
|
},
|
|
196
|
-
]
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
215
|
+
]
|
|
216
|
+
};
|
|
217
|
+
return [4 /*yield*/, (0, detect_tool_1.detectUsedTool)()];
|
|
218
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, [_c.apply(_b, [(_d.initialValue = _e.sent(),
|
|
219
|
+
_d)])])];
|
|
220
|
+
case 2:
|
|
221
|
+
selectedTool = _e.sent();
|
|
200
222
|
return [2 /*return*/, selectedTool];
|
|
201
223
|
}
|
|
202
224
|
});
|
|
@@ -216,39 +238,89 @@ function startToolSetupFlow(selctedTool, options) {
|
|
|
216
238
|
case 'rollup': return [3 /*break*/, 7];
|
|
217
239
|
case 'tsc': return [3 /*break*/, 9];
|
|
218
240
|
case 'create-react-app': return [3 /*break*/, 11];
|
|
241
|
+
case 'angular': return [3 /*break*/, 13];
|
|
219
242
|
}
|
|
220
|
-
return [3 /*break*/,
|
|
243
|
+
return [3 /*break*/, 15];
|
|
221
244
|
case 1: return [4 /*yield*/, (0, webpack_1.configureWebPackPlugin)(options)];
|
|
222
245
|
case 2:
|
|
223
246
|
_b.sent();
|
|
224
|
-
return [3 /*break*/,
|
|
247
|
+
return [3 /*break*/, 17];
|
|
225
248
|
case 3: return [4 /*yield*/, (0, vite_1.configureVitePlugin)(options)];
|
|
226
249
|
case 4:
|
|
227
250
|
_b.sent();
|
|
228
|
-
return [3 /*break*/,
|
|
251
|
+
return [3 /*break*/, 17];
|
|
229
252
|
case 5: return [4 /*yield*/, (0, esbuild_1.configureEsbuildPlugin)(options)];
|
|
230
253
|
case 6:
|
|
231
254
|
_b.sent();
|
|
232
|
-
return [3 /*break*/,
|
|
255
|
+
return [3 /*break*/, 17];
|
|
233
256
|
case 7: return [4 /*yield*/, (0, rollup_1.configureRollupPlugin)(options)];
|
|
234
257
|
case 8:
|
|
235
258
|
_b.sent();
|
|
236
|
-
return [3 /*break*/,
|
|
259
|
+
return [3 /*break*/, 17];
|
|
237
260
|
case 9: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, tsc_1.configureTscSourcemapGenerationFlow)];
|
|
238
261
|
case 10:
|
|
239
262
|
_b.sent();
|
|
240
|
-
return [3 /*break*/,
|
|
263
|
+
return [3 /*break*/, 17];
|
|
241
264
|
case 11: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, create_react_app_1.configureCRASourcemapGenerationFlow)];
|
|
242
265
|
case 12:
|
|
243
266
|
_b.sent();
|
|
244
|
-
return [3 /*break*/,
|
|
245
|
-
case 13: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options)];
|
|
267
|
+
return [3 /*break*/, 17];
|
|
268
|
+
case 13: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options, angular_1.configureAngularSourcemapGenerationFlow)];
|
|
246
269
|
case 14:
|
|
247
270
|
_b.sent();
|
|
248
|
-
return [3 /*break*/,
|
|
249
|
-
case 15: return [
|
|
271
|
+
return [3 /*break*/, 17];
|
|
272
|
+
case 15: return [4 /*yield*/, (0, sentry_cli_1.configureSentryCLI)(options)];
|
|
273
|
+
case 16:
|
|
274
|
+
_b.sent();
|
|
275
|
+
return [3 /*break*/, 17];
|
|
276
|
+
case 17: return [2 /*return*/];
|
|
250
277
|
}
|
|
251
278
|
});
|
|
252
279
|
});
|
|
253
280
|
}
|
|
281
|
+
function setupCi(authToken) {
|
|
282
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
283
|
+
var addedEnvVarToCI;
|
|
284
|
+
return __generator(this, function (_a) {
|
|
285
|
+
switch (_a.label) {
|
|
286
|
+
case 0:
|
|
287
|
+
prompts_1.default.log.step('Add the Sentry authentication token as an environment variable to your CI setup:');
|
|
288
|
+
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
289
|
+
// eslint-disable-next-line no-console
|
|
290
|
+
console.log(chalk_1.default.greenBright("\nSENTRY_AUTH_TOKEN=".concat(authToken, "\n")));
|
|
291
|
+
prompts_1.default.log.warn(chalk_1.default.yellow('DO NOT commit this auth token to your repository!'));
|
|
292
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
293
|
+
message: 'Did you configure CI as shown above?',
|
|
294
|
+
options: [
|
|
295
|
+
{ label: 'Yes, continue!', value: true },
|
|
296
|
+
{
|
|
297
|
+
label: "I'll do it later...",
|
|
298
|
+
value: false,
|
|
299
|
+
hint: chalk_1.default.yellow('You need to set the auth token to upload source maps in CI'),
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
initialValue: true,
|
|
303
|
+
}))];
|
|
304
|
+
case 1:
|
|
305
|
+
addedEnvVarToCI = _a.sent();
|
|
306
|
+
Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);
|
|
307
|
+
if (!addedEnvVarToCI) {
|
|
308
|
+
prompts_1.default.log.info("Don't forget! :)");
|
|
309
|
+
}
|
|
310
|
+
return [2 /*return*/];
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
function printOutro(url, orgSlug, projectId) {
|
|
316
|
+
var pacMan = (0, clack_utils_1.detectPackageManager)() || 'npm';
|
|
317
|
+
var buildCommand = "'".concat(pacMan).concat(pacMan === 'npm' ? ' run' : '', " build'");
|
|
318
|
+
var urlObject = new url_1.URL(url);
|
|
319
|
+
urlObject.host = "".concat(orgSlug, ".").concat(urlObject.host);
|
|
320
|
+
urlObject.pathname = '/issues/';
|
|
321
|
+
urlObject.searchParams.set('project', projectId);
|
|
322
|
+
var issueStreamUrl = urlObject.toString();
|
|
323
|
+
var arrow = (0, is_unicorn_supported_1.isUnicodeSupported)() ? '→' : '->';
|
|
324
|
+
prompts_1.default.outro("".concat(chalk_1.default.green("That's it - everything is set up!"), "\n\n ").concat(chalk_1.default.cyan("Test and validate your setup locally with the following Steps:\n\n 1. Build your application in ".concat(chalk_1.default.bold('production mode'), ".\n ").concat(chalk_1.default.gray("".concat(arrow, " For example, run ").concat(chalk_1.default.bold(buildCommand), ".")), "\n ").concat(chalk_1.default.gray("".concat(arrow, " You should see source map upload logs in your console.")), "\n 2. Run your application and throw a test error.\n ").concat(chalk_1.default.gray("".concat(arrow, " The error should appear in Sentry:")), "\n ").concat(chalk_1.default.gray("".concat(arrow, " ").concat(issueStreamUrl)), "\n 3. Open the error in Sentry and verify that it's source-mapped.\n ").concat(chalk_1.default.gray("".concat(arrow, " The stack trace should show your original source code.")), "\n ")), "\n ").concat(chalk_1.default.dim("If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues"), "\n"));
|
|
325
|
+
}
|
|
254
326
|
//# sourceMappingURL=sourcemaps-wizard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sourcemaps-wizard.js","sourceRoot":"","sources":["../../../src/sourcemaps/sourcemaps-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AAEvC,oDAO8B;AAC9B,6EAA0E;AAE1E,qCAAmD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BAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,yBAAM;wBAEN,qBAAM,IAAA,0BAAmB,EAAC,OAAO,CAAC,EAAA;;oBAAlC,SAAkC,CAAC;oBACnC,yBAAM;wBAEN,qBAAM,IAAA,gCAAsB,EAAC,OAAO,CAAC,EAAA;;oBAArC,SAAqC,CAAC;oBACtC,yBAAM;wBAEN,qBAAM,IAAA,8BAAqB,EAAC,OAAO,CAAC,EAAA;;oBAApC,SAAoC,CAAC;oBACrC,yBAAM;wBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,EAAE,yCAAmC,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;oBACvE,yBAAM;yBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,EAAE,sDAAmC,CAAC,EAAA;;oBAAtE,SAAsE,CAAC;oBACvE,yBAAM;yBAEN,qBAAM,IAAA,+BAAkB,EAAC,OAAO,CAAC,EAAA;;oBAAjC,SAAiC,CAAC;oBAClC,yBAAM;;;;;CAEX","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nimport {\n abortIfCancelled,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n printWelcome,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { configureSentryCLI } from './tools/sentry-cli';\nimport { configureWebPackPlugin } from './tools/webpack';\nimport { configureTscSourcemapGenerationFlow } from './tools/tsc';\nimport { configureRollupPlugin } from './tools/rollup';\nimport { configureEsbuildPlugin } from './tools/esbuild';\nimport { WizardOptions } from '../utils/types';\nimport { configureCRASourcemapGenerationFlow } from './tools/create-react-app';\nimport { ensureMinimumSdkVersionIsInstalled } from './utils/sdk-version';\n\ntype SupportedTools =\n | 'webpack'\n | 'vite'\n | 'rollup'\n | 'esbuild'\n | 'tsc'\n | 'sentry-cli'\n | 'create-react-app';\n\nexport async function runSourcemapsWizard(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Source Maps Upload Configuration Wizard',\n message:\n 'This wizard will help you upload source maps to Sentry as part of your build.\\nThank you for using Sentry :)\\n\\n(This setup wizard sends telemetry data and crash reports to Sentry.\\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n await ensureMinimumSdkVersionIsInstalled();\n\n const { url: sentryUrl, selfHosted } = await askForSelfHosted(options.url);\n\n const { projects, apiKeys } = await askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n const selectedTool = await askForUsedBundlerTool();\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n });\n\n clack.log.step(\n 'Add the Sentry authentication token as an environment variable to your CI setup:',\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\nSENTRY_AUTH_TOKEN=${apiKeys.token}\n`),\n );\n\n clack.log.warn(\n chalk.yellow('DO NOT commit this auth token to your repository!'),\n );\n\n const addedEnvVarToCI = await abortIfCancelled(\n clack.select({\n message: 'Did you configure CI as shown above?',\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to set the auth token to upload source maps in CI',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);\n\n if (!addedEnvVarToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Validate your setup with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}.\n ${chalk.gray(\n `${arrow} You should see source map upload logs in your console.`,\n )}\n 2. Run your application and throw a test error.\n ${chalk.gray(`${arrow} The error should be visible in Sentry.`)}\n 3. Open the error in Sentry and verify that it's source-mapped.\n ${chalk.gray(\n `${arrow} The stack trace should show your original source code.`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedTools> {\n const selectedTool: SupportedTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which bundler or build tool are you using?',\n options: [\n {\n label: 'Webpack',\n value: 'webpack',\n hint: 'Select this if you are using Webpack and you have access to your Webpack config.',\n },\n {\n label: 'Vite',\n value: 'vite',\n hint: 'Select this if you are using Vite and you have access to your Vite config.',\n },\n {\n label: 'esbuild',\n value: 'esbuild',\n hint: 'Select this if you are using esbuild and you have access to your esbuild config.',\n },\n {\n label: 'Rollup',\n value: 'rollup',\n hint: 'Select this if you are using Rollup and you have access to your Rollup config.',\n },\n {\n label: 'tsc',\n value: 'tsc',\n hint: 'Configure source maps when using tsc as build tool',\n },\n {\n label: 'Create React App',\n value: 'create-react-app',\n hint: 'Select this option if you set up your app with Create React App.',\n },\n {\n label: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'esbuild':\n await configureEsbuildPlugin(options);\n break;\n case 'rollup':\n await configureRollupPlugin(options);\n break;\n case 'tsc':\n await configureSentryCLI(options, configureTscSourcemapGenerationFlow);\n break;\n case 'create-react-app':\n await configureSentryCLI(options, configureCRASourcemapGenerationFlow);\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sourcemaps-wizard.js","sourceRoot":"","sources":["../../../src/sourcemaps/sourcemaps-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AAEvC,oDAQ8B;AAC9B,6EAA0E;AAE1E,qCAAmD;AACnD,iDAAwD;AACxD,2CAAyD;AACzD,mCAAkE;AAClE,yCAAuD;AACvD,2CAAyD;AAEzD,6DAA+E;AAC/E,mDAAyE;AACzE,0CAAwD;AACxD,2BAA0B;AAC1B,uDAAyF;AACzF,2CAA0E;AAC1E,mDAAqE;AAErE,SAAsB,mBAAmB,CACvC,OAAsB;;;YAEtB,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,YAAY;iBAC1B,EACD,cAAM,OAAA,gCAAgC,CAAC,OAAO,CAAC,EAAzC,CAAyC,CAChD,EAAC;;;CACH;AAVD,kDAUC;AAED,SAAe,gCAAgC,CAC7C,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,gDAAgD;wBAC5D,OAAO,EACL,yQAAyQ;wBAC3Q,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEwB,qBAAM,IAAA,qBAAS,EACxC,wBAAwB,EACxB,gEAAgD,CACjD,EAAA;;oBAHK,kBAAkB,GAAG,SAG1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K,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,YAAS,CAAC;IAE1E,IAAM,SAAS,GAAG,IAAI,SAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,SAAS,CAAC,IAAI,GAAG,UAAG,OAAO,cAAI,SAAS,CAAC,IAAI,CAAE,CAAC;IAChD,SAAS,CAAC,QAAQ,GAAG,UAAU,CAAC;IAChC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAEjD,IAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;IAE5C,IAAM,KAAK,GAAG,IAAA,yCAAkB,GAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAEhD,iBAAK,CAAC,KAAK,CAAC,UAAG,eAAK,CAAC,KAAK,CAAC,mCAAmC,CAAC,oBAE5D,eAAK,CAAC,IAAI,CAAC,4GAEkB,eAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,sBACvD,eAAK,CAAC,IAAI,CAAC,UAAG,KAAK,+BAAqB,eAAK,CAAC,IAAI,CAAC,YAAY,CAAC,MAAG,CAAC,qBACpE,eAAK,CAAC,IAAI,CACV,UAAG,KAAK,4DAAyD,CAClE,yEAEC,eAAK,CAAC,IAAI,CAAC,UAAG,KAAK,wCAAqC,CAAC,qBACzD,eAAK,CAAC,IAAI,CAAC,UAAG,KAAK,cAAI,cAAc,CAAE,CAAC,yFAExC,eAAK,CAAC,IAAI,CACV,UAAG,KAAK,4DAAyD,CAClE,UACH,CAAC,kBACA,eAAK,CAAC,GAAG,CACT,6RAIoD,CACrD,OACH,CAAC,CAAC;AACH,CAAC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\n\nimport {\n abortIfCancelled,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n detectPackageManager,\n printWelcome,\n} from '../utils/clack-utils';\nimport { isUnicodeSupported } from '../utils/vendor/is-unicorn-supported';\nimport { SourceMapUploadToolConfigurationOptions } from './tools/types';\nimport { configureVitePlugin } from './tools/vite';\nimport { configureSentryCLI } from './tools/sentry-cli';\nimport { configureWebPackPlugin } from './tools/webpack';\nimport { configureTscSourcemapGenerationFlow } from './tools/tsc';\nimport { configureRollupPlugin } from './tools/rollup';\nimport { configureEsbuildPlugin } from './tools/esbuild';\nimport { WizardOptions } from '../utils/types';\nimport { configureCRASourcemapGenerationFlow } from './tools/create-react-app';\nimport { ensureMinimumSdkVersionIsInstalled } from './utils/sdk-version';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { URL } from 'url';\nimport { checkIfMoreSuitableWizardExistsAndAskForRedirect } from './utils/other-wizards';\nimport { configureAngularSourcemapGenerationFlow } from './tools/angular';\nimport { detectUsedTool, SupportedTools } from './utils/detect-tool';\n\nexport async function runSourcemapsWizard(\n options: WizardOptions,\n): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'sourcemaps',\n },\n () => runSourcemapsWizardWithTelemetry(options),\n );\n}\n\nasync function runSourcemapsWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Source Maps Upload Configuration Wizard',\n message:\n 'This wizard will help you upload source maps to Sentry as part of your build.\\nThank you for using Sentry :)\\n\\n(This setup wizard sends telemetry data and crash reports to Sentry.\\nYou can turn this off by running the wizard with the `--disable-telemetry` flag.)',\n promoCode: options.promoCode,\n });\n\n const moreSuitableWizard = await traceStep(\n 'check-framework-wizard',\n checkIfMoreSuitableWizardExistsAndAskForRedirect,\n );\n if (moreSuitableWizard) {\n await traceStep('run-framework-wizard', () => moreSuitableWizard(options));\n return;\n }\n\n await traceStep('detect-git', confirmContinueEvenThoughNoGitRepo);\n\n await traceStep('check-sdk-version', ensureMinimumSdkVersionIsInstalled);\n\n const { url: sentryUrl, selfHosted } = await traceStep(\n 'ask-self-hosted',\n () => askForSelfHosted(options.url),\n );\n\n const { projects, apiKeys } = await traceStep('login', () =>\n askForWizardLogin({\n promoCode: options.promoCode,\n url: sentryUrl,\n }),\n );\n\n const selectedProject = await traceStep('select-project', () =>\n askForProjectSelection(projects),\n );\n\n const selectedTool = await traceStep('select-tool', askForUsedBundlerTool);\n\n Sentry.setTag('selected-tool', selectedTool);\n\n await traceStep('tool-setup', () =>\n startToolSetupFlow(selectedTool, {\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n authToken: apiKeys.token,\n }),\n );\n\n await traceStep('ci-setup', () => setupCi(apiKeys.token));\n\n traceStep('outro', () =>\n printOutro(\n sentryUrl,\n selectedProject.organization.slug,\n selectedProject.id,\n ),\n );\n}\n\nasync function askForUsedBundlerTool(): Promise<SupportedTools> {\n const selectedTool: SupportedTools | symbol = await abortIfCancelled(\n clack.select({\n message: 'Which framework, bundler or build tool are you using?',\n options: [\n {\n label: 'Angular',\n value: 'angular',\n hint: 'Select this option if you are using Angular.',\n },\n {\n label: 'Create React App',\n value: 'create-react-app',\n hint: 'Select this option if you set up your app with Create React App.',\n },\n {\n label: 'Webpack',\n value: 'webpack',\n hint: 'Select this if you are using Webpack and you have access to your Webpack config.',\n },\n {\n label: 'Vite',\n value: 'vite',\n hint: 'Select this if you are using Vite and you have access to your Vite config.',\n },\n {\n label: 'esbuild',\n value: 'esbuild',\n hint: 'Select this if you are using esbuild and you have access to your esbuild config.',\n },\n {\n label: 'Rollup',\n value: 'rollup',\n hint: 'Select this if you are using Rollup and you have access to your Rollup config.',\n },\n {\n label: 'tsc',\n value: 'tsc',\n hint: 'Configure source maps when using tsc as build tool',\n },\n {\n label: 'None of the above',\n value: 'sentry-cli',\n hint: 'This will configure source maps upload for you using sentry-cli',\n },\n ],\n initialValue: await detectUsedTool(),\n }),\n );\n\n return selectedTool;\n}\n\nasync function startToolSetupFlow(\n selctedTool: SupportedTools,\n options: SourceMapUploadToolConfigurationOptions,\n): Promise<void> {\n switch (selctedTool) {\n case 'webpack':\n await configureWebPackPlugin(options);\n break;\n case 'vite':\n await configureVitePlugin(options);\n break;\n case 'esbuild':\n await configureEsbuildPlugin(options);\n break;\n case 'rollup':\n await configureRollupPlugin(options);\n break;\n case 'tsc':\n await configureSentryCLI(options, configureTscSourcemapGenerationFlow);\n break;\n case 'create-react-app':\n await configureSentryCLI(options, configureCRASourcemapGenerationFlow);\n break;\n case 'angular':\n await configureSentryCLI(\n options,\n configureAngularSourcemapGenerationFlow,\n );\n break;\n default:\n await configureSentryCLI(options);\n break;\n }\n}\n\nasync function setupCi(authToken: string) {\n clack.log.step(\n 'Add the Sentry authentication token as an environment variable to your CI setup:',\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(\n chalk.greenBright(`\nSENTRY_AUTH_TOKEN=${authToken}\n`),\n );\n\n clack.log.warn(\n chalk.yellow('DO NOT commit this auth token to your repository!'),\n );\n\n const addedEnvVarToCI = await abortIfCancelled(\n clack.select({\n message: 'Did you configure CI as shown above?',\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to set the auth token to upload source maps in CI',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-env-var-to-ci', addedEnvVarToCI);\n\n if (!addedEnvVarToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n}\n\nfunction printOutro(url: string, orgSlug: string, projectId: string) {\n const pacMan = detectPackageManager() || 'npm';\n const buildCommand = `'${pacMan}${pacMan === 'npm' ? ' run' : ''} build'`;\n\n const urlObject = new URL(url);\n urlObject.host = `${orgSlug}.${urlObject.host}`;\n urlObject.pathname = '/issues/';\n urlObject.searchParams.set('project', projectId);\n\n const issueStreamUrl = urlObject.toString();\n\n const arrow = isUnicodeSupported() ? '→' : '->';\n\n clack.outro(`${chalk.green(\"That's it - everything is set up!\")}\n\n ${chalk.cyan(`Test and validate your setup locally with the following Steps:\n\n 1. Build your application in ${chalk.bold('production mode')}.\n ${chalk.gray(`${arrow} For example, run ${chalk.bold(buildCommand)}.`)}\n ${chalk.gray(\n `${arrow} You should see source map upload logs in your console.`,\n )}\n 2. Run your application and throw a test error.\n ${chalk.gray(`${arrow} The error should appear in Sentry:`)}\n ${chalk.gray(`${arrow} ${issueStreamUrl}`)}\n 3. Open the error in Sentry and verify that it's source-mapped.\n ${chalk.gray(\n `${arrow} The stack trace should show your original source code.`,\n )}\n `)}\n ${chalk.dim(\n `If you encounter any issues, please refer to the Troubleshooting Guide:\n https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js\n\n If the guide doesn't help or you encounter a bug, please let us know:\n https://github.com/getsentry/sentry-javascript/issues`,\n )}\n`);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function configureAngularSourcemapGenerationFlow(): Promise<void>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
+
};
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.configureAngularSourcemapGenerationFlow = void 0;
|
|
43
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
44
|
+
var prompts_1 = __importDefault(require("@clack/prompts"));
|
|
45
|
+
var chalk_1 = __importDefault(require("chalk"));
|
|
46
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
47
|
+
var angularJsonTemplate = chalk_1.default.gray("{\n \"projects\": {\n \"your-project\": {\n \"architect\": {\n \"build\": {\n \"options\": {\n ".concat(chalk_1.default.greenBright("\"sourceMap\": true"), "\n },\n },\n }\n }\n }\n}"));
|
|
48
|
+
function configureAngularSourcemapGenerationFlow() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
prompts_1.default.log.info("Enable generating source maps in your ".concat(chalk_1.default.bold('angular.json'), " file:"));
|
|
54
|
+
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
55
|
+
// eslint-disable-next-line no-console
|
|
56
|
+
console.log(angularJsonTemplate);
|
|
57
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
58
|
+
message: "Verify that you are generating source maps when building your Angular app.",
|
|
59
|
+
options: [
|
|
60
|
+
{
|
|
61
|
+
label: 'I checked!',
|
|
62
|
+
hint: 'My build output folder contains .js.map files after a build.',
|
|
63
|
+
value: true,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
initialValue: true,
|
|
67
|
+
}))];
|
|
68
|
+
case 1:
|
|
69
|
+
_a.sent();
|
|
70
|
+
return [2 /*return*/];
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
exports.configureAngularSourcemapGenerationFlow = configureAngularSourcemapGenerationFlow;
|
|
76
|
+
//# sourceMappingURL=angular.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/angular.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,uDAA2D;AAE3D,IAAM,mBAAmB,GAAG,eAAK,CAAC,IAAI,CAAC,6IAMzB,eAAK,CAAC,WAAW,CAAC,qBAAmB,CAAC,uDAMlD,CAAC,CAAC;AAEJ,SAAsB,uCAAuC;;;;;oBAC3D,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,gDAAyC,eAAK,CAAC,IAAI,CAAC,cAAc,CAAC,WAAQ,CAC5E,CAAC;oBAEF,8FAA8F;oBAC9F,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;oBAEjC,qBAAM,IAAA,8BAAgB,EACpB,iBAAK,CAAC,MAAM,CAAC;4BACX,OAAO,EAAE,4EAA4E;4BACrF,OAAO,EAAE;gCACP;oCACE,KAAK,EAAE,YAAY;oCACnB,IAAI,EAAE,8DAA8D;oCACpE,KAAK,EAAE,IAAI;iCACZ;6BACF;4BACD,YAAY,EAAE,IAAI;yBACnB,CAAC,CACH,EAAA;;oBAZD,SAYC,CAAC;;;;;CACH;AAtBD,0FAsBC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { abortIfCancelled } from '../../utils/clack-utils';\n\nconst angularJsonTemplate = chalk.gray(`{\n \"projects\": {\n \"your-project\": {\n \"architect\": {\n \"build\": {\n \"options\": {\n ${chalk.greenBright(`\"sourceMap\": true`)}\n },\n },\n }\n }\n }\n}`);\n\nexport async function configureAngularSourcemapGenerationFlow(): Promise<void> {\n clack.log.info(\n `Enable generating source maps in your ${chalk.bold('angular.json')} file:`,\n );\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(angularJsonTemplate);\n\n await abortIfCancelled(\n clack.select({\n message: `Verify that you are generating source maps when building your Angular app.`,\n options: [\n {\n label: 'I checked!',\n hint: 'My build output folder contains .js.map files after a build.',\n value: true,\n },\n ],\n initialValue: true,\n }),\n );\n}\n"]}
|
|
@@ -67,6 +67,7 @@ exports.configureEsbuildPlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('const { sentryEsbuildPlugin } = require("@sentry/esbuild-plugin");'), "\n\nrequire(\"esbuild\").build({\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n plugins: [\n // Put the Sentry esbuild plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryEsbuildPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"".concat(options.orgSlug, "\",\n project: \"").concat(options.projectSlug, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }),")), "\n ],\n});\n"));
|
|
72
73
|
};
|
|
@@ -80,7 +81,7 @@ var configureEsbuildPlugin = function (options) { return __awaiter(void 0, void
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/esbuild-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/esbuild-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/esb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ErC,qBAAM,IAAA,8BAAgB,EACpB,IAAA,gBAAM,EAAC;wBACL,OAAO,EAAE,iCAAiC;wBAC1C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACnD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;gBAND,SAMC,CAAC;gBAEF,qBAAM,IAAA,4CAA8B,EAAC,OAAO,CAAC,SAAS,CAAC,EAAA;;gBAAvD,SAAuD,CAAC;;;;KACzD,CAAC;AAzBS,QAAA,sBAAsB,0BAyB/B","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack, { select } from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n getPackageDotJson,\n installPackage,\n} from '../../utils/clack-utils';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'const { sentryEsbuildPlugin } = require(\"@sentry/esbuild-plugin\");',\n)}\n\nrequire(\"esbuild\").build({\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n plugins: [\n // Put the Sentry esbuild plugin after all other plugins\n ${chalk.greenBright(`sentryEsbuildPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n});\n`);\n\nexport const configureEsbuildPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/esbuild-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/esbuild-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(`Add the following code to your esbuild config:`);\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(getCodeSnippet(options));\n\n await abortIfCancelled(\n select({\n message: 'Did you copy the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n"]}
|
|
@@ -67,6 +67,7 @@ exports.configureRollupPlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
return chalk_1.default.gray("\n".concat(chalk_1.default.greenBright('import { sentryRollupPlugin } from "@sentry/rollup-plugin";'), "\n\nexport default {\n output: {\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n },\n plugins: [\n // Put the Sentry rollup plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryRollupPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"".concat(options.orgSlug, "\",\n project: \"").concat(options.projectSlug, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }),")), "\n ],\n};\n"));
|
|
72
73
|
};
|
|
@@ -80,7 +81,7 @@ var configureRollupPlugin = function (options) { return __awaiter(void 0, void 0
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/rollup-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/rollup-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/rollup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAKiC;AACjC,yDAA+D;AAO/D,IAAM,cAAc,GAAG,UAAC,OAAgD;IACtE,OAAA,eAAK,CAAC,IAAI,CAAC,YACX,eAAK,CAAC,WAAW,CACjB,6DAA6D,CAC9D,oDAIK,eAAK,CAAC,WAAW,CACjB,6DAA6D,CAC9D,oGAIC,eAAK,CAAC,WAAW,CAAC,8FAEV,OAAO,CAAC,OAAO,mCACX,OAAO,CAAC,WAAW,gBAC/B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAiB,OAAO,CAAC,GAAG,QAAI,CAAC,CAAC,CAAC,EAAE,cAExD,CAAC,iBAGR,CAAC;AAtBA,CAsBA,CAAC;AAEI,IAAM,qBAAqB,GAChC,UAAO,OAAO;;;;;;gBACN,KAAA,4BAAc,CAAA;;oBAClB,WAAW,EAAE,uBAAuB;;gBAClB,KAAA,kCAAmB,CAAA;sBACnC,uBAAuB;gBACvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;oBAJ7B,qBAAM,mBAEJ,mBAAgB,GAAE,4BAEhB,SAAyB,GAC1B;6BACD,EAAA;;gBANF,SAME,CAAC;gBAEH,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;gBAEhE,8FAA8F;gBAC9F,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;gBAErC,qBAAM,IAAA,8BAAgB,EACpB,IAAA,gBAAM,EAAC;wBACL,OAAO,EAAE,iCAAiC;wBAC1C,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACnD,YAAY,EAAE,IAAI;qBACnB,CAAC,CACH,EAAA;;gBAND,SAMC,CAAC;gBAEF,qBAAM,IAAA,4CAA8B,EAAC,OAAO,CAAC,SAAS,CAAC,EAAA;;gBAAvD,SAAuD,CAAC;;;;KACzD,CAAC;AAzBS,QAAA,qBAAqB,yBAyB9B","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack, { select } from '@clack/prompts';\nimport chalk from 'chalk';\nimport {\n abortIfCancelled,\n addDotEnvSentryBuildPluginFile,\n getPackageDotJson,\n installPackage,\n} from '../../utils/clack-utils';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nimport {\n SourceMapUploadToolConfigurationFunction,\n SourceMapUploadToolConfigurationOptions,\n} from './types';\n\nconst getCodeSnippet = (options: SourceMapUploadToolConfigurationOptions) =>\n chalk.gray(`\n${chalk.greenBright(\n 'import { sentryRollupPlugin } from \"@sentry/rollup-plugin\";',\n)}\n\nexport default {\n output: {\n ${chalk.greenBright(\n 'sourcemap: true, // Source map generation must be turned on',\n )}\n },\n plugins: [\n // Put the Sentry rollup plugin after all other plugins\n ${chalk.greenBright(`sentryRollupPlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"${options.orgSlug}\",\n project: \"${options.projectSlug}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n }),`)}\n ],\n};\n`);\n\nexport const configureRollupPlugin: SourceMapUploadToolConfigurationFunction =\n async (options) => {\n await installPackage({\n packageName: '@sentry/rollup-plugin',\n alreadyInstalled: hasPackageInstalled(\n '@sentry/rollup-plugin',\n await getPackageDotJson(),\n ),\n });\n\n clack.log.step(`Add the following code to your rollup config:`);\n\n // Intentially logging directly to console here so that the code can be copied/pasted directly\n // eslint-disable-next-line no-console\n console.log(getCodeSnippet(options));\n\n await abortIfCancelled(\n select({\n message: 'Did you copy the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n\n await addDotEnvSentryBuildPluginFile(options.authToken);\n };\n"]}
|
|
@@ -70,6 +70,7 @@ var Sentry = __importStar(require("@sentry/node"));
|
|
|
70
70
|
var path = __importStar(require("path"));
|
|
71
71
|
var fs = __importStar(require("fs"));
|
|
72
72
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
73
|
+
var package_json_1 = require("../../utils/package-json");
|
|
73
74
|
function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
74
75
|
if (configureSourcemapGenerationFlow === void 0) { configureSourcemapGenerationFlow = defaultConfigureSourcemapGenerationFlow; }
|
|
75
76
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -81,7 +82,7 @@ function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
|
81
82
|
packageDotJson = _b.sent();
|
|
82
83
|
return [4 /*yield*/, (0, clack_utils_1.installPackage)({
|
|
83
84
|
packageName: '@sentry/cli',
|
|
84
|
-
alreadyInstalled: (0,
|
|
85
|
+
alreadyInstalled: (0, package_json_1.hasPackageInstalled)('@sentry/cli', packageDotJson),
|
|
85
86
|
})];
|
|
86
87
|
case 2:
|
|
87
88
|
_b.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry-cli.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/sentry-cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAC1B,mDAAuC;AACvC,yCAA6B;AAC7B,qCAAyB;AACzB,
|
|
1
|
+
{"version":3,"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IAAI;qBACnB,CAAC,CACH,EAAA;;oBARD,SAQC,CAAC;;;;;CACH","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as Sentry from '@sentry/node';\nimport * as path from 'path';\nimport * as fs from 'fs';\nimport {\n abortIfCancelled,\n addSentryCliRc,\n getPackageDotJson,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport { SourceMapUploadToolConfigurationOptions } from './types';\nimport { hasPackageInstalled } from '../../utils/package-json';\n\nexport async function configureSentryCLI(\n options: SourceMapUploadToolConfigurationOptions,\n configureSourcemapGenerationFlow: () => Promise<void> = defaultConfigureSourcemapGenerationFlow,\n): Promise<void> {\n const packageDotJson = await getPackageDotJson();\n\n await installPackage({\n packageName: '@sentry/cli',\n alreadyInstalled: hasPackageInstalled('@sentry/cli', packageDotJson),\n });\n\n let validPath = false;\n let relativeArtifactPath;\n do {\n const rawArtifactPath = await abortIfCancelled(\n clack.text({\n message: 'Where are your build artifacts located?',\n placeholder: `.${path.sep}out`,\n validate(value) {\n if (!value) {\n return 'Please enter a path.';\n }\n },\n }),\n );\n\n if (path.isAbsolute(rawArtifactPath)) {\n relativeArtifactPath = path.relative(process.cwd(), rawArtifactPath);\n } else {\n relativeArtifactPath = rawArtifactPath;\n }\n\n try {\n await fs.promises.access(path.join(process.cwd(), relativeArtifactPath));\n validPath = true;\n } catch {\n validPath = await abortIfCancelled(\n clack.select({\n message: `We couldn't find artifacts at ${relativeArtifactPath}. Are you sure that this is the location that contains your build artifacts?`,\n options: [\n {\n label: 'No, let me verify.',\n value: false,\n },\n { label: 'Yes, I am sure!', value: true },\n ],\n initialValue: false,\n }),\n );\n }\n } while (!validPath);\n\n const relativePosixArtifactPath = relativeArtifactPath\n .split(path.sep)\n .join(path.posix.sep);\n\n await configureSourcemapGenerationFlow();\n\n packageDotJson.scripts = packageDotJson.scripts || {};\n packageDotJson.scripts['sentry:ci'] = `sentry-cli sourcemaps inject --org ${\n options.orgSlug\n } --project ${\n options.projectSlug\n } ${relativePosixArtifactPath} && sentry-cli${\n options.selfHosted ? ` --url ${options.url}` : ''\n } sourcemaps upload --org ${options.orgSlug} --project ${\n options.projectSlug\n } ${relativePosixArtifactPath}`;\n\n await fs.promises.writeFile(\n path.join(process.cwd(), 'package.json'),\n JSON.stringify(packageDotJson, null, 2),\n );\n\n clack.log.info(\n `Added a ${chalk.cyan('sentry:ci')} script to your ${chalk.cyan(\n 'package.json',\n )}. Make sure to run this script ${chalk.bold(\n 'after',\n )} building your application but ${chalk.bold('before')} deploying!`,\n );\n\n const addedToCI = await abortIfCancelled(\n clack.select({\n message: `Did you add a step to your CI pipeline that runs the ${chalk.cyan(\n 'sentry:ci',\n )} script ${chalk.bold('right after')} building your application?`,\n options: [\n { label: 'Yes, continue!', value: true },\n {\n label: \"I'll do it later...\",\n value: false,\n hint: chalk.yellow(\n 'You need to run the command after each build for source maps to work properly.',\n ),\n },\n ],\n initialValue: true,\n }),\n );\n\n Sentry.setTag('added-ci-script', addedToCI);\n\n if (!addedToCI) {\n clack.log.info(\"Don't forget! :)\");\n }\n\n await addSentryCliRc(options.authToken);\n}\n\nasync function defaultConfigureSourcemapGenerationFlow(): Promise<void> {\n await abortIfCancelled(\n clack.select({\n message: `Verify that your build tool is generating source maps. ${chalk.dim(\n '(Your build output folder should contain .js.map files after a build)',\n )}`,\n options: [{ label: 'I checked. Continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n"]}
|
|
@@ -67,6 +67,7 @@ exports.configureVitePlugin = void 0;
|
|
|
67
67
|
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
68
|
var chalk_1 = __importDefault(require("chalk"));
|
|
69
69
|
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var package_json_1 = require("../../utils/package-json");
|
|
70
71
|
var getCodeSnippet = function (options) {
|
|
71
72
|
return chalk_1.default.gray("\nimport { defineConfig } from \"vite\";\n".concat(chalk_1.default.greenBright('import { sentryVitePlugin } from "@sentry/vite-plugin"'), ";\n\nexport default defineConfig({\n build: {\n ").concat(chalk_1.default.greenBright('sourcemap: true, // Source map generation must be turned on'), "\n },\n plugins: [\n // Put the Sentry vite plugin after all other plugins\n ").concat(chalk_1.default.greenBright("sentryVitePlugin({\n authToken: process.env.SENTRY_AUTH_TOKEN,\n org: \"".concat(options.orgSlug, "\",\n project: \"").concat(options.projectSlug, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }),")), "\n ],\n});\n"));
|
|
72
73
|
};
|
|
@@ -80,7 +81,7 @@ var configureVitePlugin = function (options) { return __awaiter(void 0, void 0,
|
|
|
80
81
|
_d = {
|
|
81
82
|
packageName: '@sentry/vite-plugin'
|
|
82
83
|
};
|
|
83
|
-
_b =
|
|
84
|
+
_b = package_json_1.hasPackageInstalled;
|
|
84
85
|
_c = ['@sentry/vite-plugin'];
|
|
85
86
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
87
|
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|