@sentry/wizard 3.7.0 → 3.8.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 +15 -0
- package/dist/lib/Helper/Wizard.js +0 -2
- package/dist/lib/Helper/Wizard.js.map +1 -1
- package/dist/lib/Helper/__tests__/MergeConfig.js.map +1 -1
- package/dist/lib/Steps/ChooseIntegration.js +12 -26
- package/dist/lib/Steps/ChooseIntegration.js.map +1 -1
- package/dist/lib/Steps/Integrations/Cordova.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/lib/Steps/Integrations/MobileProject.js.map +1 -1
- package/dist/lib/Steps/Integrations/ReactNative.js +2 -2
- package/dist/lib/Steps/Integrations/ReactNative.js.map +1 -1
- package/dist/lib/Steps/Integrations/__tests__/ReactNative.js +5 -6
- package/dist/lib/Steps/Integrations/__tests__/ReactNative.js.map +1 -1
- package/dist/package.json +3 -3
- package/dist/src/apple/apple-wizard.js +31 -2
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/cocoapod.d.ts +2 -0
- package/dist/src/apple/cocoapod.js +122 -0
- package/dist/src/apple/cocoapod.js.map +1 -0
- package/dist/src/apple/code-tools.js +22 -12
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/fastlane.d.ts +2 -0
- package/dist/src/apple/fastlane.js +179 -0
- package/dist/src/apple/fastlane.js.map +1 -0
- package/dist/src/apple/templates.d.ts +1 -0
- package/dist/src/apple/templates.js +7 -3
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/apple/xcode-manager.d.ts +1 -1
- package/dist/src/apple/xcode-manager.js +35 -28
- package/dist/src/apple/xcode-manager.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +71 -81
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.js +64 -47
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/tools/nextjs.d.ts +3 -0
- package/dist/src/sourcemaps/tools/nextjs.js +135 -0
- package/dist/src/sourcemaps/tools/nextjs.js.map +1 -0
- package/dist/src/sourcemaps/tools/sentry-cli.js +120 -16
- package/dist/src/sourcemaps/tools/sentry-cli.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.d.ts +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +1 -0
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sourcemaps/utils/other-wizards.js +35 -12
- package/dist/src/sourcemaps/utils/other-wizards.js.map +1 -1
- package/dist/src/sveltekit/sentry-cli-setup.d.ts +1 -1
- package/dist/src/sveltekit/sentry-cli-setup.js.map +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.js +14 -8
- package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
- package/dist/src/utils/bash.d.ts +2 -1
- package/dist/src/utils/bash.js +14 -2
- package/dist/src/utils/bash.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +7 -14
- package/dist/src/utils/clack-utils.js +46 -2
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/src/utils/package-json.d.ts +1 -1
- package/dist/src/utils/package-json.js.map +1 -1
- package/dist/src/utils/types.d.ts +24 -0
- package/dist/src/utils/types.js.map +1 -1
- package/lib/Helper/Wizard.ts +0 -3
- package/lib/Helper/__tests__/MergeConfig.ts +9 -4
- package/lib/Steps/ChooseIntegration.ts +13 -3
- package/lib/Steps/Integrations/Cordova.ts +3 -3
- package/lib/Steps/Integrations/Electron.ts +1 -2
- package/lib/Steps/Integrations/MobileProject.ts +1 -1
- package/lib/Steps/Integrations/ReactNative.ts +16 -14
- package/lib/Steps/Integrations/__tests__/ReactNative.ts +24 -15
- package/package-lock.json +2 -2
- package/package.json +3 -3
- package/src/apple/apple-wizard.ts +35 -3
- package/src/apple/cocoapod.ts +57 -0
- package/src/apple/code-tools.ts +80 -57
- package/src/apple/fastlane.ts +160 -0
- package/src/apple/templates.ts +26 -10
- package/src/apple/xcode-manager.ts +137 -120
- package/src/nextjs/nextjs-wizard.ts +4 -13
- package/src/sourcemaps/sourcemaps-wizard.ts +49 -30
- package/src/sourcemaps/tools/nextjs.ts +114 -0
- package/src/sourcemaps/tools/sentry-cli.ts +134 -8
- package/src/sourcemaps/utils/detect-tool.ts +3 -1
- package/src/sourcemaps/utils/other-wizards.ts +32 -13
- package/src/sveltekit/sentry-cli-setup.ts +1 -1
- package/src/sveltekit/sveltekit-wizard.ts +3 -0
- package/src/utils/bash.ts +43 -30
- package/src/utils/clack-utils.ts +42 -14
- package/src/utils/package-json.ts +1 -1
- package/src/utils/types.ts +22 -0
|
@@ -2,3 +2,4 @@ export declare function getRunScriptTemplate(orgSlug: string, projectSlug: strin
|
|
|
2
2
|
export declare const scriptInputPath = "\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"";
|
|
3
3
|
export declare function getSwiftSnippet(dsn: string): string;
|
|
4
4
|
export declare function getObjcSnippet(dsn: string): string;
|
|
5
|
+
export declare function getFastlaneSnippet(org: string, project: string, token: string): string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getObjcSnippet = exports.getSwiftSnippet = exports.scriptInputPath = exports.getRunScriptTemplate = void 0;
|
|
3
|
+
exports.getFastlaneSnippet = exports.getObjcSnippet = exports.getSwiftSnippet = exports.scriptInputPath = exports.getRunScriptTemplate = void 0;
|
|
4
4
|
function getRunScriptTemplate(orgSlug, projectSlug, apiKey, uploadSource) {
|
|
5
5
|
if (uploadSource === void 0) { uploadSource = true; }
|
|
6
6
|
// eslint-disable-next-line no-useless-escape
|
|
7
|
-
return "# This script is responsable to upload debug symbols and source context for Sentry.\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=".concat(orgSlug, "\\nexport SENTRY_PROJECT=").concat(projectSlug, "\\nexport SENTRY_AUTH_TOKEN=").concat(apiKey, "\\nERROR=$(sentry-cli debug-files upload ").concat(uploadSource ?
|
|
7
|
+
return "# This script is responsable to upload debug symbols and source context for Sentry.\\nif which sentry-cli >/dev/null; then\\nexport SENTRY_ORG=".concat(orgSlug, "\\nexport SENTRY_PROJECT=").concat(projectSlug, "\\nexport SENTRY_AUTH_TOKEN=").concat(apiKey, "\\nERROR=$(sentry-cli debug-files upload ").concat(uploadSource ? '--include-sources ' : '', "\"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\\nif [ ! $? -eq 0 ]; then\\necho \"warning: sentry-cli - $ERROR\"\\nfi\\nelse\\necho \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\\nfi\\n");
|
|
8
8
|
}
|
|
9
9
|
exports.getRunScriptTemplate = getRunScriptTemplate;
|
|
10
|
-
exports.scriptInputPath = "
|
|
10
|
+
exports.scriptInputPath = '"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}"';
|
|
11
11
|
function getSwiftSnippet(dsn) {
|
|
12
12
|
return " SentrySDK.start { options in\n options.dsn = \"".concat(dsn, "\"\n options.debug = true // Enabled debug when first installing is always helpful\n options.enableTracing = true \n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\n");
|
|
13
13
|
}
|
|
@@ -16,4 +16,8 @@ function getObjcSnippet(dsn) {
|
|
|
16
16
|
return " [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"".concat(dsn, "\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n options.enableTracing = YES;\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\n");
|
|
17
17
|
}
|
|
18
18
|
exports.getObjcSnippet = getObjcSnippet;
|
|
19
|
+
function getFastlaneSnippet(org, project, token) {
|
|
20
|
+
return " sentry_cli(\n auth_token: '".concat(token, "',\n org_slug: '").concat(org, "',\n project_slug: '").concat(project, "',\n include_sources: true\n )");
|
|
21
|
+
}
|
|
22
|
+
exports.getFastlaneSnippet = getFastlaneSnippet;
|
|
19
23
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/apple/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/apple/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,CAClC,OAAe,EACf,WAAmB,EACnB,MAAc,EACd,YAAmB;IAAnB,6BAAA,EAAA,mBAAmB;IAEnB,6CAA6C;IAC7C,OAAO,yJAAkJ,OAAO,sCAA4B,WAAW,yCAA+B,MAAM,sDAC1O,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,oPACiM,CAAC;AAC9O,CAAC;AAVD,oDAUC;AAEY,QAAA,eAAe,GAC1B,6FAA6F,CAAC;AAEhG,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,4EACoB,GAAG,4kBASiC,CAAC;AAClE,CAAC;AAZD,0CAYC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,0GACiB,GAAG,8iBAS8B,CAAC;AAC5D,CAAC;AAZD,wCAYC;AAED,SAAgB,kBAAkB,CAChC,GAAW,EACX,OAAe,EACf,KAAa;IAEb,OAAO,8CACY,KAAK,kCACP,GAAG,sCACC,OAAO,2CAExB,CAAC;AACP,CAAC;AAXD,gDAWC","sourcesContent":["export function getRunScriptTemplate(\n orgSlug: string,\n projectSlug: string,\n apiKey: string,\n uploadSource = true,\n): string {\n // eslint-disable-next-line no-useless-escape\n return `# This script is responsable to upload debug symbols and source context for Sentry.\\\\nif which sentry-cli >/dev/null; then\\\\nexport SENTRY_ORG=${orgSlug}\\\\nexport SENTRY_PROJECT=${projectSlug}\\\\nexport SENTRY_AUTH_TOKEN=${apiKey}\\\\nERROR=$(sentry-cli debug-files upload ${\n uploadSource ? '--include-sources ' : ''\n }\"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\\\\nif [ ! $? -eq 0 ]; then\\\\necho \"warning: sentry-cli - $ERROR\"\\\\nfi\\\\nelse\\\\necho \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\\\\nfi\\\\n`;\n}\n\nexport const scriptInputPath =\n '\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"';\n\nexport function getSwiftSnippet(dsn: string): string {\n return ` SentrySDK.start { options in\n options.dsn = \"${dsn}\"\n options.debug = true // Enabled debug when first installing is always helpful\n options.enableTracing = true \n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\\n`;\n}\n\nexport function getObjcSnippet(dsn: string): string {\n return ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"${dsn}\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n options.enableTracing = YES;\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\\n`;\n}\n\nexport function getFastlaneSnippet(\n org: string,\n project: string,\n token: string,\n): string {\n return ` sentry_cli(\n auth_token: '${token}',\n org_slug: '${org}',\n project_slug: '${project}',\n include_sources: true\n )`;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SentryProjectData } from '../utils/
|
|
1
|
+
import { SentryProjectData } from '../utils/types';
|
|
2
2
|
export declare function updateXcodeProject(projectPath: string, sentryProject: SentryProjectData, apiKeys: {
|
|
3
3
|
token: string;
|
|
4
4
|
}, addSPMReference: boolean, uploadSource?: boolean): void;
|
|
@@ -24,6 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.updateXcodeProject = void 0;
|
|
27
|
+
/* eslint-disable max-lines */
|
|
28
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
29
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
30
|
+
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
|
31
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
27
32
|
var fs = __importStar(require("fs"));
|
|
28
33
|
var templates = __importStar(require("./templates"));
|
|
29
34
|
var xcode = require('xcode');
|
|
@@ -32,7 +37,7 @@ function setDebugInformationFormat(proj) {
|
|
|
32
37
|
var xcObjects = proj.hash.project.objects;
|
|
33
38
|
var target = proj.getFirstTarget().firstTarget;
|
|
34
39
|
xcObjects.XCConfigurationList[target.buildConfigurationList].buildConfigurations.forEach(function (buildConfig) {
|
|
35
|
-
xcObjects.XCBuildConfiguration[buildConfig.value].buildSettings.DEBUG_INFORMATION_FORMAT = "
|
|
40
|
+
xcObjects.XCBuildConfiguration[buildConfig.value].buildSettings.DEBUG_INFORMATION_FORMAT = '"dwarf-with-dsym"';
|
|
36
41
|
});
|
|
37
42
|
}
|
|
38
43
|
function addSentrySPM(proj) {
|
|
@@ -42,11 +47,11 @@ function addSentrySPM(proj) {
|
|
|
42
47
|
//Check whether xcObjects already have sentry framework
|
|
43
48
|
if (xcObjects.PBXFrameworksBuildPhase) {
|
|
44
49
|
for (var key in xcObjects.PBXFrameworksBuildPhase || {}) {
|
|
45
|
-
if (!key.endsWith(
|
|
50
|
+
if (!key.endsWith('_comment')) {
|
|
46
51
|
var frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;
|
|
47
52
|
for (var _i = 0, frameworks_1 = frameworks; _i < frameworks_1.length; _i++) {
|
|
48
53
|
var framework = frameworks_1[_i];
|
|
49
|
-
if (framework.comment ===
|
|
54
|
+
if (framework.comment === 'Sentry in Frameworks') {
|
|
50
55
|
return;
|
|
51
56
|
}
|
|
52
57
|
}
|
|
@@ -54,17 +59,18 @@ function addSentrySPM(proj) {
|
|
|
54
59
|
}
|
|
55
60
|
}
|
|
56
61
|
xcObjects.PBXBuildFile[sentryFrameworkUUID] = {
|
|
57
|
-
isa:
|
|
62
|
+
isa: 'PBXBuildFile',
|
|
58
63
|
productRef: sentrySPMUUID,
|
|
59
|
-
productRef_comment:
|
|
64
|
+
productRef_comment: 'Sentry',
|
|
60
65
|
};
|
|
61
|
-
xcObjects.PBXBuildFile[sentryFrameworkUUID +
|
|
66
|
+
xcObjects.PBXBuildFile[sentryFrameworkUUID + '_comment'] =
|
|
67
|
+
'Sentry in Frameworks';
|
|
62
68
|
for (var key in xcObjects.PBXFrameworksBuildPhase || {}) {
|
|
63
|
-
if (!key.endsWith(
|
|
69
|
+
if (!key.endsWith('_comment')) {
|
|
64
70
|
var frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;
|
|
65
71
|
frameworks.push({
|
|
66
72
|
value: sentryFrameworkUUID,
|
|
67
|
-
comment:
|
|
73
|
+
comment: 'Sentry in Frameworks',
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
76
|
}
|
|
@@ -74,7 +80,7 @@ function addSentrySPM(proj) {
|
|
|
74
80
|
}
|
|
75
81
|
target.packageProductDependencies.push({
|
|
76
82
|
value: sentrySPMUUID,
|
|
77
|
-
comment:
|
|
83
|
+
comment: 'Sentry',
|
|
78
84
|
});
|
|
79
85
|
var sentrySwiftPackageUUID = proj.generateUuid();
|
|
80
86
|
var xcProject = proj.getFirstProject().firstProject;
|
|
@@ -83,38 +89,39 @@ function addSentrySPM(proj) {
|
|
|
83
89
|
}
|
|
84
90
|
xcProject.packageReferences.push({
|
|
85
91
|
value: sentrySwiftPackageUUID,
|
|
86
|
-
comment:
|
|
92
|
+
comment: 'XCRemoteSwiftPackageReference "sentry-cocoa"',
|
|
87
93
|
});
|
|
88
94
|
xcObjects.XCRemoteSwiftPackageReference = {};
|
|
89
95
|
xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {
|
|
90
|
-
isa:
|
|
91
|
-
repositoryURL: "
|
|
96
|
+
isa: 'XCRemoteSwiftPackageReference',
|
|
97
|
+
repositoryURL: '"https://github.com/getsentry/sentry-cocoa/"',
|
|
92
98
|
requirement: {
|
|
93
|
-
kind:
|
|
94
|
-
minimumVersion:
|
|
95
|
-
}
|
|
99
|
+
kind: 'upToNextMajorVersion',
|
|
100
|
+
minimumVersion: '8.0.0',
|
|
101
|
+
},
|
|
96
102
|
};
|
|
97
|
-
xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID +
|
|
103
|
+
xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID + '_comment'] =
|
|
104
|
+
'XCRemoteSwiftPackageReference "sentry-cocoa"';
|
|
98
105
|
xcObjects.XCSwiftPackageProductDependency = {};
|
|
99
|
-
xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] =
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {
|
|
107
|
+
isa: 'XCSwiftPackageProductDependency',
|
|
108
|
+
package: sentrySwiftPackageUUID,
|
|
109
|
+
package_comment: 'XCRemoteSwiftPackageReference "sentry-cocoa"',
|
|
110
|
+
productName: 'Sentry',
|
|
111
|
+
};
|
|
112
|
+
xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID + '_comment'] =
|
|
113
|
+
'Sentry';
|
|
107
114
|
}
|
|
108
115
|
function addUploadSymbolsScript(xcodeProject, sentryProject, apiKeys, uploadSource) {
|
|
109
116
|
if (uploadSource === void 0) { uploadSource = true; }
|
|
110
117
|
var xcObjects = xcodeProject.hash.project.objects;
|
|
111
118
|
for (var scriptKey in xcObjects.PBXShellScriptBuildPhase || {}) {
|
|
112
|
-
if (!scriptKey.endsWith(
|
|
119
|
+
if (!scriptKey.endsWith('_comment')) {
|
|
113
120
|
var script = xcObjects.PBXShellScriptBuildPhase[scriptKey].shellScript;
|
|
114
121
|
//Sentry script already exists, update it
|
|
115
|
-
if (script.includes(
|
|
122
|
+
if (script.includes('sentry-cli')) {
|
|
116
123
|
delete xcObjects.PBXShellScriptBuildPhase[scriptKey];
|
|
117
|
-
delete xcObjects.PBXShellScriptBuildPhase[scriptKey +
|
|
124
|
+
delete xcObjects.PBXShellScriptBuildPhase[scriptKey + '_comment'];
|
|
118
125
|
break;
|
|
119
126
|
}
|
|
120
127
|
}
|
|
@@ -124,7 +131,7 @@ function addUploadSymbolsScript(xcodeProject, sentryProject, apiKeys, uploadSour
|
|
|
124
131
|
outputFileListPaths: [],
|
|
125
132
|
inputPaths: [templates.scriptInputPath],
|
|
126
133
|
shellPath: '/bin/sh',
|
|
127
|
-
shellScript: templates.getRunScriptTemplate(sentryProject.organization.slug, sentryProject.slug, apiKeys.token, uploadSource)
|
|
134
|
+
shellScript: templates.getRunScriptTemplate(sentryProject.organization.slug, sentryProject.slug, apiKeys.token, uploadSource),
|
|
128
135
|
});
|
|
129
136
|
}
|
|
130
137
|
function updateXcodeProject(projectPath, sentryProject, apiKeys, addSPMReference, uploadSource) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xcode-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"xcode-manager.js","sourceRoot":"","sources":["../../../src/apple/xcode-manager.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nimport * as fs from 'fs';\nimport { SentryProjectData } from '../utils/types';\nimport * as templates from './templates';\nconst xcode = require('xcode');\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nfunction setDebugInformationFormat(proj: any): void {\n const xcObjects = proj.hash.project.objects;\n const target = proj.getFirstTarget().firstTarget;\n\n xcObjects.XCConfigurationList[\n target.buildConfigurationList\n ].buildConfigurations.forEach((buildConfig: { value: string }) => {\n xcObjects.XCBuildConfiguration[\n buildConfig.value\n ].buildSettings.DEBUG_INFORMATION_FORMAT = '\"dwarf-with-dsym\"';\n });\n}\n\nfunction addSentrySPM(proj: any): void {\n const xcObjects = proj.hash.project.objects;\n\n const sentryFrameworkUUID = proj.generateUuid() as string;\n const sentrySPMUUID = proj.generateUuid() as string;\n\n //Check whether xcObjects already have sentry framework\n if (xcObjects.PBXFrameworksBuildPhase) {\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n if (!key.endsWith('_comment')) {\n const frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;\n for (const framework of frameworks) {\n if (framework.comment === 'Sentry in Frameworks') {\n return;\n }\n }\n }\n }\n }\n\n xcObjects.PBXBuildFile[sentryFrameworkUUID] = {\n isa: 'PBXBuildFile',\n productRef: sentrySPMUUID,\n productRef_comment: 'Sentry',\n };\n xcObjects.PBXBuildFile[sentryFrameworkUUID + '_comment'] =\n 'Sentry in Frameworks';\n\n for (const key in xcObjects.PBXFrameworksBuildPhase || {}) {\n if (!key.endsWith('_comment')) {\n const frameworks = xcObjects.PBXFrameworksBuildPhase[key].files;\n frameworks.push({\n value: sentryFrameworkUUID,\n comment: 'Sentry in Frameworks',\n });\n }\n }\n\n const target = proj.getFirstTarget().firstTarget;\n if (!target.packageProductDependencies) {\n target.packageProductDependencies = [];\n }\n target.packageProductDependencies.push({\n value: sentrySPMUUID,\n comment: 'Sentry',\n });\n\n const sentrySwiftPackageUUID = proj.generateUuid() as string;\n const xcProject = proj.getFirstProject().firstProject;\n if (!xcProject.packageReferences) {\n xcProject.packageReferences = [];\n }\n xcProject.packageReferences.push({\n value: sentrySwiftPackageUUID,\n comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n });\n\n xcObjects.XCRemoteSwiftPackageReference = {};\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID] = {\n isa: 'XCRemoteSwiftPackageReference',\n repositoryURL: '\"https://github.com/getsentry/sentry-cocoa/\"',\n requirement: {\n kind: 'upToNextMajorVersion',\n minimumVersion: '8.0.0',\n },\n };\n xcObjects.XCRemoteSwiftPackageReference[sentrySwiftPackageUUID + '_comment'] =\n 'XCRemoteSwiftPackageReference \"sentry-cocoa\"';\n\n xcObjects.XCSwiftPackageProductDependency = {};\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID] = {\n isa: 'XCSwiftPackageProductDependency',\n package: sentrySwiftPackageUUID,\n package_comment: 'XCRemoteSwiftPackageReference \"sentry-cocoa\"',\n productName: 'Sentry',\n };\n xcObjects.XCSwiftPackageProductDependency[sentrySPMUUID + '_comment'] =\n 'Sentry';\n}\n\nfunction addUploadSymbolsScript(\n xcodeProject: any,\n sentryProject: SentryProjectData,\n apiKeys: { token: string },\n uploadSource = true,\n): void {\n const xcObjects = xcodeProject.hash.project.objects;\n\n for (const scriptKey in xcObjects.PBXShellScriptBuildPhase || {}) {\n if (!scriptKey.endsWith('_comment')) {\n const script = xcObjects.PBXShellScriptBuildPhase[scriptKey].shellScript;\n //Sentry script already exists, update it\n if (script.includes('sentry-cli')) {\n delete xcObjects.PBXShellScriptBuildPhase[scriptKey];\n delete xcObjects.PBXShellScriptBuildPhase[scriptKey + '_comment'];\n break;\n }\n }\n }\n\n xcodeProject.addBuildPhase(\n [],\n 'PBXShellScriptBuildPhase',\n 'Upload Debug Symbols to Sentry',\n null,\n {\n inputFileListPaths: [],\n outputFileListPaths: [],\n inputPaths: [templates.scriptInputPath],\n shellPath: '/bin/sh',\n shellScript: templates.getRunScriptTemplate(\n sentryProject.organization.slug,\n sentryProject.slug,\n apiKeys.token,\n uploadSource,\n ),\n },\n );\n}\n\nexport function updateXcodeProject(\n projectPath: string,\n sentryProject: SentryProjectData,\n apiKeys: { token: string },\n addSPMReference: boolean,\n uploadSource = true,\n): void {\n const proj = xcode.project(projectPath);\n proj.parseSync();\n addUploadSymbolsScript(proj, sentryProject, apiKeys, uploadSource);\n if (uploadSource) {\n setDebugInformationFormat(proj);\n }\n if (addSPMReference) {\n addSentrySPM(proj);\n }\n const newContent = proj.writeSync();\n fs.writeFileSync(projectPath, newContent);\n}\n"]}
|
|
@@ -86,9 +86,9 @@ var templates_1 = require("./templates");
|
|
|
86
86
|
function runNextjsWizard(options) {
|
|
87
87
|
var _a;
|
|
88
88
|
return __awaiter(this, void 0, void 0, function () {
|
|
89
|
-
var packageJson, _b,
|
|
90
|
-
return __generator(this, function (
|
|
91
|
-
switch (
|
|
89
|
+
var packageJson, _b, selectedProject, authToken, selfHosted, sentryUrl, typeScriptDetected, configVariants, _i, configVariants_1, configVariant, jsConfig, tsConfig, jsConfigExists, tsConfigExists, shouldWriteFile, existingConfigs, overwriteExistingConfigs, sentryWebpackOptionsTemplate, sentryBuildOptionsTemplate, nextConfigJs, nextConfigMjs, nextConfigJsExists, nextConfigMjsExists, nextConfgiJsContent, probablyIncludesSdk, shouldInject, injectAnyhow, nextConfgiMjsContent, probablyIncludesSdk, shouldInject, injectAnyhow, mod, expressionToWrap, newCode, _c, shouldContinue, maybePagesDirPath, maybeSrcPagesDirPath, pagesLocation, examplePageContents, mightBeUsingVercel;
|
|
90
|
+
return __generator(this, function (_d) {
|
|
91
|
+
switch (_d.label) {
|
|
92
92
|
case 0:
|
|
93
93
|
(0, clack_utils_1.printWelcome)({
|
|
94
94
|
wizardName: 'Sentry Next.js Wizard',
|
|
@@ -96,45 +96,35 @@ function runNextjsWizard(options) {
|
|
|
96
96
|
});
|
|
97
97
|
return [4 /*yield*/, (0, clack_utils_1.confirmContinueEvenThoughNoGitRepo)()];
|
|
98
98
|
case 1:
|
|
99
|
-
|
|
99
|
+
_d.sent();
|
|
100
100
|
return [4 /*yield*/, (0, clack_utils_1.getPackageDotJson)()];
|
|
101
101
|
case 2:
|
|
102
|
-
packageJson =
|
|
102
|
+
packageJson = _d.sent();
|
|
103
103
|
return [4 /*yield*/, (0, clack_utils_1.ensurePackageIsInstalled)(packageJson, 'next', 'Next.js')];
|
|
104
104
|
case 3:
|
|
105
|
-
|
|
106
|
-
return [4 /*yield*/, (0, clack_utils_1.
|
|
105
|
+
_d.sent();
|
|
106
|
+
return [4 /*yield*/, (0, clack_utils_1.getOrAskForProjectData)(options)];
|
|
107
107
|
case 4:
|
|
108
|
-
_b =
|
|
109
|
-
return [4 /*yield*/, (0, clack_utils_1.askForWizardLogin)({
|
|
110
|
-
promoCode: options.promoCode,
|
|
111
|
-
url: sentryUrl,
|
|
112
|
-
platform: 'javascript-nextjs',
|
|
113
|
-
})];
|
|
114
|
-
case 5:
|
|
115
|
-
_c = _e.sent(), projects = _c.projects, apiKeys = _c.apiKeys;
|
|
116
|
-
return [4 /*yield*/, (0, clack_utils_1.askForProjectSelection)(projects)];
|
|
117
|
-
case 6:
|
|
118
|
-
selectedProject = _e.sent();
|
|
108
|
+
_b = _d.sent(), selectedProject = _b.selectedProject, authToken = _b.authToken, selfHosted = _b.selfHosted, sentryUrl = _b.sentryUrl;
|
|
119
109
|
return [4 /*yield*/, (0, clack_utils_1.installPackage)({
|
|
120
110
|
packageName: '@sentry/nextjs',
|
|
121
111
|
alreadyInstalled: !!((_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.dependencies) === null || _a === void 0 ? void 0 : _a['@sentry/nextjs']),
|
|
122
112
|
})];
|
|
123
|
-
case
|
|
124
|
-
|
|
113
|
+
case 5:
|
|
114
|
+
_d.sent();
|
|
125
115
|
typeScriptDetected = (0, clack_utils_1.isUsingTypeScript)();
|
|
126
116
|
configVariants = ['server', 'client', 'edge'];
|
|
127
117
|
_i = 0, configVariants_1 = configVariants;
|
|
128
|
-
|
|
129
|
-
case
|
|
130
|
-
if (!(_i < configVariants_1.length)) return [3 /*break*/,
|
|
118
|
+
_d.label = 6;
|
|
119
|
+
case 6:
|
|
120
|
+
if (!(_i < configVariants_1.length)) return [3 /*break*/, 11];
|
|
131
121
|
configVariant = configVariants_1[_i];
|
|
132
122
|
jsConfig = "sentry.".concat(configVariant, ".config.js");
|
|
133
123
|
tsConfig = "sentry.".concat(configVariant, ".config.ts");
|
|
134
124
|
jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));
|
|
135
125
|
tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));
|
|
136
126
|
shouldWriteFile = true;
|
|
137
|
-
if (!(jsConfigExists || tsConfigExists)) return [3 /*break*/,
|
|
127
|
+
if (!(jsConfigExists || tsConfigExists)) return [3 /*break*/, 8];
|
|
138
128
|
existingConfigs = [];
|
|
139
129
|
if (jsConfigExists) {
|
|
140
130
|
existingConfigs.push(jsConfig);
|
|
@@ -145,8 +135,8 @@ function runNextjsWizard(options) {
|
|
|
145
135
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
146
136
|
message: "Found existing Sentry ".concat(configVariant, " config (").concat(existingConfigs.join(', '), "). Overwrite ").concat(existingConfigs.length > 1 ? 'them' : 'it', "?"),
|
|
147
137
|
}))];
|
|
148
|
-
case
|
|
149
|
-
overwriteExistingConfigs =
|
|
138
|
+
case 7:
|
|
139
|
+
overwriteExistingConfigs = _d.sent();
|
|
150
140
|
shouldWriteFile = overwriteExistingConfigs;
|
|
151
141
|
if (overwriteExistingConfigs) {
|
|
152
142
|
if (jsConfigExists) {
|
|
@@ -158,68 +148,68 @@ function runNextjsWizard(options) {
|
|
|
158
148
|
prompts_1.default.log.warn("Removed existing ".concat(chalk_1.default.bold(tsConfig), "."));
|
|
159
149
|
}
|
|
160
150
|
}
|
|
161
|
-
|
|
162
|
-
case
|
|
163
|
-
if (!shouldWriteFile) return [3 /*break*/,
|
|
151
|
+
_d.label = 8;
|
|
152
|
+
case 8:
|
|
153
|
+
if (!shouldWriteFile) return [3 /*break*/, 10];
|
|
164
154
|
return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig), (0, templates_1.getSentryConfigContents)(selectedProject.keys[0].dsn.public, configVariant), { encoding: 'utf8', flag: 'w' })];
|
|
165
|
-
case
|
|
166
|
-
|
|
155
|
+
case 9:
|
|
156
|
+
_d.sent();
|
|
167
157
|
prompts_1.default.log.success("Created fresh ".concat(chalk_1.default.bold(typeScriptDetected ? tsConfig : jsConfig), "."));
|
|
168
|
-
|
|
169
|
-
case
|
|
158
|
+
_d.label = 10;
|
|
159
|
+
case 10:
|
|
170
160
|
_i++;
|
|
171
|
-
return [3 /*break*/,
|
|
172
|
-
case
|
|
161
|
+
return [3 /*break*/, 6];
|
|
162
|
+
case 11:
|
|
173
163
|
sentryWebpackOptionsTemplate = (0, templates_1.getNextjsWebpackPluginOptionsTemplate)(selectedProject.organization.slug, selectedProject.slug);
|
|
174
164
|
sentryBuildOptionsTemplate = (0, templates_1.getNextjsSentryBuildOptionsTemplate)();
|
|
175
165
|
nextConfigJs = 'next.config.js';
|
|
176
166
|
nextConfigMjs = 'next.config.mjs';
|
|
177
167
|
nextConfigJsExists = fs.existsSync(path.join(process.cwd(), nextConfigJs));
|
|
178
168
|
nextConfigMjsExists = fs.existsSync(path.join(process.cwd(), nextConfigMjs));
|
|
179
|
-
if (!(!nextConfigJsExists && !nextConfigMjsExists)) return [3 /*break*/,
|
|
169
|
+
if (!(!nextConfigJsExists && !nextConfigMjsExists)) return [3 /*break*/, 13];
|
|
180
170
|
return [4 /*yield*/, fs.promises.writeFile(path.join(process.cwd(), nextConfigJs), (0, templates_1.getNextjsConfigCjsTemplate)(sentryWebpackOptionsTemplate, sentryBuildOptionsTemplate), { encoding: 'utf8', flag: 'w' })];
|
|
181
|
-
case
|
|
182
|
-
|
|
171
|
+
case 12:
|
|
172
|
+
_d.sent();
|
|
183
173
|
prompts_1.default.log.success("Created ".concat(chalk_1.default.bold('next.config.js'), " with Sentry configuration."));
|
|
184
|
-
|
|
185
|
-
case
|
|
186
|
-
if (!nextConfigJsExists) return [3 /*break*/,
|
|
174
|
+
_d.label = 13;
|
|
175
|
+
case 13:
|
|
176
|
+
if (!nextConfigJsExists) return [3 /*break*/, 17];
|
|
187
177
|
nextConfgiJsContent = fs.readFileSync(path.join(process.cwd(), nextConfigJs), 'utf8');
|
|
188
178
|
probablyIncludesSdk = nextConfgiJsContent.includes('@sentry/nextjs') &&
|
|
189
179
|
nextConfgiJsContent.includes('withSentryConfig');
|
|
190
180
|
shouldInject = true;
|
|
191
|
-
if (!probablyIncludesSdk) return [3 /*break*/,
|
|
181
|
+
if (!probablyIncludesSdk) return [3 /*break*/, 15];
|
|
192
182
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
193
183
|
message: "".concat(chalk_1.default.bold(nextConfigJs), " already contains Sentry SDK configuration. Should the wizard modify it anyways?"),
|
|
194
184
|
}))];
|
|
195
|
-
case
|
|
196
|
-
injectAnyhow =
|
|
185
|
+
case 14:
|
|
186
|
+
injectAnyhow = _d.sent();
|
|
197
187
|
shouldInject = injectAnyhow;
|
|
198
|
-
|
|
199
|
-
case
|
|
200
|
-
if (!shouldInject) return [3 /*break*/,
|
|
188
|
+
_d.label = 15;
|
|
189
|
+
case 15:
|
|
190
|
+
if (!shouldInject) return [3 /*break*/, 17];
|
|
201
191
|
return [4 /*yield*/, fs.promises.appendFile(path.join(process.cwd(), nextConfigJs), (0, templates_1.getNextjsConfigCjsAppendix)(sentryWebpackOptionsTemplate, sentryBuildOptionsTemplate), 'utf8')];
|
|
202
|
-
case
|
|
203
|
-
|
|
192
|
+
case 16:
|
|
193
|
+
_d.sent();
|
|
204
194
|
prompts_1.default.log.success("Added Sentry configuration to ".concat(chalk_1.default.bold(nextConfigJs), ". ").concat(chalk_1.default.dim('(you probably want to clean this up a bit!)')));
|
|
205
|
-
|
|
206
|
-
case
|
|
207
|
-
if (!nextConfigMjsExists) return [3 /*break*/,
|
|
195
|
+
_d.label = 17;
|
|
196
|
+
case 17:
|
|
197
|
+
if (!nextConfigMjsExists) return [3 /*break*/, 26];
|
|
208
198
|
nextConfgiMjsContent = fs.readFileSync(path.join(process.cwd(), nextConfigMjs), 'utf8');
|
|
209
199
|
probablyIncludesSdk = nextConfgiMjsContent.includes('@sentry/nextjs') &&
|
|
210
200
|
nextConfgiMjsContent.includes('withSentryConfig');
|
|
211
201
|
shouldInject = true;
|
|
212
|
-
if (!probablyIncludesSdk) return [3 /*break*/,
|
|
202
|
+
if (!probablyIncludesSdk) return [3 /*break*/, 19];
|
|
213
203
|
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(prompts_1.default.confirm({
|
|
214
204
|
message: "".concat(chalk_1.default.bold(nextConfigMjs), " already contains Sentry SDK configuration. Should the wizard modify it anyways?"),
|
|
215
205
|
}))];
|
|
216
|
-
case
|
|
217
|
-
injectAnyhow =
|
|
206
|
+
case 18:
|
|
207
|
+
injectAnyhow = _d.sent();
|
|
218
208
|
shouldInject = injectAnyhow;
|
|
219
|
-
|
|
220
|
-
case
|
|
221
|
-
|
|
222
|
-
if (!shouldInject) return [3 /*break*/,
|
|
209
|
+
_d.label = 19;
|
|
210
|
+
case 19:
|
|
211
|
+
_d.trys.push([19, 22, , 26]);
|
|
212
|
+
if (!shouldInject) return [3 /*break*/, 21];
|
|
223
213
|
mod = (0, magicast_1.parseModule)(nextConfgiMjsContent);
|
|
224
214
|
mod.imports.$add({
|
|
225
215
|
from: '@sentry/nextjs',
|
|
@@ -234,13 +224,13 @@ function runNextjsWizard(options) {
|
|
|
234
224
|
encoding: 'utf8',
|
|
235
225
|
flag: 'w',
|
|
236
226
|
})];
|
|
237
|
-
case
|
|
238
|
-
|
|
227
|
+
case 20:
|
|
228
|
+
_d.sent();
|
|
239
229
|
prompts_1.default.log.success("Added Sentry configuration to ".concat(chalk_1.default.bold(nextConfigMjs), ". ").concat(chalk_1.default.dim('(you probably want to clean this up a bit!)')));
|
|
240
|
-
|
|
241
|
-
case
|
|
242
|
-
case
|
|
243
|
-
|
|
230
|
+
_d.label = 21;
|
|
231
|
+
case 21: return [3 /*break*/, 26];
|
|
232
|
+
case 22:
|
|
233
|
+
_c = _d.sent();
|
|
244
234
|
prompts_1.default.log.warn(chalk_1.default.yellow("Something went wrong writing to ".concat(chalk_1.default.bold(nextConfigMjs))));
|
|
245
235
|
prompts_1.default.log.info("Please put the following code snippet into ".concat(chalk_1.default.bold(nextConfigMjs), ": ").concat(chalk_1.default.dim('You probably have to clean it up a bit.'), "\n"));
|
|
246
236
|
// eslint-disable-next-line no-console
|
|
@@ -250,15 +240,15 @@ function runNextjsWizard(options) {
|
|
|
250
240
|
active: 'Yes',
|
|
251
241
|
inactive: 'No, get me out of here',
|
|
252
242
|
}))];
|
|
253
|
-
case
|
|
254
|
-
shouldContinue =
|
|
255
|
-
if (!!shouldContinue) return [3 /*break*/,
|
|
243
|
+
case 23:
|
|
244
|
+
shouldContinue = _d.sent();
|
|
245
|
+
if (!!shouldContinue) return [3 /*break*/, 25];
|
|
256
246
|
return [4 /*yield*/, (0, clack_utils_1.abort)()];
|
|
247
|
+
case 24:
|
|
248
|
+
_d.sent();
|
|
249
|
+
_d.label = 25;
|
|
250
|
+
case 25: return [3 /*break*/, 26];
|
|
257
251
|
case 26:
|
|
258
|
-
_e.sent();
|
|
259
|
-
_e.label = 27;
|
|
260
|
-
case 27: return [3 /*break*/, 28];
|
|
261
|
-
case 28:
|
|
262
252
|
maybePagesDirPath = path.join(process.cwd(), 'pages');
|
|
263
253
|
maybeSrcPagesDirPath = path.join(process.cwd(), 'src', 'pages');
|
|
264
254
|
pagesLocation = fs.existsSync(maybePagesDirPath) &&
|
|
@@ -274,7 +264,7 @@ function runNextjsWizard(options) {
|
|
|
274
264
|
recursive: true,
|
|
275
265
|
});
|
|
276
266
|
}
|
|
277
|
-
if (!pagesLocation) return [3 /*break*/,
|
|
267
|
+
if (!pagesLocation) return [3 /*break*/, 29];
|
|
278
268
|
examplePageContents = (0, templates_1.getSentryExamplePageContents)({
|
|
279
269
|
selfHosted: selfHosted,
|
|
280
270
|
orgSlug: selectedProject.organization.slug,
|
|
@@ -282,21 +272,21 @@ function runNextjsWizard(options) {
|
|
|
282
272
|
url: sentryUrl,
|
|
283
273
|
});
|
|
284
274
|
return [4 /*yield*/, fs.promises.writeFile(path.join.apply(path, __spreadArray(__spreadArray([process.cwd()], pagesLocation, false), ['sentry-example-page.js'], false)), examplePageContents, { encoding: 'utf8', flag: 'w' })];
|
|
285
|
-
case
|
|
286
|
-
|
|
275
|
+
case 27:
|
|
276
|
+
_d.sent();
|
|
287
277
|
prompts_1.default.log.success("Created ".concat(chalk_1.default.bold(path.join.apply(path, __spreadArray(__spreadArray([], pagesLocation, false), ['sentry-example-page.js'], false))), "."));
|
|
288
278
|
fs.mkdirSync(path.join.apply(path, __spreadArray(__spreadArray([process.cwd()], pagesLocation, false), ['api'], false)), {
|
|
289
279
|
recursive: true,
|
|
290
280
|
});
|
|
291
281
|
return [4 /*yield*/, fs.promises.writeFile(path.join.apply(path, __spreadArray(__spreadArray([process.cwd()], pagesLocation, false), ['api',
|
|
292
282
|
'sentry-example-api.js'], false)), (0, templates_1.getSentryExampleApiRoute)(), { encoding: 'utf8', flag: 'w' })];
|
|
293
|
-
case
|
|
294
|
-
|
|
283
|
+
case 28:
|
|
284
|
+
_d.sent();
|
|
295
285
|
prompts_1.default.log.success("Created ".concat(chalk_1.default.bold(path.join.apply(path, __spreadArray(__spreadArray([], pagesLocation, false), ['api', 'sentry-example-api.js'], false))), "."));
|
|
296
|
-
|
|
297
|
-
case
|
|
298
|
-
case
|
|
299
|
-
|
|
286
|
+
_d.label = 29;
|
|
287
|
+
case 29: return [4 /*yield*/, (0, clack_utils_1.addSentryCliRc)(authToken)];
|
|
288
|
+
case 30:
|
|
289
|
+
_d.sent();
|
|
300
290
|
mightBeUsingVercel = fs.existsSync(path.join(process.cwd(), 'vercel.json'));
|
|
301
291
|
prompts_1.default.outro("".concat(chalk_1.default.green('Everything is set up!'), "\n\n ").concat(chalk_1.default.cyan('You can validate your setup by starting your dev environment (`next dev`) and visiting "/sentry-example-page".'), "\n").concat(mightBeUsingVercel
|
|
302
292
|
? "\n \u25B2 It seems like you're using Vercel. We recommend using the Sentry Vercel integration: https://vercel.com/integrations/sentry\n"
|