@sentry/wizard 3.3.2 → 3.5.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 +18 -0
- package/bin.ts +29 -19
- package/dist/bin.js +23 -18
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/Wizard.js +0 -9
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +26 -10
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.d.ts → NextJsShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{NextJs.js → NextJsShim.js} +13 -10
- package/dist/lib/Steps/Integrations/NextJsShim.js.map +1 -0
- package/dist/lib/Steps/Integrations/SourceMapsShim.js +4 -1
- package/dist/lib/Steps/Integrations/SourceMapsShim.js.map +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.d.ts → SvelteKitShim.d.ts} +1 -1
- package/dist/lib/Steps/Integrations/{SvelteKit.js → SvelteKitShim.js} +13 -10
- package/dist/lib/Steps/Integrations/SvelteKitShim.js.map +1 -0
- package/dist/package.json +3 -3
- package/dist/src/nextjs/nextjs-wizard.d.ts +2 -5
- package/dist/src/nextjs/nextjs-wizard.js +1 -1
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +2 -5
- package/dist/src/sourcemaps/sourcemaps-wizard.js +68 -31
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/create-react-app.d.ts +1 -0
- package/dist/src/sourcemaps/tools/create-react-app.js +69 -0
- package/dist/src/sourcemaps/tools/create-react-app.js.map +1 -0
- package/dist/src/sourcemaps/tools/esbuild.d.ts +2 -0
- package/dist/src/sourcemaps/tools/esbuild.js +109 -0
- package/dist/src/sourcemaps/tools/esbuild.js.map +1 -0
- package/dist/src/sourcemaps/tools/rollup.d.ts +2 -0
- package/dist/src/sourcemaps/tools/rollup.js +109 -0
- package/dist/src/sourcemaps/tools/rollup.js.map +1 -0
- package/dist/src/sourcemaps/tools/sentry-cli.d.ts +2 -2
- package/dist/src/sourcemaps/tools/sentry-cli.js +111 -91
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/tsc.d.ts +1 -0
- package/dist/src/sourcemaps/tools/tsc.js +93 -0
- package/dist/src/sourcemaps/tools/tsc.js.map +1 -0
- package/dist/src/sourcemaps/utils/sdk-version.d.ts +14 -0
- package/dist/src/sourcemaps/utils/sdk-version.js +275 -0
- package/dist/src/sourcemaps/utils/sdk-version.js.map +1 -0
- package/dist/src/sveltekit/sveltekit-wizard.d.ts +2 -5
- package/dist/src/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +13 -2
- package/dist/src/utils/clack-utils.js +78 -45
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/types.d.ts +12 -0
- package/dist/src/utils/types.js +3 -0
- package/dist/src/utils/types.js.map +1 -0
- package/lib/Helper/Wizard.ts +0 -9
- package/lib/Setup.ts +1 -0
- package/lib/Steps/ChooseIntegration.ts +35 -11
- package/lib/Steps/Integrations/{NextJs.ts → NextJsShim.ts} +5 -2
- package/lib/Steps/Integrations/SourceMapsShim.ts +4 -1
- package/lib/Steps/Integrations/{SvelteKit.ts → SvelteKitShim.ts} +5 -2
- package/package.json +3 -3
- package/src/nextjs/nextjs-wizard.ts +3 -8
- package/src/sourcemaps/sourcemaps-wizard.ts +67 -38
- package/src/sourcemaps/tools/create-react-app.ts +19 -0
- package/src/sourcemaps/tools/esbuild.ts +65 -0
- package/src/sourcemaps/tools/rollup.ts +69 -0
- package/src/sourcemaps/tools/sentry-cli.ts +114 -105
- package/src/sourcemaps/tools/tsc.ts +39 -0
- package/src/sourcemaps/utils/sdk-version.ts +264 -0
- package/src/sveltekit/sveltekit-wizard.ts +3 -6
- package/src/utils/clack-utils.ts +71 -29
- package/src/utils/types.ts +13 -0
- package/dist/lib/Steps/Integrations/NextJs.js.map +0 -1
- package/dist/lib/Steps/Integrations/SvelteKit.js.map +0 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.configureRollupPlugin = void 0;
|
|
66
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
67
|
+
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
|
+
var chalk_1 = __importDefault(require("chalk"));
|
|
69
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
var getCodeSnippet = function (options) {
|
|
71
|
+
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
|
+
var configureRollupPlugin = function (options) { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
+
var _a, _b, _c;
|
|
75
|
+
var _d;
|
|
76
|
+
return __generator(this, function (_e) {
|
|
77
|
+
switch (_e.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
_a = clack_utils_1.installPackage;
|
|
80
|
+
_d = {
|
|
81
|
+
packageName: '@sentry/rollup-plugin'
|
|
82
|
+
};
|
|
83
|
+
_b = clack_utils_1.hasPackageInstalled;
|
|
84
|
+
_c = ['@sentry/rollup-plugin'];
|
|
85
|
+
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
86
|
+
case 1: return [4 /*yield*/, _a.apply(void 0, [(_d.alreadyInstalled = _b.apply(void 0, _c.concat([_e.sent()])),
|
|
87
|
+
_d)])];
|
|
88
|
+
case 2:
|
|
89
|
+
_e.sent();
|
|
90
|
+
prompts_1.default.log.step("Add the following code to your rollup config:");
|
|
91
|
+
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
92
|
+
// eslint-disable-next-line no-console
|
|
93
|
+
console.log(getCodeSnippet(options));
|
|
94
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)((0, prompts_1.select)({
|
|
95
|
+
message: 'Did you copy the snippet above?',
|
|
96
|
+
options: [{ label: 'Yes, continue!', value: true }],
|
|
97
|
+
initialValue: true,
|
|
98
|
+
}))];
|
|
99
|
+
case 3:
|
|
100
|
+
_e.sent();
|
|
101
|
+
return [4 /*yield*/, (0, clack_utils_1.addDotEnvSentryBuildPluginFile)(options.authToken)];
|
|
102
|
+
case 4:
|
|
103
|
+
_e.sent();
|
|
104
|
+
return [2 /*return*/];
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}); };
|
|
108
|
+
exports.configureRollupPlugin = configureRollupPlugin;
|
|
109
|
+
//# sourceMappingURL=rollup.js.map
|
|
@@ -0,0 +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,uDAMiC;AAOjC,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,iCAAmB,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,CACZ,+CAA+C,CAChD,CAAC;gBAEF,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;AA3BS,QAAA,qBAAqB,yBA2B9B","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 hasPackageInstalled,\n installPackage,\n} from '../../utils/clack-utils';\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(\n `Add the following code to your rollup config:`,\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(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"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare
|
|
1
|
+
import { SourceMapUploadToolConfigurationOptions } from './types';
|
|
2
|
+
export declare function configureSentryCLI(options: SourceMapUploadToolConfigurationOptions, configureSourcemapGenerationFlow?: () => Promise<void>): Promise<void>;
|
|
@@ -70,101 +70,121 @@ 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
|
-
|
|
74
|
-
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
relativeArtifactPath = rawArtifactPath;
|
|
99
|
-
}
|
|
100
|
-
_b.label = 5;
|
|
101
|
-
case 5:
|
|
102
|
-
_b.trys.push([5, 7, , 9]);
|
|
103
|
-
return [4 /*yield*/, fs.promises.access(path.join(process.cwd(), relativeArtifactPath))];
|
|
104
|
-
case 6:
|
|
105
|
-
_b.sent();
|
|
106
|
-
validPath = true;
|
|
107
|
-
return [3 /*break*/, 9];
|
|
108
|
-
case 7:
|
|
109
|
-
_a = _b.sent();
|
|
110
|
-
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
111
|
-
message: "We couldn't find artifacts at ".concat(relativeArtifactPath, ". Are you sure that this is the location that contains your build artifacts?"),
|
|
112
|
-
options: [
|
|
113
|
-
{
|
|
114
|
-
label: 'No, let me verify.',
|
|
115
|
-
value: false,
|
|
116
|
-
},
|
|
117
|
-
{ label: 'Yes, I am sure!', value: true },
|
|
118
|
-
],
|
|
119
|
-
initialValue: false,
|
|
73
|
+
function configureSentryCLI(options, configureSourcemapGenerationFlow) {
|
|
74
|
+
if (configureSourcemapGenerationFlow === void 0) { configureSourcemapGenerationFlow = defaultConfigureSourcemapGenerationFlow; }
|
|
75
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
76
|
+
var packageDotJson, validPath, relativeArtifactPath, rawArtifactPath, _a, relativePosixArtifactPath, addedToCI;
|
|
77
|
+
return __generator(this, function (_b) {
|
|
78
|
+
switch (_b.label) {
|
|
79
|
+
case 0: return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
80
|
+
case 1:
|
|
81
|
+
packageDotJson = _b.sent();
|
|
82
|
+
return [4 /*yield*/, (0, clack_utils_1.installPackage)({
|
|
83
|
+
packageName: '@sentry/cli',
|
|
84
|
+
alreadyInstalled: (0, clack_utils_1.hasPackageInstalled)('@sentry/cli', packageDotJson),
|
|
85
|
+
})];
|
|
86
|
+
case 2:
|
|
87
|
+
_b.sent();
|
|
88
|
+
validPath = false;
|
|
89
|
+
_b.label = 3;
|
|
90
|
+
case 3: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.text({
|
|
91
|
+
message: 'Where are your build artifacts located?',
|
|
92
|
+
placeholder: ".".concat(path.sep, "out"),
|
|
93
|
+
validate: function (value) {
|
|
94
|
+
if (!value) {
|
|
95
|
+
return 'Please enter a path.';
|
|
96
|
+
}
|
|
97
|
+
},
|
|
120
98
|
}))];
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
.
|
|
130
|
-
|
|
131
|
-
|
|
99
|
+
case 4:
|
|
100
|
+
rawArtifactPath = _b.sent();
|
|
101
|
+
if (path.isAbsolute(rawArtifactPath)) {
|
|
102
|
+
relativeArtifactPath = path.relative(process.cwd(), rawArtifactPath);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
relativeArtifactPath = rawArtifactPath;
|
|
106
|
+
}
|
|
107
|
+
_b.label = 5;
|
|
108
|
+
case 5:
|
|
109
|
+
_b.trys.push([5, 7, , 9]);
|
|
110
|
+
return [4 /*yield*/, fs.promises.access(path.join(process.cwd(), relativeArtifactPath))];
|
|
111
|
+
case 6:
|
|
112
|
+
_b.sent();
|
|
113
|
+
validPath = true;
|
|
114
|
+
return [3 /*break*/, 9];
|
|
115
|
+
case 7:
|
|
116
|
+
_a = _b.sent();
|
|
117
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
118
|
+
message: "We couldn't find artifacts at ".concat(relativeArtifactPath, ". Are you sure that this is the location that contains your build artifacts?"),
|
|
119
|
+
options: [
|
|
120
|
+
{
|
|
121
|
+
label: 'No, let me verify.',
|
|
122
|
+
value: false,
|
|
123
|
+
},
|
|
124
|
+
{ label: 'Yes, I am sure!', value: true },
|
|
125
|
+
],
|
|
126
|
+
initialValue: false,
|
|
127
|
+
}))];
|
|
128
|
+
case 8:
|
|
129
|
+
validPath = _b.sent();
|
|
130
|
+
return [3 /*break*/, 9];
|
|
131
|
+
case 9:
|
|
132
|
+
if (!validPath) return [3 /*break*/, 3];
|
|
133
|
+
_b.label = 10;
|
|
134
|
+
case 10:
|
|
135
|
+
relativePosixArtifactPath = relativeArtifactPath
|
|
136
|
+
.split(path.sep)
|
|
137
|
+
.join(path.posix.sep);
|
|
138
|
+
return [4 /*yield*/, configureSourcemapGenerationFlow()];
|
|
139
|
+
case 11:
|
|
140
|
+
_b.sent();
|
|
141
|
+
packageDotJson.scripts = packageDotJson.scripts || {};
|
|
142
|
+
packageDotJson.scripts['sentry:ci'] = "sentry-cli sourcemaps inject --org ".concat(options.orgSlug, " --project ").concat(options.projectSlug, " ").concat(relativePosixArtifactPath, " && sentry-cli").concat(options.selfHosted ? " --url ".concat(options.url) : '', " sourcemaps upload --org ").concat(options.orgSlug, " --project ").concat(options.projectSlug, " ").concat(relativePosixArtifactPath);
|
|
143
|
+
return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), 'package.json'), JSON.stringify(packageDotJson, null, 2))];
|
|
144
|
+
case 12:
|
|
145
|
+
_b.sent();
|
|
146
|
+
prompts_1.default.log.info("Added a ".concat(chalk_1.default.cyan('sentry:ci'), " script to your ").concat(chalk_1.default.cyan('package.json'), ". Make sure to run this script ").concat(chalk_1.default.bold('after'), " building your application but ").concat(chalk_1.default.bold('before'), " deploying!"));
|
|
147
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
148
|
+
message: "Did you add a step to your CI pipeline that runs the ".concat(chalk_1.default.cyan('sentry:ci'), " script ").concat(chalk_1.default.bold('right after'), " building your application?"),
|
|
149
|
+
options: [
|
|
150
|
+
{ label: 'Yes, continue!', value: true },
|
|
151
|
+
{
|
|
152
|
+
label: "I'll do it later...",
|
|
153
|
+
value: false,
|
|
154
|
+
hint: chalk_1.default.yellow('You need to run the command after each build for source maps to work properly.'),
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
initialValue: true,
|
|
158
|
+
}))];
|
|
159
|
+
case 13:
|
|
160
|
+
addedToCI = _b.sent();
|
|
161
|
+
Sentry.setTag('added-ci-script', addedToCI);
|
|
162
|
+
if (!addedToCI) {
|
|
163
|
+
prompts_1.default.log.info("Don't forget! :)");
|
|
164
|
+
}
|
|
165
|
+
return [4 /*yield*/, (0, clack_utils_1.addSentryCliRc)(options.authToken)];
|
|
166
|
+
case 14:
|
|
167
|
+
_b.sent();
|
|
168
|
+
return [2 /*return*/];
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
exports.configureSentryCLI = configureSentryCLI;
|
|
174
|
+
function defaultConfigureSourcemapGenerationFlow() {
|
|
175
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
176
|
+
return __generator(this, function (_a) {
|
|
177
|
+
switch (_a.label) {
|
|
178
|
+
case 0: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
132
179
|
message: "Verify that your build tool is generating source maps. ".concat(chalk_1.default.dim('(Your build output folder should contain .js.map files after a build)')),
|
|
133
180
|
options: [{ label: 'I checked. Continue!', value: true }],
|
|
134
181
|
initialValue: true,
|
|
135
182
|
}))];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
case 12:
|
|
142
|
-
_b.sent();
|
|
143
|
-
prompts_1.default.log.info("Added a ".concat(chalk_1.default.cyan('sentry:ci'), " script to your ").concat(chalk_1.default.cyan('package.json'), ". Make sure to run this script ").concat(chalk_1.default.bold('after'), " building your application but ").concat(chalk_1.default.bold('before'), " deploying!"));
|
|
144
|
-
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.select({
|
|
145
|
-
message: "Did you add running the ".concat(chalk_1.default.cyan('sentry:ci'), " script to your CI pipeline ").concat(chalk_1.default.bold('after the build step'), "?"),
|
|
146
|
-
options: [
|
|
147
|
-
{ label: 'Yes, continue!', value: true },
|
|
148
|
-
{
|
|
149
|
-
label: "I'll do it later...",
|
|
150
|
-
value: false,
|
|
151
|
-
hint: chalk_1.default.yellow('You need to run the command after each build for source maps to work properly.'),
|
|
152
|
-
},
|
|
153
|
-
],
|
|
154
|
-
initialValue: true,
|
|
155
|
-
}))];
|
|
156
|
-
case 13:
|
|
157
|
-
addedToCI = _b.sent();
|
|
158
|
-
Sentry.setTag('added-ci-script', addedToCI);
|
|
159
|
-
if (!addedToCI) {
|
|
160
|
-
prompts_1.default.log.info("Don't forget! :)");
|
|
161
|
-
}
|
|
162
|
-
return [4 /*yield*/, (0, clack_utils_1.addSentryCliRc)(options.authToken)];
|
|
163
|
-
case 14:
|
|
164
|
-
_b.sent();
|
|
165
|
-
return [2 /*return*/];
|
|
166
|
-
}
|
|
183
|
+
case 1:
|
|
184
|
+
_a.sent();
|
|
185
|
+
return [2 /*return*/];
|
|
186
|
+
}
|
|
187
|
+
});
|
|
167
188
|
});
|
|
168
|
-
}
|
|
169
|
-
exports.configureSentryCLI = configureSentryCLI;
|
|
189
|
+
}
|
|
170
190
|
//# sourceMappingURL=sentry-cli.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry-cli.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/sentry-cli.ts"],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AK,CAAC,MAAM,CAAC;wBACX,OAAO,EAAE,iEAA0D,eAAK,CAAC,GAAG,CAC1E,uEAAuE,CACxE,CAAE;wBACH,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;wBACzD,YAAY,EAAE,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 hasPackageInstalled,\n installPackage,\n} from '../../utils/clack-utils';\n\nimport { SourceMapUploadToolConfigurationOptions } from './types';\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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function configureTscSourcemapGenerationFlow(): Promise<void>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
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;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
+
exports.configureTscSourcemapGenerationFlow = void 0;
|
|
66
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
67
|
+
var prompts_1 = __importStar(require("@clack/prompts"));
|
|
68
|
+
var chalk_1 = __importDefault(require("chalk"));
|
|
69
|
+
var clack_utils_1 = require("../../utils/clack-utils");
|
|
70
|
+
function configureTscSourcemapGenerationFlow() {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0:
|
|
75
|
+
prompts_1.default.log.step("Add the following code to your ".concat(chalk_1.default.bold('tsconfig.json'), " file: ").concat(chalk_1.default.dim('(This ensures that source maps are generated correctly)')));
|
|
76
|
+
// Intentially logging directly to console here so that the code can be copied/pasted directly
|
|
77
|
+
// eslint-disable-next-line no-console
|
|
78
|
+
console.log(codeSnippet);
|
|
79
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)((0, prompts_1.select)({
|
|
80
|
+
message: 'Did you update your config as shown in the snippet above?',
|
|
81
|
+
options: [{ label: 'Yes, continue!', value: true }],
|
|
82
|
+
initialValue: true,
|
|
83
|
+
}))];
|
|
84
|
+
case 1:
|
|
85
|
+
_a.sent();
|
|
86
|
+
return [2 /*return*/];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.configureTscSourcemapGenerationFlow = configureTscSourcemapGenerationFlow;
|
|
92
|
+
var codeSnippet = chalk_1.default.gray("\n{\n \"compilerOptions\": {\n ".concat(chalk_1.default.greenBright('"sourceMap": true,'), "\n ").concat(chalk_1.default.greenBright('"inlineSources": true,'), "\n\n // Set `sourceRoot` to \"/\" to strip the build path prefix from\n // generated source code references. This will improve issue grouping in Sentry.\n ").concat(chalk_1.default.greenBright('"sourceRoot": "/"'), "\n }\n}\n"));
|
|
93
|
+
//# sourceMappingURL=tsc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tsc.js","sourceRoot":"","sources":["../../../../src/sourcemaps/tools/tsc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,wDAA+C;AAC/C,gDAA0B;AAC1B,uDAA2D;AAE3D,SAAsB,mCAAmC;;;;;oBACvD,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,yCAAkC,eAAK,CAAC,IAAI,CAC1C,eAAe,CAChB,oBAAU,eAAK,CAAC,GAAG,CAClB,yDAAyD,CAC1D,CAAE,CACJ,CAAC;oBAEF,8FAA8F;oBAC9F,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;oBAEzB,qBAAM,IAAA,8BAAgB,EACpB,IAAA,gBAAM,EAAC;4BACL,OAAO,EAAE,2DAA2D;4BACpE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;4BACnD,YAAY,EAAE,IAAI;yBACnB,CAAC,CACH,EAAA;;oBAND,SAMC,CAAC;;;;;CACH;AApBD,kFAoBC;AAED,IAAM,WAAW,GAAG,eAAK,CAAC,IAAI,CAAC,6CAGzB,eAAK,CAAC,WAAW,CAAC,oBAAoB,CAAC,mBACvC,eAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC,kLAI3C,eAAK,CAAC,WAAW,CAAC,mBAAmB,CAAC,eAG3C,CAAC,CAAC","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 { abortIfCancelled } from '../../utils/clack-utils';\n\nexport async function configureTscSourcemapGenerationFlow(): Promise<void> {\n clack.log.step(\n `Add the following code to your ${chalk.bold(\n 'tsconfig.json',\n )} file: ${chalk.dim(\n '(This ensures that source maps are generated correctly)',\n )}`,\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(codeSnippet);\n\n await abortIfCancelled(\n select({\n message: 'Did you update your config as shown in the snippet above?',\n options: [{ label: 'Yes, continue!', value: true }],\n initialValue: true,\n }),\n );\n}\n\nconst codeSnippet = chalk.gray(`\n{\n \"compilerOptions\": {\n ${chalk.greenBright('\"sourceMap\": true,')}\n ${chalk.greenBright('\"inlineSources\": true,')}\n\n // Set \\`sourceRoot\\` to \"/\" to strip the build path prefix from\n // generated source code references. This will improve issue grouping in Sentry.\n ${chalk.greenBright('\"sourceRoot\": \"/\"')}\n }\n}\n`);\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check for a minimum SDK version and prompt the user to upgrade if necessary.
|
|
3
|
+
* We distinguish between 4 cases here:
|
|
4
|
+
*
|
|
5
|
+
* 1. Users didn't install any SDK yet
|
|
6
|
+
* -> We tell them to install an SDK and then continue with the wizard
|
|
7
|
+
* 2. Users installed an SDK in the range >=7.47.0
|
|
8
|
+
* -> All good, no need to do anything!
|
|
9
|
+
* 3. Users installed an SDK in the range >=7.0.0 <= 7.46.0
|
|
10
|
+
* -> We ask if they want to auto-update to the latest version
|
|
11
|
+
* 4. Users installed an SDK in the range <7.x
|
|
12
|
+
* -> We tell users to manually upgrade (migrate between majors)
|
|
13
|
+
*/
|
|
14
|
+
export declare function ensureMinimumSdkVersionIsInstalled(): Promise<void>;
|