@sentry/wizard 3.8.0 → 3.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/bin.ts +14 -0
- package/dist/bin.js +9 -0
- package/dist/bin.js.map +1 -1
- package/dist/lib/Helper/Logging.d.ts +1 -0
- package/dist/lib/Helper/Logging.js +2 -1
- package/dist/lib/Helper/Logging.js.map +1 -1
- package/dist/lib/Setup.js +4 -0
- package/dist/lib/Setup.js.map +1 -1
- package/dist/lib/Steps/Integrations/ReactNative.js +3 -3
- package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
- package/dist/package.json +11 -7
- package/dist/src/apple/xcode-manager.js +6 -2
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js +1 -1
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/tools/vite.js +208 -22
- package/dist/src/sourcemaps/tools/vite.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.d.ts +9 -1
- package/dist/src/sveltekit/sdk-setup.js +73 -29
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +9 -5
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/ast-utils.d.ts +8 -0
- package/dist/src/utils/ast-utils.js +45 -0
- package/dist/src/utils/ast-utils.js.map +1 -0
- package/dist/src/utils/debug.d.ts +2 -0
- package/dist/src/utils/debug.js +51 -0
- package/dist/src/utils/debug.js.map +1 -0
- package/dist/src/utils/string.d.ts +1 -0
- package/dist/src/utils/string.js +10 -0
- package/dist/src/utils/string.js.map +1 -0
- package/dist/test/utils/ast-utils.test.d.ts +1 -0
- package/dist/test/utils/ast-utils.test.js +21 -0
- package/dist/test/utils/ast-utils.test.js.map +1 -0
- package/lib/Helper/Logging.ts +1 -1
- package/lib/Setup.ts +5 -0
- package/lib/Steps/Integrations/ReactNative.ts +7 -3
- package/package.json +11 -7
- package/src/apple/xcode-manager.ts +7 -2
- package/src/sourcemaps/tools/sentry-cli.ts +1 -1
- package/src/sourcemaps/tools/vite.ts +220 -28
- package/src/sveltekit/sdk-setup.ts +122 -43
- package/src/sveltekit/sveltekit-wizard.ts +12 -6
- package/src/utils/ast-utils.ts +20 -0
- package/src/utils/debug.ts +20 -0
- package/src/utils/string.ts +7 -0
- package/test/utils/ast-utils.test.ts +44 -0
- package/dist/src/sveltekit/sentry-cli-setup.d.ts +0 -2
- package/dist/src/sveltekit/sentry-cli-setup.js +0 -71
- package/dist/src/sveltekit/sentry-cli-setup.js.map +0 -1
- package/package-lock.json +0 -8910
- package/src/sveltekit/sentry-cli-setup.ts +0 -27
|
@@ -47,10 +47,9 @@ var clack_utils_1 = require("../utils/clack-utils");
|
|
|
47
47
|
var package_json_1 = require("../utils/package-json");
|
|
48
48
|
var sdk_example_1 = require("./sdk-example");
|
|
49
49
|
var sdk_setup_1 = require("./sdk-setup");
|
|
50
|
-
var sentry_cli_setup_1 = require("./sentry-cli-setup");
|
|
51
50
|
function runSvelteKitWizard(options) {
|
|
52
51
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var packageJson, _a, sentryUrl, selfHosted, _b, projects, apiKeys, selectedProject,
|
|
52
|
+
var packageJson, _a, sentryUrl, selfHosted, _b, projects, apiKeys, selectedProject, svelteConfig, e_1, e_2;
|
|
54
53
|
return __generator(this, function (_c) {
|
|
55
54
|
switch (_c.label) {
|
|
56
55
|
case 0:
|
|
@@ -86,17 +85,22 @@ function runSvelteKitWizard(options) {
|
|
|
86
85
|
})];
|
|
87
86
|
case 7:
|
|
88
87
|
_c.sent();
|
|
89
|
-
return [4 /*yield*/, (0,
|
|
88
|
+
return [4 /*yield*/, (0, clack_utils_1.addSentryCliRc)(apiKeys.token)];
|
|
90
89
|
case 8:
|
|
91
90
|
_c.sent();
|
|
92
|
-
dsn = selectedProject.keys[0].dsn.public;
|
|
93
91
|
return [4 /*yield*/, (0, sdk_setup_1.loadSvelteConfig)()];
|
|
94
92
|
case 9:
|
|
95
93
|
svelteConfig = _c.sent();
|
|
96
94
|
_c.label = 10;
|
|
97
95
|
case 10:
|
|
98
96
|
_c.trys.push([10, 12, , 14]);
|
|
99
|
-
return [4 /*yield*/, (0, sdk_setup_1.createOrMergeSvelteKitFiles)(
|
|
97
|
+
return [4 /*yield*/, (0, sdk_setup_1.createOrMergeSvelteKitFiles)({
|
|
98
|
+
dsn: selectedProject.keys[0].dsn.public,
|
|
99
|
+
org: selectedProject.organization.slug,
|
|
100
|
+
project: selectedProject.slug,
|
|
101
|
+
selfHosted: selfHosted,
|
|
102
|
+
url: sentryUrl,
|
|
103
|
+
}, svelteConfig)];
|
|
100
104
|
case 11:
|
|
101
105
|
_c.sent();
|
|
102
106
|
return [3 /*break*/, 14];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAE1B,
|
|
1
|
+
{"version":3,"file":"sveltekit-wizard.js","sourceRoot":"","sources":["../../../src/sveltekit/sveltekit-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,2DAAmC;AACnC,gDAA0B;AAE1B,oDAW8B;AAC9B,sDAA4D;AAE5D,6CAAkD;AAClD,yCAA4E;AAE5E,SAAsB,kBAAkB,CACtC,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,yBAAyB;wBACrC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,gDAAkC,GAAE,EAAA;;oBAA1C,SAA0C,CAAC;oB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,sIAIE,CAAC,CAAC;;;;;CACJ;AA1FD,gDA0FC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n abort,\n addSentryCliRc,\n askForProjectSelection,\n askForSelfHosted,\n askForWizardLogin,\n confirmContinueEvenThoughNoGitRepo,\n ensurePackageIsInstalled,\n getPackageDotJson,\n installPackage,\n printWelcome,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport { createExamplePage } from './sdk-example';\nimport { createOrMergeSvelteKitFiles, loadSvelteConfig } from './sdk-setup';\n\nexport async function runSvelteKitWizard(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry SvelteKit Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueEvenThoughNoGitRepo();\n\n const packageJson = await getPackageDotJson();\n await ensurePackageIsInstalled(packageJson, '@sveltejs/kit', 'Sveltekit');\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 platform: 'javascript-sveltekit',\n });\n\n const selectedProject = await askForProjectSelection(projects);\n\n await installPackage({\n packageName: '@sentry/sveltekit',\n alreadyInstalled: hasPackageInstalled('@sentry/sveltekit', packageJson),\n });\n\n await addSentryCliRc(apiKeys.token);\n\n const svelteConfig = await loadSvelteConfig();\n\n try {\n await createOrMergeSvelteKitFiles(\n {\n dsn: selectedProject.keys[0].dsn.public,\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n selfHosted,\n url: sentryUrl,\n },\n svelteConfig,\n );\n } catch (e: unknown) {\n clack.log.error('Error while setting up the SvelteKit SDK:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n await abort('Exiting Wizard');\n return;\n }\n\n try {\n await createExamplePage(svelteConfig, {\n selfHosted,\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n });\n } catch (e: unknown) {\n clack.log.error('Error while creating an example page to test Sentry:');\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n await abort('Exiting Wizard');\n return;\n }\n\n clack.outro(`\n${chalk.green('Successfully installed the Sentry SvelteKit SDK!')}\n\n${chalk.cyan(\n 'You can validate your setup by starting your dev environment (`npm run dev`) and visiting \"/sentry-example\".',\n)}\n\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/sveltekit/\n `);\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProxifiedModule } from 'magicast';
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a JS/TS file where we don't know its concrete file type yet exists
|
|
4
|
+
* and returns the full path to the file with the correct file type.
|
|
5
|
+
*/
|
|
6
|
+
export declare function findScriptFile(hooksFile: string): string | undefined;
|
|
7
|
+
/** Checks if a Sentry package is already mentioned in the file */
|
|
8
|
+
export declare function hasSentryContent(mod: ProxifiedModule<object>): boolean;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.hasSentryContent = exports.findScriptFile = void 0;
|
|
27
|
+
var fs = __importStar(require("fs"));
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a JS/TS file where we don't know its concrete file type yet exists
|
|
30
|
+
* and returns the full path to the file with the correct file type.
|
|
31
|
+
*/
|
|
32
|
+
function findScriptFile(hooksFile) {
|
|
33
|
+
var possibleFileTypes = ['.js', '.ts', '.mjs'];
|
|
34
|
+
return possibleFileTypes
|
|
35
|
+
.map(function (type) { return "".concat(hooksFile).concat(type); })
|
|
36
|
+
.find(function (file) { return fs.existsSync(file); });
|
|
37
|
+
}
|
|
38
|
+
exports.findScriptFile = findScriptFile;
|
|
39
|
+
/** Checks if a Sentry package is already mentioned in the file */
|
|
40
|
+
function hasSentryContent(mod) {
|
|
41
|
+
var imports = mod.imports.$items.map(function (i) { return i.from; });
|
|
42
|
+
return !!imports.find(function (i) { return i.startsWith('@sentry/'); });
|
|
43
|
+
}
|
|
44
|
+
exports.hasSentryContent = hasSentryContent;
|
|
45
|
+
//# sourceMappingURL=ast-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-utils.js","sourceRoot":"","sources":["../../../src/utils/ast-utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AAIzB;;;GAGG;AACH,SAAgB,cAAc,CAAC,SAAiB;IAC9C,IAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACjD,OAAO,iBAAiB;SACrB,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,UAAG,SAAS,SAAG,IAAI,CAAE,EAArB,CAAqB,CAAC;SACpC,IAAI,CAAC,UAAC,IAAI,IAAK,OAAA,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAnB,CAAmB,CAAC,CAAC;AACzC,CAAC;AALD,wCAKC;AAED,kEAAkE;AAClE,SAAgB,gBAAgB,CAAC,GAA4B;IAC3D,IAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,CAAC;IACtD,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,EAAxB,CAAwB,CAAC,CAAC;AACzD,CAAC;AAHD,4CAGC","sourcesContent":["import * as fs from 'fs';\n// @ts-ignore - magicast is ESM and TS complains about that. It works though\nimport { ProxifiedModule } from 'magicast';\n\n/**\n * Checks if a JS/TS file where we don't know its concrete file type yet exists\n * and returns the full path to the file with the correct file type.\n */\nexport function findScriptFile(hooksFile: string): string | undefined {\n const possibleFileTypes = ['.js', '.ts', '.mjs'];\n return possibleFileTypes\n .map((type) => `${hooksFile}${type}`)\n .find((file) => fs.existsSync(file));\n}\n\n/** Checks if a Sentry package is already mentioned in the file */\nexport function hasSentryContent(mod: ProxifiedModule<object>): boolean {\n const imports = mod.imports.$items.map((i) => i.from);\n return !!imports.find((i) => i.startsWith('@sentry/'));\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.enableDebugLogs = exports.debug = void 0;
|
|
30
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
31
|
+
var clack = __importStar(require("@clack/prompts"));
|
|
32
|
+
var chalk_1 = __importDefault(require("chalk"));
|
|
33
|
+
var Logging_1 = require("../../lib/Helper/Logging");
|
|
34
|
+
var debugEnabled = false;
|
|
35
|
+
function debug() {
|
|
36
|
+
var args = [];
|
|
37
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
38
|
+
args[_i] = arguments[_i];
|
|
39
|
+
}
|
|
40
|
+
if (!debugEnabled) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
var msg = args.map(function (a) { return (0, Logging_1.prepareMessage)(a); }).join(' ');
|
|
44
|
+
clack.log.info(chalk_1.default.dim(msg));
|
|
45
|
+
}
|
|
46
|
+
exports.debug = debug;
|
|
47
|
+
function enableDebugLogs() {
|
|
48
|
+
debugEnabled = true;
|
|
49
|
+
}
|
|
50
|
+
exports.enableDebugLogs = enableDebugLogs;
|
|
51
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../src/utils/debug.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,gDAA0B;AAC1B,oDAA0D;AAE1D,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB,SAAgB,KAAK;IAAC,cAAkB;SAAlB,UAAkB,EAAlB,qBAAkB,EAAlB,IAAkB;QAAlB,yBAAkB;;IACtC,IAAI,CAAC,YAAY,EAAE;QACjB,OAAO;KACR;IAED,IAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,IAAA,wBAAc,EAAC,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEzD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACjC,CAAC;AARD,sBAQC;AAED,SAAgB,eAAe;IAC7B,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAFD,0CAEC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport { prepareMessage } from '../../lib/Helper/Logging';\n\nlet debugEnabled = false;\n\nexport function debug(...args: unknown[]) {\n if (!debugEnabled) {\n return;\n }\n\n const msg = args.map((a) => prepareMessage(a)).join(' ');\n\n clack.log.info(chalk.dim(msg));\n}\n\nexport function enableDebugLogs() {\n debugEnabled = true;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stripAnsii(str: string): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripAnsii = void 0;
|
|
4
|
+
function stripAnsii(str) {
|
|
5
|
+
return str.replace(
|
|
6
|
+
// eslint-disable-next-line no-control-regex
|
|
7
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
8
|
+
}
|
|
9
|
+
exports.stripAnsii = stripAnsii;
|
|
10
|
+
//# sourceMappingURL=string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/utils/string.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,OAAO;IAChB,4CAA4C;IAC5C,6EAA6E,EAC7E,EAAE,CACH,CAAC;AACJ,CAAC;AAND,gCAMC","sourcesContent":["export function stripAnsii(str: string): string {\n return str.replace(\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n '',\n );\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//@ts-ignore
|
|
4
|
+
var magicast_1 = require("magicast");
|
|
5
|
+
var ast_utils_1 = require("../../src/utils/ast-utils");
|
|
6
|
+
describe('AST utils', function () {
|
|
7
|
+
describe('hasSentryContent', function () {
|
|
8
|
+
it("returns true if a '@sentry/' import was found in the parsed module", function () {
|
|
9
|
+
var code = "\n import { sentryVitePlugin } from \"@sentry/vite-plugin\";\n import * as somethingelse from 'gs';\n\n export default {\n plugins: [sentryVitePlugin()]\n }\n ";
|
|
10
|
+
expect((0, ast_utils_1.hasSentryContent)((0, magicast_1.parseModule)(code))).toBe(true);
|
|
11
|
+
});
|
|
12
|
+
it.each([
|
|
13
|
+
"\n import * as somethingelse from 'gs';\n export default {\n plugins: []\n }\n ",
|
|
14
|
+
"import * as somethingelse from 'gs';\n // import { sentryVitePlugin } from \"@sentry/vite-plugin\"\n export default {\n plugins: []\n }\n ",
|
|
15
|
+
"import * as thirdPartyVitePlugin from \"vite-plugin-@sentry\"\n export default {\n plugins: [thirdPartyVitePlugin()]\n }\n ",
|
|
16
|
+
])("reutrns false for modules without a valid '@sentry/' import", function (code) {
|
|
17
|
+
expect((0, ast_utils_1.hasSentryContent)((0, magicast_1.parseModule)(code))).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=ast-utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast-utils.test.js","sourceRoot":"","sources":["../../../test/utils/ast-utils.test.ts"],"names":[],"mappings":";;AAAA,YAAY;AACZ,qCAAuC;AACvC,uDAA6D;AAE7D,QAAQ,CAAC,WAAW,EAAE;IACpB,QAAQ,CAAC,kBAAkB,EAAE;QAC3B,EAAE,CAAC,oEAAoE,EAAE;YACvE,IAAM,IAAI,GAAG,6MAOZ,CAAC;YAEF,MAAM,CAAC,IAAA,4BAAgB,EAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,IAAI,CAAC;YACN,8GAKC;YACD,0KAKC;YACD,mJAIC;SACF,CAAC,CACA,6DAA6D,EAC7D,UAAC,IAAI;YACH,MAAM,CAAC,IAAA,4BAAgB,EAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1D,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["//@ts-ignore\nimport { parseModule } from 'magicast';\nimport { hasSentryContent } from '../../src/utils/ast-utils';\n\ndescribe('AST utils', () => {\n describe('hasSentryContent', () => {\n it(\"returns true if a '@sentry/' import was found in the parsed module\", () => {\n const code = `\n import { sentryVitePlugin } from \"@sentry/vite-plugin\";\n import * as somethingelse from 'gs';\n\n export default {\n plugins: [sentryVitePlugin()]\n }\n `;\n\n expect(hasSentryContent(parseModule(code))).toBe(true);\n });\n it.each([\n `\n import * as somethingelse from 'gs';\n export default {\n plugins: []\n }\n `,\n `import * as somethingelse from 'gs';\n // import { sentryVitePlugin } from \"@sentry/vite-plugin\"\n export default {\n plugins: []\n }\n `,\n `import * as thirdPartyVitePlugin from \"vite-plugin-@sentry\"\n export default {\n plugins: [thirdPartyVitePlugin()]\n }\n `,\n ])(\n \"reutrns false for modules without a valid '@sentry/' import\",\n (code) => {\n expect(hasSentryContent(parseModule(code))).toBe(false);\n },\n );\n });\n});\n"]}
|
package/lib/Helper/Logging.ts
CHANGED
package/lib/Setup.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as _ from 'lodash';
|
|
2
|
+
import { enableDebugLogs } from '../src/utils/debug';
|
|
2
3
|
|
|
3
4
|
import { readEnvironment } from './Helper/Env';
|
|
4
5
|
import { startWizard } from './Helper/Wizard';
|
|
@@ -7,6 +8,10 @@ import * as Step from './Steps';
|
|
|
7
8
|
export async function run(argv: any): Promise<any> {
|
|
8
9
|
const args = { ...argv, ...readEnvironment() };
|
|
9
10
|
|
|
11
|
+
if (argv.debug) {
|
|
12
|
+
enableDebugLogs();
|
|
13
|
+
}
|
|
14
|
+
|
|
10
15
|
if (args.uninstall === undefined) {
|
|
11
16
|
args.uninstall = false;
|
|
12
17
|
}
|
|
@@ -398,7 +398,7 @@ The snippet will create a button that, when tapped, sends a test event to Sentry
|
|
|
398
398
|
// eslint-disable-next-line no-useless-escape
|
|
399
399
|
'\\"../node_modules/@sentry/cli/bin/sentry-cli react-native xcode $REACT_NATIVE_XCODE\\"',
|
|
400
400
|
) +
|
|
401
|
-
'\n/bin/sh ../node_modules/@sentry/react-native/scripts/collect-modules.sh\n';
|
|
401
|
+
'\n/bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/collect-modules.sh"\n';
|
|
402
402
|
script.shellScript = JSON.stringify(code);
|
|
403
403
|
}
|
|
404
404
|
}
|
|
@@ -422,8 +422,12 @@ The snippet will create a button that, when tapped, sends a test event to Sentry
|
|
|
422
422
|
{
|
|
423
423
|
shellPath: '/bin/sh',
|
|
424
424
|
shellScript: `
|
|
425
|
+
WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
|
|
426
|
+
if [ -f "$WITH_ENVIRONMENT" ]; then
|
|
427
|
+
. "$WITH_ENVIRONMENT"
|
|
428
|
+
fi
|
|
425
429
|
export SENTRY_PROPERTIES=sentry.properties
|
|
426
|
-
[
|
|
430
|
+
[ "$SENTRY_INCLUDE_NATIVE_SOURCES" = "true" ] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
|
|
427
431
|
../node_modules/@sentry/cli/bin/sentry-cli debug-files upload "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH"
|
|
428
432
|
`,
|
|
429
433
|
},
|
|
@@ -509,7 +513,7 @@ export SENTRY_PROPERTIES=sentry.properties
|
|
|
509
513
|
// remove sentry properties export
|
|
510
514
|
.replace(/^export SENTRY_PROPERTIES=sentry.properties\r?\n/m, '')
|
|
511
515
|
.replace(
|
|
512
|
-
/^\/bin\/sh
|
|
516
|
+
/^\/bin\/sh .*?..\/node_modules\/@sentry\/react-native\/scripts\/collect-modules.sh"?\r?\n/m,
|
|
513
517
|
'',
|
|
514
518
|
)
|
|
515
519
|
// unwrap react-native-xcode.sh command. In case someone replaced it
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"glob": "^7.1.3",
|
|
33
33
|
"inquirer": "^6.2.0",
|
|
34
34
|
"lodash": "^4.17.15",
|
|
35
|
-
"magicast": "^0.2.
|
|
35
|
+
"magicast": "^0.2.10",
|
|
36
36
|
"opn": "^5.4.0",
|
|
37
37
|
"r2": "^2.0.1",
|
|
38
38
|
"read-env": "^1.3.0",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"**/xmldom": "^0.6.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
|
-
"node": ">=14.
|
|
68
|
+
"node": ">=14.18.0",
|
|
69
69
|
"npm": ">=3.10.7",
|
|
70
70
|
"yarn": ">=1.0.2"
|
|
71
71
|
},
|
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"build": "yarn tsc",
|
|
77
77
|
"postbuild": "chmod +x ./dist/bin.js && cp -r scripts/** dist",
|
|
78
78
|
"lint": "yarn lint:prettier && yarn lint:eslint",
|
|
79
|
-
"lint:prettier": "prettier --check \"{lib,src}/**/*.ts\"",
|
|
79
|
+
"lint:prettier": "prettier --check \"{lib,src,test}/**/*.ts\"",
|
|
80
80
|
"lint:eslint": "eslint . --cache --format stylish",
|
|
81
81
|
"fix": "yarn fix:eslint && yarn fix:prettier",
|
|
82
|
-
"fix:prettier": "prettier --write \"{lib,src}/**/*.ts\"",
|
|
82
|
+
"fix:prettier": "prettier --write \"{lib,src,test}/**/*.ts\"",
|
|
83
83
|
"fix:eslint": "eslint . --format stylish --fix",
|
|
84
84
|
"test": "yarn build && jest",
|
|
85
85
|
"try": "ts-node bin.ts",
|
|
86
86
|
"try:uninstall": "ts-node bin.ts --uninstall",
|
|
87
|
-
"test:watch": "jest --watch
|
|
87
|
+
"test:watch": "jest --watch"
|
|
88
88
|
},
|
|
89
89
|
"jest": {
|
|
90
90
|
"collectCoverage": true,
|
|
@@ -114,5 +114,9 @@
|
|
|
114
114
|
"testEnvironment": "node"
|
|
115
115
|
},
|
|
116
116
|
"author": "Sentry",
|
|
117
|
-
"license": "MIT"
|
|
117
|
+
"license": "MIT",
|
|
118
|
+
"volta": {
|
|
119
|
+
"node": "14.18.3",
|
|
120
|
+
"yarn": "1.22.19"
|
|
121
|
+
}
|
|
118
122
|
}
|
|
@@ -80,7 +80,10 @@ function addSentrySPM(proj: any): void {
|
|
|
80
80
|
comment: 'XCRemoteSwiftPackageReference "sentry-cocoa"',
|
|
81
81
|
});
|
|
82
82
|
|
|
83
|
-
xcObjects.XCRemoteSwiftPackageReference
|
|
83
|
+
if (!xcObjects.XCRemoteSwiftPackageReference) {
|
|
84
|
+
xcObjects.XCRemoteSwiftPackageReference = {};
|
|
85
|
+
}
|
|
86
|
+
|
|
84
87
|
xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {
|
|
85
88
|
isa: 'XCRemoteSwiftPackageReference',
|
|
86
89
|
repositoryURL: '"https://github.com/getsentry/sentry-cocoa/"',
|
|
@@ -92,7 +95,9 @@ function addSentrySPM(proj: any): void {
|
|
|
92
95
|
xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID + '_comment'] =
|
|
93
96
|
'XCRemoteSwiftPackageReference "sentry-cocoa"';
|
|
94
97
|
|
|
95
|
-
xcObjects.XCSwiftPackageProductDependency
|
|
98
|
+
if (!xcObjects.XCSwiftPackageProductDependency) {
|
|
99
|
+
xcObjects.XCSwiftPackageProductDependency = {};
|
|
100
|
+
}
|
|
96
101
|
xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {
|
|
97
102
|
isa: 'XCSwiftPackageProductDependency',
|
|
98
103
|
package: sentrySwiftPackageUUID,
|
|
@@ -174,7 +174,7 @@ async function askShouldAddToBuildCommand(): Promise<boolean> {
|
|
|
174
174
|
{
|
|
175
175
|
label: 'Yes',
|
|
176
176
|
value: true,
|
|
177
|
-
hint: 'This will modify your prod build
|
|
177
|
+
hint: 'This will modify your prod build command',
|
|
178
178
|
},
|
|
179
179
|
{ label: 'No', value: false },
|
|
180
180
|
],
|