@sentry/wizard 4.2.0 → 4.3.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 +12 -1
- package/dist/e2e-tests/tests/{nextjs.test.js → nextjs-14.test.js} +3 -3
- package/dist/e2e-tests/tests/nextjs-14.test.js.map +1 -0
- package/dist/e2e-tests/tests/nextjs-15.test.d.ts +1 -0
- package/dist/e2e-tests/tests/nextjs-15.test.js +123 -0
- package/dist/e2e-tests/tests/nextjs-15.test.js.map +1 -0
- package/dist/src/apple/apple-wizard.js +5 -1
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/flutter/flutter-wizard.js +3 -1
- package/dist/src/flutter/flutter-wizard.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +5 -4
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.js +1 -1
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +1 -1
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/sourcemaps/sourcemaps-wizard.d.ts +1 -0
- package/dist/src/sourcemaps/sourcemaps-wizard.js +14 -30
- package/dist/src/sourcemaps/sourcemaps-wizard.js.map +1 -1
- package/dist/src/sourcemaps/utils/detect-tool.js +0 -2
- package/dist/src/sourcemaps/utils/detect-tool.js.map +1 -1
- package/dist/src/sveltekit/sdk-setup.js +1 -1
- package/dist/src/sveltekit/sdk-setup.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +2 -2
- package/dist/e2e-tests/tests/nextjs.test.js.map +0 -1
- /package/dist/e2e-tests/tests/{nextjs.test.d.ts → nextjs-14.test.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 4.3.0
|
|
4
|
+
|
|
5
|
+
- feat: Skip CI prompt if `--coming-from` `vercel` ([#848](https://github.com/getsentry/sentry-wizard/pull/848))
|
|
6
|
+
- feat(deps): Bump axios from 1.7.4 to 1.8.2 ([#844](https://github.com/getsentry/sentry-wizard/pull/844))
|
|
7
|
+
- feat(sourcemaps): Remove NextJS and Remix flows from sourcemaps wizard ([#849](https://github.com/getsentry/sentry-wizard/pull/849))
|
|
8
|
+
|
|
9
|
+
The NextJS and Remix flows have been removed when running the wizard with `npx @sentry/wizard -i sourcemaps`.
|
|
10
|
+
Please use `npx @sentry/wizard -i nextjs` and `npx @sentry/wizard -i remix` instead.
|
|
11
|
+
- ref: Reword Replay feature selection ([#847](https://github.com/getsentry/sentry-wizard/pull/847))
|
|
12
|
+
- ref: Fix auth token env variable wording in flutter and apple wizards ([#853](https://github.com/getsentry/sentry-wizard/pull/853))
|
|
4
13
|
|
|
5
14
|
## 4.2.0
|
|
6
15
|
|
|
16
|
+
- feat: Add `coming-from` parameter ([#837](https://github.com/getsentry/sentry-wizard/pull/837))
|
|
17
|
+
|
|
7
18
|
### Various fixes & improvements
|
|
8
19
|
|
|
9
20
|
- feat: add coming-from parameter (#837) by @obostjancic
|
|
@@ -29,9 +29,9 @@ const Constants_1 = require("../../lib/Constants");
|
|
|
29
29
|
const utils_1 = require("../utils");
|
|
30
30
|
const utils_2 = require("../utils");
|
|
31
31
|
const utils_3 = require("../utils");
|
|
32
|
-
describe('NextJS', () => {
|
|
32
|
+
describe('NextJS-14', () => {
|
|
33
33
|
const integration = Constants_1.Integration.nextjs;
|
|
34
|
-
const projectDir = path.resolve(__dirname, '../test-applications/nextjs-test-app');
|
|
34
|
+
const projectDir = path.resolve(__dirname, '../test-applications/nextjs-14-test-app');
|
|
35
35
|
beforeAll(async () => {
|
|
36
36
|
const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
|
|
37
37
|
const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
|
|
@@ -120,4 +120,4 @@ export const onRequestError = Sentry.captureRequestError;`,
|
|
|
120
120
|
await (0, utils_3.checkIfRunsOnProdMode)(projectDir, 'Ready in');
|
|
121
121
|
});
|
|
122
122
|
});
|
|
123
|
-
//# sourceMappingURL=nextjs.test.js.map
|
|
123
|
+
//# sourceMappingURL=nextjs-14.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs-14.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-14.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAuC;AACvC,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAOkB;AAElB,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,WAAW,GAAG,uBAAW,CAAC,MAAM,CAAC;IACvC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,yCAAyC,CAC1C,CAAC;IAEF,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;QACpE,MAAM,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CAC/D,qCAAqC,CACtC,CAAC;QAEF,MAAM,0BAA0B,GAC9B,sBAAsB;YACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;YAC7C,0CAA0C;YAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC,EACvB,iFAAiF,EACjF;gBACE,OAAO,EAAE,MAAO;aACjB,CACF,CAAC,CAAC;QAEL,MAAM,iCAAiC,GACrC,0BAA0B;YAC1B,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,mDAAmD,CACpD,CAAC,CAAC;QAEL,MAAM,qBAAqB,GACzB,iCAAiC;YACjC,CAAC,MAAM,c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AAC,CAAC,CAAC;IAEH,IAAI,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable jest/expect-expect */\nimport * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\n\ndescribe('NextJS-14', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-14-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const reactComponentAnnotationsPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to enable React component annotations',\n ));\n\n const tracingOptionPrompted =\n reactComponentAnnotationsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const examplePagePrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `No` for CI/CD tool\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.client.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation file exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n \"import * as Sentry from '@sentry/nextjs';\",\n `export async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('../sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('../sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.mjs`, [\n \"import {withSentryConfig} from '@sentry/nextjs'\",\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n});\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
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
|
+
/* eslint-disable jest/expect-expect */
|
|
27
|
+
const path = __importStar(require("node:path"));
|
|
28
|
+
const Constants_1 = require("../../lib/Constants");
|
|
29
|
+
const utils_1 = require("../utils");
|
|
30
|
+
const utils_2 = require("../utils");
|
|
31
|
+
const utils_3 = require("../utils");
|
|
32
|
+
describe('NextJS-15', () => {
|
|
33
|
+
const integration = Constants_1.Integration.nextjs;
|
|
34
|
+
const projectDir = path.resolve(__dirname, '../test-applications/nextjs-15-test-app');
|
|
35
|
+
beforeAll(async () => {
|
|
36
|
+
const wizardInstance = (0, utils_2.startWizardInstance)(integration, projectDir);
|
|
37
|
+
const packageManagerPrompted = await wizardInstance.waitForOutput('Please select your package manager.');
|
|
38
|
+
const routeThroughNextJsPrompted = packageManagerPrompted &&
|
|
39
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
40
|
+
// Selecting `yarn` as the package manager
|
|
41
|
+
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Do you want to route Sentry requests in the browser through your Next.js server', {
|
|
42
|
+
timeout: 240000,
|
|
43
|
+
}));
|
|
44
|
+
const reactComponentAnnotationsPrompted = routeThroughNextJsPrompted &&
|
|
45
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to enable React component annotations'));
|
|
46
|
+
const tracingOptionPrompted = reactComponentAnnotationsPrompted &&
|
|
47
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
48
|
+
// "Do you want to enable Tracing", sometimes doesn't work as `Tracing` can be printed in bold.
|
|
49
|
+
'to track the performance of your application?'));
|
|
50
|
+
const replayOptionPrompted = tracingOptionPrompted &&
|
|
51
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
52
|
+
// "Do you want to enable Sentry Session Replay", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.
|
|
53
|
+
'to get a video-like reproduction of errors during a user session?'));
|
|
54
|
+
const examplePagePrompted = replayOptionPrompted &&
|
|
55
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Do you want to create an example page', {
|
|
56
|
+
optional: true,
|
|
57
|
+
}));
|
|
58
|
+
const ciCdPrompted = examplePagePrompted &&
|
|
59
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Are you using a CI/CD tool'));
|
|
60
|
+
ciCdPrompted &&
|
|
61
|
+
(await wizardInstance.sendStdinAndWaitForOutput(
|
|
62
|
+
// Selecting `No` for CI/CD tool
|
|
63
|
+
[utils_1.KEYS.DOWN, utils_1.KEYS.ENTER], 'Successfully installed the Sentry Next.js SDK!'));
|
|
64
|
+
wizardInstance.kill();
|
|
65
|
+
});
|
|
66
|
+
afterAll(() => {
|
|
67
|
+
(0, utils_1.revertLocalChanges)(projectDir);
|
|
68
|
+
(0, utils_1.cleanupGit)(projectDir);
|
|
69
|
+
});
|
|
70
|
+
test('package.json is updated correctly', () => {
|
|
71
|
+
(0, utils_3.checkPackageJson)(projectDir, integration);
|
|
72
|
+
});
|
|
73
|
+
test('.env-sentry-build-plugin is created and contains the auth token', () => {
|
|
74
|
+
(0, utils_1.checkEnvBuildPlugin)(projectDir);
|
|
75
|
+
});
|
|
76
|
+
test('example page exists', () => {
|
|
77
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/app/sentry-example-page/page.tsx`);
|
|
78
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/app/api/sentry-example-api/route.ts`);
|
|
79
|
+
});
|
|
80
|
+
test('config files created', () => {
|
|
81
|
+
(0, utils_3.checkFileExists)(`${projectDir}/sentry.server.config.ts`);
|
|
82
|
+
(0, utils_3.checkFileExists)(`${projectDir}/sentry.client.config.ts`);
|
|
83
|
+
(0, utils_3.checkFileExists)(`${projectDir}/sentry.edge.config.ts`);
|
|
84
|
+
});
|
|
85
|
+
test('global error file exists', () => {
|
|
86
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/app/global-error.tsx`);
|
|
87
|
+
});
|
|
88
|
+
test('instrumentation file exists', () => {
|
|
89
|
+
(0, utils_3.checkFileExists)(`${projectDir}/src/instrumentation.ts`);
|
|
90
|
+
});
|
|
91
|
+
test('instrumentation file contains Sentry initialization', () => {
|
|
92
|
+
(0, utils_3.checkFileContents)(`${projectDir}/src/instrumentation.ts`, [
|
|
93
|
+
"import * as Sentry from '@sentry/nextjs';",
|
|
94
|
+
`export async function register() {
|
|
95
|
+
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
96
|
+
await import('../sentry.server.config');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (process.env.NEXT_RUNTIME === 'edge') {
|
|
100
|
+
await import('../sentry.edge.config');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const onRequestError = Sentry.captureRequestError;`,
|
|
105
|
+
]);
|
|
106
|
+
});
|
|
107
|
+
test('next.config file contains Sentry wrapper', () => {
|
|
108
|
+
(0, utils_3.checkFileContents)(`${projectDir}/next.config.ts`, [
|
|
109
|
+
'import {withSentryConfig} from "@sentry/nextjs"',
|
|
110
|
+
'export default withSentryConfig(nextConfig, {',
|
|
111
|
+
]);
|
|
112
|
+
});
|
|
113
|
+
test('runs on dev mode correctly', async () => {
|
|
114
|
+
await (0, utils_3.checkIfRunsOnDevMode)(projectDir, 'Ready in');
|
|
115
|
+
});
|
|
116
|
+
test('builds correctly', async () => {
|
|
117
|
+
await (0, utils_3.checkIfBuilds)(projectDir);
|
|
118
|
+
});
|
|
119
|
+
test('runs on prod mode correctly', async () => {
|
|
120
|
+
await (0, utils_3.checkIfRunsOnProdMode)(projectDir, 'Ready in');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=nextjs-15.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextjs-15.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/nextjs-15.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;A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,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACpC,IAAA,uBAAe,EAAC,GAAG,UAAU,2BAA2B,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACvC,IAAA,uBAAe,EAAC,GAAG,UAAU,yBAAyB,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC/D,IAAA,yBAAiB,EAAC,GAAG,UAAU,yBAAyB,EAAE;YACxD,2CAA2C;YAC3C;;;;;;;;;;0DAUoD;SACrD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,0CAA0C,EAAE,GAAG,EAAE;QACpD,IAAA,yBAAiB,EAAC,GAAG,UAAU,iBAAiB,EAAE;YAChD,iDAAiD;YACjD,+CAA+C;SAChD,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,4BAA4B,EAAE,KAAK,IAAI,EAAE;QAC5C,MAAM,IAAA,4BAAoB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,IAAA,qBAAa,EAAC,UAAU,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC7C,MAAM,IAAA,6BAAqB,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable jest/expect-expect */\nimport * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n checkEnvBuildPlugin,\n cleanupGit,\n revertLocalChanges,\n} from '../utils';\nimport { startWizardInstance } from '../utils';\nimport {\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n} from '../utils';\n\ndescribe('NextJS-15', () => {\n const integration = Integration.nextjs;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/nextjs-15-test-app',\n );\n\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n const packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n\n const routeThroughNextJsPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, KEYS.ENTER],\n 'Do you want to route Sentry requests in the browser through your Next.js server',\n {\n timeout: 240_000,\n },\n ));\n\n const reactComponentAnnotationsPrompted =\n routeThroughNextJsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to enable React component annotations',\n ));\n\n const tracingOptionPrompted =\n reactComponentAnnotationsPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Tracing\", sometimes doesn't work as `Tracing` can be printed in bold.\n 'to track the performance of your application?',\n ));\n\n const replayOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Sentry Session Replay\", sometimes doesn't work as `Sentry Session Replay` can be printed in bold.\n 'to get a video-like reproduction of errors during a user session?',\n ));\n\n const examplePagePrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n const ciCdPrompted =\n examplePagePrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Are you using a CI/CD tool',\n ));\n\n ciCdPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `No` for CI/CD tool\n [KEYS.DOWN, KEYS.ENTER],\n 'Successfully installed the Sentry Next.js SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('package.json is updated correctly', () => {\n checkPackageJson(projectDir, integration);\n });\n\n test('.env-sentry-build-plugin is created and contains the auth token', () => {\n checkEnvBuildPlugin(projectDir);\n });\n\n test('example page exists', () => {\n checkFileExists(`${projectDir}/src/app/sentry-example-page/page.tsx`);\n checkFileExists(`${projectDir}/src/app/api/sentry-example-api/route.ts`);\n });\n\n test('config files created', () => {\n checkFileExists(`${projectDir}/sentry.server.config.ts`);\n checkFileExists(`${projectDir}/sentry.client.config.ts`);\n checkFileExists(`${projectDir}/sentry.edge.config.ts`);\n });\n\n test('global error file exists', () => {\n checkFileExists(`${projectDir}/src/app/global-error.tsx`);\n });\n\n test('instrumentation file exists', () => {\n checkFileExists(`${projectDir}/src/instrumentation.ts`);\n });\n\n test('instrumentation file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/src/instrumentation.ts`, [\n \"import * as Sentry from '@sentry/nextjs';\",\n `export async function register() {\n if (process.env.NEXT_RUNTIME === 'nodejs') {\n await import('../sentry.server.config');\n }\n\n if (process.env.NEXT_RUNTIME === 'edge') {\n await import('../sentry.edge.config');\n }\n}\n\nexport const onRequestError = Sentry.captureRequestError;`,\n ]);\n });\n\n test('next.config file contains Sentry wrapper', () => {\n checkFileContents(`${projectDir}/next.config.ts`, [\n 'import {withSentryConfig} from \"@sentry/nextjs\"',\n 'export default withSentryConfig(nextConfig, {',\n ]);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(projectDir, 'Ready in');\n });\n\n test('builds correctly', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(projectDir, 'Ready in');\n });\n});\n"]}
|
|
@@ -34,6 +34,7 @@ exports.runAppleWizard = void 0;
|
|
|
34
34
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
35
35
|
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
36
36
|
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
37
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
37
38
|
const fs = __importStar(require("fs"));
|
|
38
39
|
const path = __importStar(require("path"));
|
|
39
40
|
const xcode_manager_1 = require("./xcode-manager");
|
|
@@ -107,7 +108,10 @@ async function runAppleWizardWithTelementry(options) {
|
|
|
107
108
|
? availableTargets[0]
|
|
108
109
|
: (await (0, telemetry_1.traceStep)('Choose target', () => (0, clack_utils_1.askForItemSelection)(availableTargets, 'Which target do you want to add Sentry to?'))).value;
|
|
109
110
|
SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });
|
|
110
|
-
prompts_1.default.log.info(
|
|
111
|
+
prompts_1.default.log.info(`Created a ${chalk_1.default.cyan('.sentryclirc')} file in your project directory to provide an auth token for Sentry CLI.
|
|
112
|
+
|
|
113
|
+
It was also added to your ${chalk_1.default.cyan('.gitignore')} file.
|
|
114
|
+
Set the ${chalk_1.default.cyan('SENTRY_AUTH_TOKEN')} environment variable in your CI environment. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`);
|
|
111
115
|
let hasCocoa = cocoapod.usesCocoaPod(projectDir);
|
|
112
116
|
Sentry.setTag('cocoapod-exists', hasCocoa);
|
|
113
117
|
if (hasCocoa) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,6DAAmC;AACnC,uCAAyB;AACzB,2CAA6B;AAC7B,mDAA+C;AAC/C,wDAA0C;AAC1C,oDAAsC;AACtC,sEAAwD;AAExD,qDAAuC;AACvC,4CAAwD;AACxD,qDAAuC;AACvC,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C,IAAI,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO,OAAO,EAAE;QACd,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,IACE,CAAC,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC;YACjC,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC;YAC5B,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EACxB;YACA,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACnB;QACD,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qCAAqC;AACrC,SAAS,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IAC5D,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1D,CAAC","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 */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n wizardOptions: options,\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suitable target found in ${xcodeProjFile}`);\n Sentry.setTag('No-Target', true);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n Sentry.setTag('cocoapod-exists', hasCocoa);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n Sentry.setTag('cocoapod-added', podAdded);\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, !hasCocoa, true);\n });\n\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n\n Sentry.setTag('Snippet-Added', codeAdded);\n\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n Sentry.setTag('fastlane-desired', addLane);\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n Sentry.setTag('fastlane-added', added);\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,6DAAmC;AACnC,kDAA0B;AAC1B,uCAAyB;AACzB,2CAA6B;AAC7B,mDAA+C;AAC/C,wDAA0C;AAC1C,oDAAsC;AACtC,sEAAwD;AAExD,qDAAuC;AACvC,4CAAwD;AACxD,qDAAuC;AACvC,qDAAuC;AAEvC,qDAAqD;AAErD,sDAO8B;AAEvB,KAAK,UAAU,cAAc,CAAC,OAAsB;IACzD,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,KAAK;QAClB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAC5C,CAAC;AACJ,CAAC;AATD,wCASC;AAED,KAAK,UAAU,4BAA4B,CACzC,OAAsB;IAEtB,IAAA,0BAAY,EAAC;QACX,UAAU,EAAE,qBAAqB;QACjC,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAC;IAEH,MAAM,IAAA,+CAAiC,GAAE,CAAC;IAE1C,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IACnC,MAAM,CAAC,MAAM,CAAC,SAAS,EAA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AAO,CAAC,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qCAAqC;AACrC,SAAS,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IAC5D,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC;AAC1D,CAAC","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 */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n wizardOptions: options,\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suitable target found in ${xcodeProjFile}`);\n Sentry.setTag('No-Target', true);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n `Created a ${chalk.cyan(\n '.sentryclirc',\n )} file in your project directory to provide an auth token for Sentry CLI.\n \nIt was also added to your ${chalk.cyan('.gitignore')} file.\nSet the ${chalk.cyan(\n 'SENTRY_AUTH_TOKEN',\n )} environment variable in your CI environment. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`,\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n Sentry.setTag('cocoapod-exists', hasCocoa);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n Sentry.setTag('cocoapod-added', podAdded);\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, !hasCocoa, true);\n });\n\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n\n Sentry.setTag('Snippet-Added', codeAdded);\n\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n Sentry.setTag('fastlane-desired', addLane);\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n Sentry.setTag('fastlane-added', added);\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
|
|
@@ -79,7 +79,9 @@ async function runFlutterWizardWithTelemetry(options) {
|
|
|
79
79
|
clack.log.warn(`We could not add ${chalk_1.default.cyan('sentry.properties')} file in your project directory in order to provide an auth token for Sentry CLI. You'll have to add it manually, or you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`);
|
|
80
80
|
}
|
|
81
81
|
else {
|
|
82
|
-
clack.log.info(`
|
|
82
|
+
clack.log.info(`Created a ${chalk_1.default.cyan('sentry.properties')} file in your project directory to provide an auth token for Sentry CLI.
|
|
83
|
+
It was also added to your ${chalk_1.default.cyan('.gitignore')} file.
|
|
84
|
+
Set the ${chalk_1.default.cyan('SENTRY_AUTH_TOKEN')} environment variable in your CI environment. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`);
|
|
83
85
|
}
|
|
84
86
|
Sentry.setTag('sentry-properties-added', pubspecPatched);
|
|
85
87
|
// ======== STEP 3. Patch main.dart with setup and a test error snippet ============
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flutter-wizard.js","sourceRoot":"","sources":["../../../src/flutter/flutter-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,qDAAuC;AACvC,wDAA0C;AAC1C,uCAAyB;AACzB,2CAA6B;AAC7B,sDAAiE;AACjE,2CAAwE;AACxE,gEAA4D;AAC5D,yEAAyE;AACzE,sDAAwC;AACxC,kDAA0B;AAE1B,sDAI8B;AAE9B,4CAAwD;AACxD,6CAAwC;AAEjC,KAAK,UAAU,gBAAgB,CAAC,OAAsB;IAC3D,OAAO,IAAA,yBAAa,EAClB;QACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;QACjC,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,OAAO;KACvB,EACD,GAAG,EAAE,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAC7C,CAAC;AACJ,CAAC;AATD,4CASC;AAED,KAAK,UAAU,6BAA6B,CAC1C,OAAsB;IAEtB,IAAA,0BAAY,EAAC;QACX,UAAU,EAAE,uBAAuB;QACnC,SAAS,EAAE,OAAO,CAAC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* as Sentry from '@sentry/node';\nimport * as codetools from './code-tools';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { showCopyPasteInstructions } from '../utils/clack-utils';\nimport { pubspecSnippetColored, initSnippetColored } from './templates';\nimport { fetchSdkVersion } from '../utils/release-registry';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack-utils';\n\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { findFile } from './code-tools';\n\nexport async function runFlutterWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'flutter',\n wizardOptions: options,\n },\n () => runFlutterWizardWithTelemetry(options),\n );\n}\n\nasync function runFlutterWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Flutter Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const { selectedProject, selfHosted, sentryUrl, authToken } =\n await getOrAskForProjectData(options, 'flutter');\n\n const projectDir = process.cwd();\n const pubspecFile = path.join(projectDir, 'pubspec.yaml');\n if (!fs.existsSync(pubspecFile)) {\n clack.log.error(\n `Could not find ${chalk.cyan(\n 'pubspec.yaml',\n )}. Make sure you run the wizard in the projects root folder.`,\n );\n return;\n }\n\n // ======== STEP 1. Add sentry_flutter and sentry_dart_plugin to pubspec.yaml ============\n\n clack.log.step(\n `Adding ${chalk.bold('Sentry')} to your apps ${chalk.cyan(\n 'pubspec.yaml',\n )} file.`,\n );\n\n const flutterVersion = await fetchSdkVersion('sentry.dart.flutter');\n const flutterVersionOrAny = flutterVersion ? `^${flutterVersion}` : 'any';\n\n const pluginVersion = await fetchSdkVersion('sentry.dart.plugin');\n const pluginVersionOrAny = pluginVersion ? `^${pluginVersion}` : 'any';\n\n const pubspecPatched = traceStep('Patch pubspec.yaml', () =>\n codetools.patchPubspec(\n pubspecFile,\n flutterVersionOrAny,\n pluginVersionOrAny,\n selectedProject.slug,\n selectedProject.organization.slug,\n ),\n );\n if (!pubspecPatched) {\n clack.log.warn(\n `Could not patch ${chalk.cyan(\n 'pubspec.yaml',\n )}. Add the dependencies to it.`,\n );\n await showCopyPasteInstructions(\n 'pubspec.yaml',\n pubspecSnippetColored(\n flutterVersionOrAny,\n pluginVersionOrAny,\n selectedProject.slug,\n selectedProject.organization.slug,\n ),\n 'This ensures the Sentry SDK and plugin can be imported.',\n );\n }\n Sentry.setTag('pubspec-patched', pubspecPatched);\n\n // ======== STEP 2. Add sentry.properties with auth token ============\n\n const propertiesAdded = traceStep('Add sentry.properties', () =>\n codetools.addProperties(pubspecFile, authToken),\n );\n if (!propertiesAdded) {\n clack.log.warn(\n `We could not add ${chalk.cyan(\n 'sentry.properties',\n )} file in your project directory in order to provide an auth token for Sentry CLI. You'll have to add it manually, or you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`,\n );\n } else {\n clack.log.info(\n `Created a ${chalk.cyan(\n 'sentry.properties',\n )} file in your project directory to provide an auth token for Sentry CLI.\nIt was also added to your ${chalk.cyan('.gitignore')} file.\nSet the ${chalk.cyan(\n 'SENTRY_AUTH_TOKEN',\n )} environment variable in your CI environment. See https://docs.sentry.io/cli/configuration/#auth-token for more information.`,\n );\n }\n Sentry.setTag('sentry-properties-added', pubspecPatched);\n\n // ======== STEP 3. Patch main.dart with setup and a test error snippet ============\n\n clack.log.step(\n `Patching ${chalk.cyan('main.dart')} with setup and test error snippet.`,\n );\n\n const mainFile = findFile(`${projectDir}/lib`, 'main.dart');\n const dsn = selectedProject.keys[0].dsn.public;\n const canEnableProfiling =\n fs.existsSync(`${projectDir}/ios`) || fs.existsSync(`${projectDir}/macos`);\n\n const mainPatched = await traceStep('Patch main.dart', () =>\n codetools.patchMain(mainFile, dsn, canEnableProfiling),\n );\n if (!mainPatched) {\n clack.log.warn(\n `Could not patch ${chalk.cyan(\n 'main.dart',\n )} file. Place the following code snippet within the apps main function.`,\n );\n await showCopyPasteInstructions(\n 'main.dart',\n initSnippetColored(dsn),\n 'This ensures the Sentry SDK is ready to capture errors.',\n );\n }\n Sentry.setTag('main-patched', mainPatched);\n\n // ======== OUTRO ========\n\n const issuesPageLink = selfHosted\n ? `${sentryUrl}organizations/${selectedProject.organization.slug}/issues/?project=${selectedProject.id}`\n : `https://${selectedProject.organization.slug}.sentry.io/issues/?project=${selectedProject.id}`;\n\n clack.outro(`\n ${chalk.greenBright('Successfully installed the Sentry Flutter SDK!')}\n \n ${chalk.cyan(\n `You can validate your setup by launching your application and checking Sentry issues page afterwards\n ${issuesPageLink}`,\n )}\n \n Check out the SDK documentation for further configuration:\n https://docs.sentry.io/platforms/flutter/\n `);\n}\n"]}
|
|
@@ -199,11 +199,12 @@ async function runNextjsWizardWithTelemetry(options) {
|
|
|
199
199
|
}));
|
|
200
200
|
}
|
|
201
201
|
const mightBeUsingVercel = fs.existsSync(path.join(process.cwd(), 'vercel.json'));
|
|
202
|
-
if (mightBeUsingVercel) {
|
|
203
|
-
prompts_1.default.log.info("▲ It seems like you're using Vercel. We recommend using the Sentry Vercel
|
|
202
|
+
if (mightBeUsingVercel && !options.comingFrom) {
|
|
203
|
+
prompts_1.default.log.info("▲ It seems like you're using Vercel. We recommend using the Sentry Vercel \
|
|
204
|
+
integration to set up an auth token for Vercel deployments: https://vercel.com/integrations/sentry");
|
|
204
205
|
}
|
|
205
206
|
else {
|
|
206
|
-
await (0,
|
|
207
|
+
await (0, sourcemaps_wizard_1.setupCI)('nextjs', authToken, options.comingFrom);
|
|
207
208
|
}
|
|
208
209
|
const packageManagerForOutro = packageManagerFromInstallStep ?? (await (0, clack_utils_1.getPackageManager)());
|
|
209
210
|
await (0, clack_utils_1.runPrettierIfInstalled)();
|
|
@@ -226,7 +227,7 @@ async function createOrMergeNextJsFiles(selectedProject, selfHosted, sentryUrl,
|
|
|
226
227
|
},
|
|
227
228
|
{
|
|
228
229
|
id: 'replay',
|
|
229
|
-
prompt: `Do you want to enable ${chalk_1.default.bold('
|
|
230
|
+
prompt: `Do you want to enable ${chalk_1.default.bold('Session Replay')} to get a video-like reproduction of errors during a user session?`,
|
|
230
231
|
enabledHint: 'recommended, but increases bundle size',
|
|
231
232
|
},
|
|
232
233
|
]);
|