@sentry/wizard 6.1.1 → 6.2.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 +24 -0
- package/dist/e2e-tests/tests/flutter.test.js +16 -2
- package/dist/e2e-tests/tests/flutter.test.js.map +1 -1
- package/dist/e2e-tests/tests/remix.test.js +3 -2
- package/dist/e2e-tests/tests/remix.test.js.map +1 -1
- package/dist/lib/Steps/Integrations/Electron.js +4 -0
- package/dist/lib/Steps/Integrations/Electron.js.map +1 -1
- package/dist/src/angular/angular-wizard.js +1 -1
- package/dist/src/angular/angular-wizard.js.map +1 -1
- package/dist/src/apple/apple-wizard.js +10 -0
- package/dist/src/apple/apple-wizard.js.map +1 -1
- package/dist/src/apple/code-tools.d.ts +1 -1
- package/dist/src/apple/code-tools.js +3 -3
- package/dist/src/apple/code-tools.js.map +1 -1
- package/dist/src/apple/inject-code-snippet.d.ts +2 -1
- package/dist/src/apple/inject-code-snippet.js +2 -2
- package/dist/src/apple/inject-code-snippet.js.map +1 -1
- package/dist/src/apple/templates.d.ts +2 -2
- package/dist/src/apple/templates.js +22 -6
- package/dist/src/apple/templates.js.map +1 -1
- package/dist/src/flutter/code-tools.d.ts +1 -0
- package/dist/src/flutter/code-tools.js +6 -0
- package/dist/src/flutter/code-tools.js.map +1 -1
- package/dist/src/flutter/templates.d.ts +1 -0
- package/dist/src/flutter/templates.js +5 -0
- package/dist/src/flutter/templates.js.map +1 -1
- package/dist/src/nextjs/nextjs-wizard.js +12 -8
- package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
- package/dist/src/nextjs/utils.d.ts +8 -0
- package/dist/src/nextjs/utils.js +36 -1
- package/dist/src/nextjs/utils.js.map +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +1 -1
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/react-native/expo-metro.d.ts +2 -2
- package/dist/src/react-native/expo-metro.js +32 -27
- package/dist/src/react-native/expo-metro.js.map +1 -1
- package/dist/src/react-native/metro.d.ts +4 -4
- package/dist/src/react-native/metro.js +39 -17
- package/dist/src/react-native/metro.js.map +1 -1
- package/dist/src/remix/codemods/root.d.ts +1 -0
- package/dist/src/remix/codemods/root.js +30 -2
- package/dist/src/remix/codemods/root.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/sveltekit/sveltekit-wizard.js +1 -1
- package/dist/src/sveltekit/sveltekit-wizard.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/dist/test/apple/code-tools.test.js +62 -14
- package/dist/test/apple/code-tools.test.js.map +1 -1
- package/dist/test/apple/templates.test.js +68 -2
- package/dist/test/apple/templates.test.js.map +1 -1
- package/dist/test/flutter/code-tools.test.js +1 -0
- package/dist/test/flutter/code-tools.test.js.map +1 -1
- package/dist/test/flutter/templates.test.js +28 -1
- package/dist/test/flutter/templates.test.js.map +1 -1
- package/dist/test/nextjs/wizard-double-wrap-prevention.test.d.ts +1 -0
- package/dist/test/nextjs/wizard-double-wrap-prevention.test.js +266 -0
- package/dist/test/nextjs/wizard-double-wrap-prevention.test.js.map +1 -0
- package/dist/test/react-native/expo-metro.test.js +3 -3
- package/dist/test/react-native/expo-metro.test.js.map +1 -1
- package/dist/test/react-native/metro.test.js +73 -15
- package/dist/test/react-native/metro.test.js.map +1 -1
- package/dist/test/remix/root.test.js +226 -0
- package/dist/test/remix/root.test.js.map +1 -1
- package/package.json +1 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.2.0
|
|
4
|
+
|
|
5
|
+
- feat(cocoa): Add structured logs opt-in option ([#1051](https://github.com/getsentry/sentry-wizard/pull/1051))
|
|
6
|
+
- feat(electron): Show `sendDefaultPii: true` inside `Sentry.init` example ([#1062](https://github.com/getsentry/sentry-wizard/pull/1062))
|
|
7
|
+
- feat(flutter): Add structured logs opt-in #1050 ([#1050](https://github.com/getsentry/sentry-wizard/pull/1050))
|
|
8
|
+
- fix(nextjs): Prevent double-wrapping of Next.js config ([#1058](https://github.com/getsentry/sentry-wizard/pull/1058))
|
|
9
|
+
- fix(react-native): Add support for metro.config.cjs files ([#1064](https://github.com/getsentry/sentry-wizard/pull/1064))
|
|
10
|
+
- fix(remix): Wrap app with `withSentry` independently from `hasSentryContent` ([#1061](https://github.com/getsentry/sentry-wizard/pull/1061))
|
|
11
|
+
|
|
12
|
+
<details>
|
|
13
|
+
<summary><strong>Internal Changes</strong></summary>
|
|
14
|
+
|
|
15
|
+
- chore: remove unused deps (@clack/core, rimraf, @types/\*) ([#1065](https://github.com/getsentry/sentry-wizard/pull/1065))
|
|
16
|
+
- chore: remove unused deps (tsx, dotenv, @sentry-internal/sdk) ([#1068](https://github.com/getsentry/sentry-wizard/pull/1068))
|
|
17
|
+
|
|
18
|
+
</details>
|
|
19
|
+
<br/>
|
|
20
|
+
|
|
21
|
+
Work in this release was contributed by @outslept. Thank you for your contribution!
|
|
22
|
+
|
|
23
|
+
## 6.1.2
|
|
24
|
+
|
|
25
|
+
- ref(angular,nextjs,nuxt,remix,sveltekit): Install SDK package version `@^10` ([#1048](https://github.com/getsentry/sentry-wizard/pull/1048))
|
|
26
|
+
|
|
3
27
|
## 6.1.1
|
|
4
28
|
|
|
5
29
|
- fix(apple): Added methods to add and update Sentry build phase script ([#1029](https://github.com/getsentry/sentry-wizard/pull/1029))
|
|
@@ -47,7 +47,11 @@ const vitest_1 = require("vitest");
|
|
|
47
47
|
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
48
48
|
// "Do you want to enable Session Replay", sometimes doesn't work as `Session Replay` can be printed in bold.
|
|
49
49
|
'to record user interactions and debug issues?'));
|
|
50
|
-
replayOptionPrompted &&
|
|
50
|
+
const logsOptionPrompted = replayOptionPrompted &&
|
|
51
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
52
|
+
// "Do you want to enable Logs", sometimes doesn't work as `Logs` can be printed in bold.
|
|
53
|
+
'to send your application logs to Sentry?'));
|
|
54
|
+
logsOptionPrompted &&
|
|
51
55
|
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Successfully installed the Sentry Flutter SDK!'));
|
|
52
56
|
wizardInstance.kill();
|
|
53
57
|
});
|
|
@@ -74,6 +78,9 @@ const vitest_1 = require("vitest");
|
|
|
74
78
|
(0, utils_3.checkFileContents)(`${projectDir}/lib/main.dart`, `options.tracesSampleRate = 1.0;`);
|
|
75
79
|
(0, utils_3.checkFileContents)(`${projectDir}/lib/main.dart`, `options.profilesSampleRate = 1.0;`);
|
|
76
80
|
});
|
|
81
|
+
(0, vitest_1.test)('lib/main.dart enables logs', () => {
|
|
82
|
+
(0, utils_3.checkFileContents)(`${projectDir}/lib/main.dart`, `options.enableLogs = true;`);
|
|
83
|
+
});
|
|
77
84
|
(0, vitest_1.test)('builds correctly', async () => {
|
|
78
85
|
await (0, utils_3.checkIfFlutterBuilds)(projectDir, '✓ Built build/web');
|
|
79
86
|
});
|
|
@@ -96,7 +103,11 @@ const vitest_1 = require("vitest");
|
|
|
96
103
|
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
97
104
|
// "Do you want to enable Session Replay", sometimes doesn't work as `Session Replay` can be printed in bold.
|
|
98
105
|
'to record user interactions and debug issues?'));
|
|
99
|
-
replayOptionPrompted &&
|
|
106
|
+
const logsOptionPrompted = replayOptionPrompted &&
|
|
107
|
+
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER],
|
|
108
|
+
// "Do you want to enable Logs", sometimes doesn't work as `Logs` can be printed in bold.
|
|
109
|
+
'to send your application logs to Sentry?'));
|
|
110
|
+
logsOptionPrompted &&
|
|
100
111
|
(await wizardInstance.sendStdinAndWaitForOutput([utils_1.KEYS.ENTER], 'Successfully installed the Sentry Flutter SDK!'));
|
|
101
112
|
wizardInstance.kill();
|
|
102
113
|
});
|
|
@@ -108,6 +119,9 @@ const vitest_1 = require("vitest");
|
|
|
108
119
|
const fileContent = fs.readFileSync(`${projectDir}/lib/main.dart`, 'utf-8');
|
|
109
120
|
(0, vitest_1.expect)(fileContent).not.toContain(`options.profilesSampleRate = 1.0;`);
|
|
110
121
|
});
|
|
122
|
+
(0, vitest_1.test)('lib/main.dart enables logs', () => {
|
|
123
|
+
(0, utils_3.checkFileContents)(`${projectDir}/lib/main.dart`, `options.enableLogs = true;`);
|
|
124
|
+
});
|
|
111
125
|
});
|
|
112
126
|
});
|
|
113
127
|
//# sourceMappingURL=flutter.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flutter.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/flutter.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,mDAAkD;AAClD,oCAKkB;AAClB,oCAA+C;AAC/C,oCAKkB;AAClB,mCAAqE;AAErE,IAAA,iBAAQ,EAAC,SAAS,EAAE,GAAG,EAAE;IACvB,MAAM,WAAW,GAAG,uBAAW,CAAC,OAAO,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,uCAAuC,CACxC,CAAC;IAEF,IAAA,iBAAQ,EAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;YAEpE,MAAM,qBAAqB,GAAG,MAAM,cAAc,CAAC,aAAa;YAC9D,+FAA+F;YAC/F,+CAA+C,CAChD,CAAC;YAEF,MAAM,uBAAuB,GAC3B,qBAAqB;gBACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB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,CAAC;gBACZ,+FAA+F;gBAC/F,+CAA+C,CAChD,CAAC,CAAC;YAEL,MAAM,oBAAoB,GACxB,qBAAqB;gBACrB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC;gBACZ,6GAA6G;gBAC7G,+CAA+C,CAChD,CAAC,CAAC;YAEL,oBAAoB;gBAClB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,gDAAgD,CACjD,CAAC,CAAC;YAEL,cAAc,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,wEAAwE,EAAE,GAAG,EAAE;YAClF,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CACjC,GAAG,UAAU,gBAAgB,EAC7B,OAAO,CACR,CAAC;YACF,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'node:fs';\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 checkIfFlutterBuilds,\n // checkFileExists,\n checkSentryProperties,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, test } from 'vitest';\n\ndescribe('Flutter', () => {\n const integration = Integration.flutter;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/flutter-test-app',\n );\n\n describe('with apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n const tracingOptionPrompted = await wizardInstance.waitForOutput(\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 profilingOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Profiling\", sometimes doesn't work as `Profiling` can be printed in bold.\n 'to analyze CPU usage and optimize performance-critical code on iOS & macOS?',\n ));\n\n const replayOptionPrompted =\n profilingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Session Replay\", sometimes doesn't work as `Session Replay` can be printed in bold.\n 'to record user interactions and debug issues?',\n ));\n\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('pubspec.yaml is updated.', () => {\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_flutter:`); // dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_dart_plugin:`); // dev_dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry:`); // gradle plugin options\n });\n\n test('sentry.properties exists and has auth token', () => {\n checkSentryProperties(projectDir);\n });\n\n test('.gitignore has sentry.properties', () => {\n checkFileContents(`${projectDir}/.gitignore`, `sentry.properties`);\n });\n\n test('lib/main.dart calls sentry init', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `import 'package:sentry_flutter/sentry_flutter.dart';`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `await SentryFlutter.init(`,\n );\n });\n\n test('lib/main.dart enables tracing and profiling', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.tracesSampleRate = 1.0;`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.profilesSampleRate = 1.0;`,\n );\n });\n\n test('builds correctly', async () => {\n await checkIfFlutterBuilds(projectDir, '✓ Built build/web');\n });\n });\n\n describe('without apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n if (fs.existsSync(`${projectDir}/ios`)) {\n fs.renameSync(`${projectDir}/ios`, `${projectDir}/_ios`);\n }\n if (fs.existsSync(`${projectDir}/macos`)) {\n fs.renameSync(`${projectDir}/macos`, `${projectDir}/_macos`);\n }\n\n const continueOnUncommitedFilesPromted =\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n const tracingOptionPrompted =\n continueOnUncommitedFilesPromted &&\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 Session Replay\", sometimes doesn't work as `Session Replay` can be printed in bold.\n 'to record user interactions and debug issues?',\n ));\n\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('lib/main.dart does not add profiling with missing ios and macos folder', () => {\n const fileContent = fs.readFileSync(\n `${projectDir}/lib/main.dart`,\n 'utf-8',\n );\n expect(fileContent).not.toContain(`options.profilesSampleRate = 1.0;`);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"flutter.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/flutter.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAC9B,gDAAkC;AAClC,mDAAkD;AAClD,oCA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ACzF,0CAA0C,CAC3C,CAAC,CAAC;YAEL,kBAAkB;gBAChB,CAAC,MAAM,cAAc,CAAC,yBAAyB,CAC7C,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,gDAAgD,CACjD,CAAC,CAAC;YAEL,cAAc,CAAC,IAAI,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,wEAAwE,EAAE,GAAG,EAAE;YAClF,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CACjC,GAAG,UAAU,gBAAgB,EAC7B,OAAO,CACR,CAAC;YACF,IAAA,eAAM,EAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAmC,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,4BAA4B,EAAE,GAAG,EAAE;YACtC,IAAA,yBAAiB,EACf,GAAG,UAAU,gBAAgB,EAC7B,4BAA4B,CAC7B,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fs from 'node:fs';\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 checkIfFlutterBuilds,\n // checkFileExists,\n checkSentryProperties,\n} from '../utils';\nimport { afterAll, beforeAll, describe, expect, test } from 'vitest';\n\ndescribe('Flutter', () => {\n const integration = Integration.flutter;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/flutter-test-app',\n );\n\n describe('with apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n const tracingOptionPrompted = await wizardInstance.waitForOutput(\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 profilingOptionPrompted =\n tracingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Profiling\", sometimes doesn't work as `Profiling` can be printed in bold.\n 'to analyze CPU usage and optimize performance-critical code on iOS & macOS?',\n ));\n\n const replayOptionPrompted =\n profilingOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Session Replay\", sometimes doesn't work as `Session Replay` can be printed in bold.\n 'to record user interactions and debug issues?',\n ));\n\n const logsOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n logsOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('pubspec.yaml is updated.', () => {\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_flutter:`); // dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry_dart_plugin:`); // dev_dependencies\n checkFileContents(`${projectDir}/pubspec.yaml`, `sentry:`); // gradle plugin options\n });\n\n test('sentry.properties exists and has auth token', () => {\n checkSentryProperties(projectDir);\n });\n\n test('.gitignore has sentry.properties', () => {\n checkFileContents(`${projectDir}/.gitignore`, `sentry.properties`);\n });\n\n test('lib/main.dart calls sentry init', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `import 'package:sentry_flutter/sentry_flutter.dart';`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `await SentryFlutter.init(`,\n );\n });\n\n test('lib/main.dart enables tracing and profiling', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.tracesSampleRate = 1.0;`,\n );\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.profilesSampleRate = 1.0;`,\n );\n });\n\n test('lib/main.dart enables logs', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.enableLogs = true;`,\n );\n });\n\n test('builds correctly', async () => {\n await checkIfFlutterBuilds(projectDir, '✓ Built build/web');\n });\n });\n\n describe('without apple platforms', () => {\n beforeAll(async () => {\n const wizardInstance = startWizardInstance(integration, projectDir);\n\n if (fs.existsSync(`${projectDir}/ios`)) {\n fs.renameSync(`${projectDir}/ios`, `${projectDir}/_ios`);\n }\n if (fs.existsSync(`${projectDir}/macos`)) {\n fs.renameSync(`${projectDir}/macos`, `${projectDir}/_macos`);\n }\n\n const continueOnUncommitedFilesPromted =\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n const tracingOptionPrompted =\n continueOnUncommitedFilesPromted &&\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 Session Replay\", sometimes doesn't work as `Session Replay` can be printed in bold.\n 'to record user interactions and debug issues?',\n ));\n\n const logsOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n logsOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Successfully installed the Sentry Flutter SDK!',\n ));\n\n wizardInstance.kill();\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n test('lib/main.dart does not add profiling with missing ios and macos folder', () => {\n const fileContent = fs.readFileSync(\n `${projectDir}/lib/main.dart`,\n 'utf-8',\n );\n expect(fileContent).not.toContain(`options.profilesSampleRate = 1.0;`);\n });\n\n test('lib/main.dart enables logs', () => {\n checkFileContents(\n `${projectDir}/lib/main.dart`,\n `options.enableLogs = true;`,\n );\n });\n });\n});\n"]}
|
|
@@ -156,14 +156,15 @@ function checkRemixProject(projectDir, integration, options) {
|
|
|
156
156
|
})`,
|
|
157
157
|
]);
|
|
158
158
|
});
|
|
159
|
-
(0, vitest_1.test)('root file contains Sentry ErrorBoundary', () => {
|
|
159
|
+
(0, vitest_1.test)('root file contains Sentry ErrorBoundary and withSentry wrapper', () => {
|
|
160
160
|
(0, utils_1.checkFileContents)(`${projectDir}/app/root.tsx`, [
|
|
161
|
-
'import { captureRemixErrorBoundaryError } from "@sentry/remix";',
|
|
161
|
+
'import { captureRemixErrorBoundaryError, withSentry } from "@sentry/remix";',
|
|
162
162
|
`export const ErrorBoundary = () => {
|
|
163
163
|
const error = useRouteError();
|
|
164
164
|
captureRemixErrorBoundaryError(error);
|
|
165
165
|
return <div>Something went wrong</div>;
|
|
166
166
|
};`,
|
|
167
|
+
`export default withSentry(App);`,
|
|
167
168
|
]);
|
|
168
169
|
});
|
|
169
170
|
(0, vitest_1.test)('builds successfully', async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remix.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/remix.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAekB;AAClB,mCAA6D;AAE7D,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCvB,CAAC;AAEF,KAAK,UAAU,uBAAuB,CACpC,UAAkB,EAClB,WAAwB,EACxB,kBAGY;IAEZ,MAAM,cA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C,CAAC;IAEH,IAAA,iBAAQ,EAAC,qCAAqC,EAAE,GAAG,EAAE;QACnD,MAAM,WAAW,GAAG,uBAAW,CAAC,KAAK,CAAC;QACtC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAC7B,SAAS,EACT,qCAAqC,CACtC,CAAC;QAEF,IAAA,kBAAS,EAAC,KAAK,IAAI,EAAE;YACnB,MAAM,uBAAuB,CAAC,UAAU,EAAE,WAAW,EAAE,CAAC,UAAU,EAAE,EAAE;gBACpE,IAAA,kBAAU,EAAC,GAAG,UAAU,aAAa,EAAE,eAAe,CAAC,CAAC;gBAExD,IAAA,kBAAU,EAAC,GAAG,UAAU,eAAe,EAAE;oBACvC,gDAAgD,EAC9C,8BAA8B;oBAChC,yBAAyB,EAAE,4BAA4B;iBACxD,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,iBAAQ,EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,iBAAiB,CAAC,UAAU,EAAE,WAAW,EAAE;YACzC,qBAAqB,EAAE,0BAA0B;YACjD,sBAAsB,EAAE,0BAA0B;SACnD,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,iDAAiD,EAAE,GAAG,EAAE;YAC3D,IAAA,yBAAiB,EAAC,GAAG,UAAU,aAAa,EAAE;gBAC5C,wCAAwC;aACzC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n createFile,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\nconst SERVER_TEMPLATE = `import { createRequestHandler } from '@remix-run/express';\nimport { installGlobals } from '@remix-run/node';\nimport compression from 'compression';\nimport express from 'express';\nimport morgan from 'morgan';\n\ninstallGlobals();\n\nconst viteDevServer =\n process.env.NODE_ENV === 'production'\n ? undefined\n : await import('vite').then(vite =>\n vite.createServer({\n server: { middlewareMode: true },\n }),\n );\n\nconst app = express();\n\napp.use(compression());\napp.disable('x-powered-by');\n\nif (viteDevServer) {\n app.use(viteDevServer.middlewares);\n} else {\n app.use('/assets', express.static('build/client/assets', { immutable: true, maxAge: '1y' }));\n}\n\napp.use(express.static('build/client', { maxAge: '1h' }));\napp.use(morgan('tiny'));\n\napp.all(\n '*',\n createRequestHandler({\n build: viteDevServer\n ? () => viteDevServer.ssrLoadModule('virtual:remix/server-build')\n : await import('./build/server/index.js'),\n }),\n);\n\napp.listen(0, () => console.log('Express server listening'));\n`;\n\nasync function runWizardOnRemixProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (\n projectDir: string,\n integration: Integration,\n ) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir);\n let packageManagerPrompted = false;\n\n if (fileModificationFn) {\n fileModificationFn(projectDir, integration);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n }\n\n const tracingOptionPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, 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 timeout: 240_000,\n },\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 logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER, KEYS.ENTER],\n 'Sentry has been successfully configured for your Remix project',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkRemixProject(\n projectDir: string,\n integration: Integration,\n options?: {\n devModeExpectedOutput?: string;\n prodModeExpectedOutput?: string;\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}/app/routes/sentry-example-page.tsx`);\n });\n\n test('instrumentation.server file exists', () => {\n checkFileExists(`${projectDir}/instrumentation.server.mjs`);\n });\n\n test('entry.client file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/app/entry.client.tsx`, [\n 'import { init, replayIntegration, browserTracingIntegration } from \"@sentry/remix\";',\n `init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n})`,\n ]);\n });\n\n test('entry.server file contains Sentry code', () => {\n checkFileContents(`${projectDir}/app/entry.server.tsx`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});`,\n ]);\n });\n\n test('instrumentation.server file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/instrumentation.server.mjs`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true\n})`,\n ]);\n });\n\n test('root file contains Sentry ErrorBoundary', () => {\n checkFileContents(`${projectDir}/app/root.tsx`, [\n 'import { captureRemixErrorBoundaryError } from \"@sentry/remix\";',\n `export const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};`,\n ]);\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n options?.devModeExpectedOutput || 'to expose',\n );\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n options?.prodModeExpectedOutput || '[remix-serve]',\n );\n });\n}\n\ndescribe('Remix', () => {\n describe('with empty project', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration);\n });\n\n describe('with existing custom Express server', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration, (projectDir) => {\n createFile(`${projectDir}/server.mjs`, SERVER_TEMPLATE);\n\n modifyFile(`${projectDir}/package.json`, {\n '\"start\": \"remix-serve ./build/server/index.js\"':\n '\"start\": \"node ./server.mjs\"',\n '\"dev\": \"remix vite:dev\"': '\"dev\": \"node ./server.mjs\"',\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration, {\n devModeExpectedOutput: 'Express server listening',\n prodModeExpectedOutput: 'Express server listening',\n });\n\n test('server.mjs contains instrumentation file import', () => {\n checkFileContents(`${projectDir}/server.mjs`, [\n \"import './instrumentation.server.mjs';\",\n ]);\n });\n });\n});\n"]}
|
|
1
|
+
{"version":3,"file":"remix.test.js","sourceRoot":"","sources":["../../../e2e-tests/tests/remix.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAkC;AAClC,mDAAkD;AAClD,oCAekB;AAClB,mCAA6D;AAE7D,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCvB,CAAC;AAEF,KAAK,UAAU,uBAAuB,CACpC,UAAkB,EAClB,WAAwB,EACxB,kBAGY;IAEZ,MAAM,cAAc,GAAG,IAAA,2BAAmB,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACpE,IAAI,sBAAsB,GAAG,KAAK,CAAC;IAEnC,IAAI,kBAAkB,EAAE;QACtB,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;QAE5C,MAAM,cAAc,CAAC,aAAa,CAAC,iCAAiC,CAAC,CAAC;QAEtE,sBAAsB,GAAG,MAAM,cAAc,CAAC,yBAAyB,CACrE,CAAC,YAAI,CAAC,KAAK,CAAC,EACZ,qCAAqC,CACtC,CAAC;KACH;SAAM;QACL,sBAAsB,GAAG,MAAM,cAAc,CAAC,aAAa,CACzD,qCAAqC,CACtC,CAAC;KACH;IAED,MAAM,qBAAqB,GACzB,sBAAsB;QACtB,CAAC,MAAM,cAAc,CAAC,yBAAyB;QAC7C,0CAA0C;QAC1C,CAAC,YAAI,CAAC,IAAI,EAAE,YAAI,CAAC,KAAK,CAAC;QACvB,+FAA+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EAAC,GAAG,EAAE;YACZ,IAAA,0BAAkB,EAAC,UAAU,CAAC,CAAC;YAC/B,IAAA,kBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,iBAAiB,CAAC,UAAU,EAAE,WAAW,EAAE;YACzC,qBAAqB,EAAE,0BAA0B;YACjD,sBAAsB,EAAE,0BAA0B;SACnD,CAAC,CAAC;QAEH,IAAA,aAAI,EAAC,iDAAiD,EAAE,GAAG,EAAE;YAC3D,IAAA,yBAAiB,EAAC,GAAG,UAAU,aAAa,EAAE;gBAC5C,wCAAwC;aACzC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { Integration } from '../../lib/Constants';\nimport {\n KEYS,\n TEST_ARGS,\n checkEnvBuildPlugin,\n checkFileContents,\n checkFileExists,\n checkIfBuilds,\n checkIfRunsOnDevMode,\n checkIfRunsOnProdMode,\n checkPackageJson,\n cleanupGit,\n createFile,\n modifyFile,\n revertLocalChanges,\n startWizardInstance,\n} from '../utils';\nimport { afterAll, beforeAll, describe, test } from 'vitest';\n\nconst SERVER_TEMPLATE = `import { createRequestHandler } from '@remix-run/express';\nimport { installGlobals } from '@remix-run/node';\nimport compression from 'compression';\nimport express from 'express';\nimport morgan from 'morgan';\n\ninstallGlobals();\n\nconst viteDevServer =\n process.env.NODE_ENV === 'production'\n ? undefined\n : await import('vite').then(vite =>\n vite.createServer({\n server: { middlewareMode: true },\n }),\n );\n\nconst app = express();\n\napp.use(compression());\napp.disable('x-powered-by');\n\nif (viteDevServer) {\n app.use(viteDevServer.middlewares);\n} else {\n app.use('/assets', express.static('build/client/assets', { immutable: true, maxAge: '1y' }));\n}\n\napp.use(express.static('build/client', { maxAge: '1h' }));\napp.use(morgan('tiny'));\n\napp.all(\n '*',\n createRequestHandler({\n build: viteDevServer\n ? () => viteDevServer.ssrLoadModule('virtual:remix/server-build')\n : await import('./build/server/index.js'),\n }),\n);\n\napp.listen(0, () => console.log('Express server listening'));\n`;\n\nasync function runWizardOnRemixProject(\n projectDir: string,\n integration: Integration,\n fileModificationFn?: (\n projectDir: string,\n integration: Integration,\n ) => unknown,\n) {\n const wizardInstance = startWizardInstance(integration, projectDir);\n let packageManagerPrompted = false;\n\n if (fileModificationFn) {\n fileModificationFn(projectDir, integration);\n\n await wizardInstance.waitForOutput('Do you want to continue anyway?');\n\n packageManagerPrompted = await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Please select your package manager.',\n );\n } else {\n packageManagerPrompted = await wizardInstance.waitForOutput(\n 'Please select your package manager.',\n );\n }\n\n const tracingOptionPrompted =\n packageManagerPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n // Selecting `yarn` as the package manager\n [KEYS.DOWN, 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 timeout: 240_000,\n },\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 logOptionPrompted =\n replayOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n // \"Do you want to enable Logs\", sometimes doesn't work as `Logs` can be printed in bold.\n 'to send your application logs to Sentry?',\n ));\n\n logOptionPrompted &&\n (await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER],\n 'Do you want to create an example page',\n {\n optional: true,\n },\n ));\n\n await wizardInstance.sendStdinAndWaitForOutput(\n [KEYS.ENTER, KEYS.ENTER],\n 'Sentry has been successfully configured for your Remix project',\n );\n\n wizardInstance.kill();\n}\n\nfunction checkRemixProject(\n projectDir: string,\n integration: Integration,\n options?: {\n devModeExpectedOutput?: string;\n prodModeExpectedOutput?: string;\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}/app/routes/sentry-example-page.tsx`);\n });\n\n test('instrumentation.server file exists', () => {\n checkFileExists(`${projectDir}/instrumentation.server.mjs`);\n });\n\n test('entry.client file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/app/entry.client.tsx`, [\n 'import { init, replayIntegration, browserTracingIntegration } from \"@sentry/remix\";',\n `init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true,\n\n integrations: [browserTracingIntegration({\n useEffect,\n useLocation,\n useMatches\n }), replayIntegration({\n maskAllText: true,\n blockAllMedia: true\n })],\n\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1\n})`,\n ]);\n });\n\n test('entry.server file contains Sentry code', () => {\n checkFileContents(`${projectDir}/app/entry.server.tsx`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `export const handleError = Sentry.wrapHandleErrorWithSentry((error, { request }) => {\n // Custom handleError implementation\n});`,\n ]);\n });\n\n test('instrumentation.server file contains Sentry initialization', () => {\n checkFileContents(`${projectDir}/instrumentation.server.mjs`, [\n 'import * as Sentry from \"@sentry/remix\";',\n `Sentry.init({\n dsn: \"${TEST_ARGS.PROJECT_DSN}\",\n tracesSampleRate: 1,\n enableLogs: true\n})`,\n ]);\n });\n\n test('root file contains Sentry ErrorBoundary and withSentry wrapper', () => {\n checkFileContents(`${projectDir}/app/root.tsx`, [\n 'import { captureRemixErrorBoundaryError, withSentry } from \"@sentry/remix\";',\n `export const ErrorBoundary = () => {\n const error = useRouteError();\n captureRemixErrorBoundaryError(error);\n return <div>Something went wrong</div>;\n};`,\n `export default withSentry(App);`,\n ]);\n });\n\n test('builds successfully', async () => {\n await checkIfBuilds(projectDir);\n });\n\n test('runs on dev mode correctly', async () => {\n await checkIfRunsOnDevMode(\n projectDir,\n options?.devModeExpectedOutput || 'to expose',\n );\n });\n\n test('runs on prod mode correctly', async () => {\n await checkIfRunsOnProdMode(\n projectDir,\n options?.prodModeExpectedOutput || '[remix-serve]',\n );\n });\n}\n\ndescribe('Remix', () => {\n describe('with empty project', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration);\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration);\n });\n\n describe('with existing custom Express server', () => {\n const integration = Integration.remix;\n const projectDir = path.resolve(\n __dirname,\n '../test-applications/remix-test-app',\n );\n\n beforeAll(async () => {\n await runWizardOnRemixProject(projectDir, integration, (projectDir) => {\n createFile(`${projectDir}/server.mjs`, SERVER_TEMPLATE);\n\n modifyFile(`${projectDir}/package.json`, {\n '\"start\": \"remix-serve ./build/server/index.js\"':\n '\"start\": \"node ./server.mjs\"',\n '\"dev\": \"remix vite:dev\"': '\"dev\": \"node ./server.mjs\"',\n });\n });\n });\n\n afterAll(() => {\n revertLocalChanges(projectDir);\n cleanupGit(projectDir);\n });\n\n checkRemixProject(projectDir, integration, {\n devModeExpectedOutput: 'Express server listening',\n prodModeExpectedOutput: 'Express server listening',\n });\n\n test('server.mjs contains instrumentation file import', () => {\n checkFileContents(`${projectDir}/server.mjs`, [\n \"import './instrumentation.server.mjs';\",\n ]);\n });\n });\n});\n"]}
|
|
@@ -39,6 +39,10 @@ const Sentry = require('@sentry/electron/main');
|
|
|
39
39
|
|
|
40
40
|
Sentry.init({
|
|
41
41
|
dsn: '___DSN___',
|
|
42
|
+
|
|
43
|
+
// Enable sending user PII (Personally Identifiable Information)
|
|
44
|
+
// https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii
|
|
45
|
+
sendDefaultPii: true,
|
|
42
46
|
});`;
|
|
43
47
|
const CODE_EXAMPLE_RENDERER = `// ESM
|
|
44
48
|
import * as Sentry from '@sentry/electron/renderer';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Electron.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Electron.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAE9B,uCAAkC;AAClC,gDAAkC;AAGlC,kDAA8D;AAC9D,sDAAmD;AACnD,uDAAoD;AAGpD,MAAM,2BAA2B,GAAG,QAAQ,CAAC;AAC7C,MAAM,oBAAoB,GAAG,QAAQ,CACnC,2BAA2B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAC/C,EAAE,CACH,CAAC;AAEF,MAAM,iBAAiB,GAAG
|
|
1
|
+
{"version":3,"file":"Electron.js","sourceRoot":"","sources":["../../../../lib/Steps/Integrations/Electron.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA8B;AAE9B,uCAAkC;AAClC,gDAAkC;AAGlC,kDAA8D;AAC9D,sDAAmD;AACnD,uDAAoD;AAGpD,MAAM,2BAA2B,GAAG,QAAQ,CAAC;AAC7C,MAAM,oBAAoB,GAAG,QAAQ,CACnC,2BAA2B,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAC/C,EAAE,CACH,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;IAWtB,CAAC;AAEL,MAAM,qBAAqB,GAAG;;;;;iBAKb,CAAC;AAMlB,IAAI,UAAU,GAAgB,EAAE,CAAC;AAEjC,SAAS,YAAY,CAAC,OAAe,EAAE,KAAK,GAAG,EAAE;IAC/C,IAAI,KAAK,EAAE;QACT,IAAA,WAAC,EAAC,KAAK,CAAC,CAAC;KACV;IAED,IAAA,YAAE,GAAE,CAAC;IACL,IAAA,aAAG,EAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAA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AC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EACtE,EAAE,CACH,CAAC;QAEF,IACE,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,WAAW,CAAC;YACvC,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,WAAW,CAAC,EAC1C;YACA,IAAA,aAAG,EAAC,KAAK,WAAW,6BAA6B,CAAC,CAAC;YACnD,IAAA,aAAG,EAAC,mCAAmC,CAAC,CAAC;YACzC,OAAO,KAAK,CAAC;SACd;QACD,IACE,UAAU;YACV,UAAU,GAAG,oBAAoB;YACjC,aAAa,GAAG,oBAAoB,EACpC;YACA,IAAA,aAAG,EACD,+BAA+B,WAAW,gBAAgB,2BAA2B,SAAS,CAC/F,CAAC;YACF,OAAO,KAAK,CAAC;SACd;QACD,IAAI,UAAU,EAAE;YACd,IAAA,eAAK,EAAC,KAAK,WAAW,MAAM,UAAU,eAAe,CAAC,CAAC;SACxD;aAAM;YACL,IAAA,eAAK,EAAC,KAAK,WAAW,eAAe,CAAC,CAAC;SACxC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3GD,4BA2GC","sourcesContent":["import * as fs from 'node:fs';\nimport type { Answers } from 'inquirer';\nimport { prompt } from 'inquirer';\nimport * as path from 'node:path';\n\nimport type { Args } from '../../Constants';\nimport { dim, green, l, nl, red } from '../../Helper/Logging';\nimport { SentryCli } from '../../Helper/SentryCli';\nimport { BaseIntegration } from './BaseIntegration';\nimport { Config } from '../../Types';\n\nconst MIN_ELECTRON_VERSION_STRING = '23.0.0';\nconst MIN_ELECTRON_VERSION = parseInt(\n MIN_ELECTRON_VERSION_STRING.replace(/\\D+/g, ''),\n 10,\n);\n\nconst CODE_EXAMPLE_MAIN = `// ESM\nimport * as Sentry from '@sentry/electron/main';\n// CommonJs\nconst Sentry = require('@sentry/electron/main');\n\nSentry.init({\n dsn: '___DSN___',\n\n // Enable sending user PII (Personally Identifiable Information)\n // https://docs.sentry.io/platforms/javascript/guides/sveltekit/configuration/options/#sendDefaultPii\n sendDefaultPii: true,\n});`;\n\nconst CODE_EXAMPLE_RENDERER = `// ESM\nimport * as Sentry from '@sentry/electron/renderer';\n// CommonJs\nconst Sentry = require('@sentry/electron/renderer');\n\nSentry.init({});`;\n\ntype PackageJSON = {\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n};\nlet appPackage: PackageJSON = {};\n\nfunction printExample(example: string, title = ''): void {\n if (title) {\n l(title);\n }\n\n nl();\n dim(example.replace(/^/gm, ' '));\n nl();\n}\n\ntry {\n appPackage = JSON.parse(\n fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8'),\n ) as PackageJSON;\n} catch {\n // We don't need to have this\n}\n\nexport class Electron extends BaseIntegration {\n protected _sentryCli: SentryCli;\n\n public constructor(protected _argv: Args) {\n super(_argv);\n this._sentryCli = new SentryCli(this._argv);\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n public async emit(answers: Answers & { config?: Config }): Promise<Answers> {\n const dsn = answers.config?.dsn?.public ?? 'DSN NOT FOUND';\n nl();\n\n const sentryCliProps = this._sentryCli.convertAnswersToProperties(answers);\n fs.writeFileSync(\n './sentry.properties',\n this._sentryCli.dumpProperties(sentryCliProps),\n );\n green('Successfully created sentry.properties');\n nl();\n\n printExample(\n CODE_EXAMPLE_MAIN.replace('___DSN___', dsn),\n 'Add these lines in to your main process code to setup Sentry:',\n );\n\n printExample(\n CODE_EXAMPLE_RENDERER,\n 'Add these lines in to your renderer processes code to setup Sentry:',\n );\n\n l('For more information, see https://docs.sentry.io/clients/electron/');\n nl();\n\n return {};\n }\n\n public async shouldConfigure(_answers: Answers): Promise<Answers> {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n if (this._shouldConfigure) {\n return this._shouldConfigure;\n }\n\n let success = true;\n nl();\n\n success =\n this._checkDep('electron', MIN_ELECTRON_VERSION_STRING) && success;\n success = this._checkDep('@sentry/electron') && success;\n\n let continued: Answers = { continue: true };\n if (!success && !this._argv.quiet) {\n continued = await prompt({\n message:\n 'There were errors during your project checkup, do you still want to continue?',\n name: 'continue',\n default: false,\n type: 'confirm',\n });\n }\n\n nl();\n\n if (!continued?.continue) {\n throw new Error('Please install the required dependencies to continue.');\n }\n\n this._shouldConfigure = Promise.resolve({ electron: true });\n // eslint-disable-next-line @typescript-eslint/unbound-method\n return this.shouldConfigure;\n }\n\n private _checkDep(packageName: string, minVersion?: string): boolean {\n const depVersion = parseInt(\n (appPackage.dependencies?.[packageName] || '0').replace(/\\D+/g, ''),\n 10,\n );\n const devDepVersion = parseInt(\n (appPackage.devDependencies?.[packageName] || '0').replace(/\\D+/g, ''),\n 10,\n );\n\n if (\n !appPackage.dependencies?.[packageName] &&\n !appPackage.devDependencies?.[packageName]\n ) {\n red(`✗ ${packageName} isn't in your dependencies`);\n red(' please install it with yarn/npm');\n return false;\n }\n if (\n minVersion &&\n depVersion < MIN_ELECTRON_VERSION &&\n devDepVersion < MIN_ELECTRON_VERSION\n ) {\n red(\n `✗ Your installed version of ${packageName} is to old, >${MIN_ELECTRON_VERSION_STRING} needed`,\n );\n return false;\n }\n if (minVersion) {\n green(`✓ ${packageName} > ${minVersion} is installed`);\n } else {\n green(`✓ ${packageName} is installed`);\n }\n return true;\n }\n}\n"]}
|
|
@@ -110,7 +110,7 @@ Apologies for the inconvenience!`);
|
|
|
110
110
|
const sdkAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('@sentry/angular', packageJson);
|
|
111
111
|
Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);
|
|
112
112
|
await (0, clack_1.installPackage)({
|
|
113
|
-
packageName: '@sentry/angular@^
|
|
113
|
+
packageName: '@sentry/angular@^10',
|
|
114
114
|
packageNameDisplayLabel: '@sentry/angular',
|
|
115
115
|
alreadyInstalled: sdkAlreadyInstalled,
|
|
116
116
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-wizard.js","sourceRoot":"","sources":["../../../src/angular/angular-wizard.ts"],"names":[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,EAAE,CACT,MAAM,IAAA,0CAAsB,EAAC;YAC3B,GAAG,EAAE,SAAS;YACd,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;YAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;SAC9B,CAAC,CACL,CAAC;KACH;IAED,MAAM,IAAA,qBAAS,EAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,iBAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,iBAAiB,CAAC,uBAAgC;IAChE,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAE1E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,UAAU,CACX,mDAAmD,CAAC;KACtD;IAED,GAAG,IAAI;4DACmD,CAAC;IAE3D,OAAO,GAAG,CAAC;AACb,CAAC;AAbD,8CAaC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nimport chalk from 'chalk';\nimport type { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldCreateExampleComponent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n abort,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { gte, minVersion, SemVer } from 'semver';\n\nimport * as Sentry from '@sentry/node';\nimport { initializeSentryOnApplicationEntry } from './sdk-setup';\nimport { updateAppConfig } from './sdk-setup';\nimport { runSourcemapsWizard } from '../sourcemaps/sourcemaps-wizard';\nimport { addSourcemapEntryToAngularJSON } from './codemods/sourcemaps';\nimport { createExampleComponent } from './example-component';\n\nconst MIN_SUPPORTED_ANGULAR_VERSION = '14.0.0';\nconst MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = '17.0.0';\n\nexport async function runAngularWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'angular',\n wizardOptions: options,\n },\n () => runAngularWizardWithTelemetry(options),\n );\n}\n\nasync function runAngularWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Angular Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@angular/core', 'Angular');\n\n let installedAngularVersion = getPackageVersion('@angular/core', packageJson);\n\n if (!installedAngularVersion) {\n clack.log.warn('Could not determine installed Angular version.');\n\n installedAngularVersion = await abortIfCancelled(\n clack.text({\n message: `Please enter your installed Angular major version (e.g. ${chalk.cyan(\n '18',\n )} for Angular 18)`,\n validate(value) {\n if (!value) {\n return 'Angular version is required';\n }\n\n try {\n if (!minVersion(value)) {\n return `Invalid Angular version provided: ${value}`;\n }\n } catch (error) {\n return `Invalid Angular version provided: ${value}`;\n }\n },\n }),\n );\n }\n\n Sentry.setTag('angular-version', installedAngularVersion);\n\n const installedMinVersion = minVersion(installedAngularVersion) as SemVer;\n\n const sdkSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_ANGULAR_VERSION,\n );\n\n const wizardSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n );\n\n if (!sdkSupportsAngularVersion) {\n Sentry.setTag('angular-version-compatible', false);\n\n clack.log.warn(\n `Angular version ${chalk.cyan(\n MIN_SUPPORTED_ANGULAR_VERSION,\n )} or higher is required for the Sentry SDK.`,\n );\n clack.log.warn(\n `Please refer to Sentry's version compatibility table for more information:\n\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility',\n)}\n`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n if (!wizardSupportsAngularVersion) {\n Sentry.setTag('angular-wizard-version-compatible', false);\n\n clack.log.warn(\n `The Sentry Angular Wizard requires Angular version ${chalk.cyan(\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n )} or higher.`,\n );\n clack.log.warn(\n `Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:\n\n${chalk.underline('https://docs.sentry.io/platforms/javascript/guides/angular')}\n\nApologies for the inconvenience!`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-angular');\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/angular',\n packageJson,\n );\n\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/angular@^9',\n packageNameDisplayLabel: '@sentry/angular',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'recommended',\n },\n ] as const);\n\n await traceStep(\n 'Initialize Sentry on Angular application entry point',\n async () => {\n await initializeSentryOnApplicationEntry(dsn, selectedFeatures);\n },\n );\n\n await traceStep('Update Angular project configuration', async () => {\n await updateAppConfig(installedMinVersion, selectedFeatures.performance);\n });\n\n await traceStep('Setup for sourcemap uploads', async () => {\n await addSourcemapEntryToAngularJSON();\n\n if (!options.preSelectedProject) {\n options.preSelectedProject = {\n authToken,\n selfHosted,\n project: {\n organization: {\n id: selectedProject.organization.id,\n name: selectedProject.organization.name,\n slug: selectedProject.organization.slug,\n },\n id: selectedProject.id,\n slug: selectedProject.slug,\n keys: [\n {\n dsn: {\n public: dsn,\n },\n },\n ],\n },\n };\n\n options.url = sentryUrl;\n }\n\n await runSourcemapsWizard(options, 'angular');\n });\n\n const shouldCreateExampleComponent = await askShouldCreateExampleComponent();\n\n Sentry.setTag('create-example-component', shouldCreateExampleComponent);\n\n if (shouldCreateExampleComponent) {\n await traceStep(\n 'create-example-component',\n async () =>\n await createExampleComponent({\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n }\n\n await traceStep('Run Prettier', async () => {\n await runPrettierIfInstalled({ cwd: undefined });\n });\n\n clack.outro(buildOutroMessage(shouldCreateExampleComponent));\n}\n\nexport function buildOutroMessage(createdExampleComponent: boolean): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Angular SDK!');\n\n if (createdExampleComponent) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n 'ng serve',\n )}) and throwing an error in the example component.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/angular/`;\n\n return msg;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"angular-wizard.js","sourceRoot":"","sources":["../../../src/angular/angular-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AAEnC,kDAA0B;AAE1B,4CAAwD;AACxD,0CAYwB;AACxB,wDAA+E;AAC/E,mCAAiD;AAEjD,qDAAuC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ACL,CAAC;KACH;IAED,MAAM,IAAA,qBAAS,EAAC,cAAc,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,IAAA,8BAAsB,EAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,iBAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,CAAC,CAAC;AAC/D,CAAC;AAED,SAAgB,iBAAiB,CAAC,uBAAgC;IAChE,IAAI,GAAG,GAAG,eAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAAC;IAE1E,IAAI,uBAAuB,EAAE;QAC3B,GAAG,IAAI,qEAAqE,eAAK,CAAC,IAAI,CACpF,UAAU,CACX,mDAAmD,CAAC;KACtD;IAED,GAAG,IAAI;4DACmD,CAAC;IAE3D,OAAO,GAAG,CAAC;AACb,CAAC;AAbD,8CAaC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nimport chalk from 'chalk';\nimport type { WizardOptions } from '../utils/types';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport {\n abortIfCancelled,\n askShouldCreateExampleComponent,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n featureSelectionPrompt,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n printWelcome,\n runPrettierIfInstalled,\n abort,\n} from '../utils/clack';\nimport { getPackageVersion, hasPackageInstalled } from '../utils/package-json';\nimport { gte, minVersion, SemVer } from 'semver';\n\nimport * as Sentry from '@sentry/node';\nimport { initializeSentryOnApplicationEntry } from './sdk-setup';\nimport { updateAppConfig } from './sdk-setup';\nimport { runSourcemapsWizard } from '../sourcemaps/sourcemaps-wizard';\nimport { addSourcemapEntryToAngularJSON } from './codemods/sourcemaps';\nimport { createExampleComponent } from './example-component';\n\nconst MIN_SUPPORTED_ANGULAR_VERSION = '14.0.0';\nconst MIN_SUPPORTED_WIZARD_ANGULAR_VERSION = '17.0.0';\n\nexport async function runAngularWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'angular',\n wizardOptions: options,\n },\n () => runAngularWizardWithTelemetry(options),\n );\n}\n\nasync function runAngularWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Angular Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: undefined,\n });\n\n const packageJson = await getPackageDotJson();\n\n await ensurePackageIsInstalled(packageJson, '@angular/core', 'Angular');\n\n let installedAngularVersion = getPackageVersion('@angular/core', packageJson);\n\n if (!installedAngularVersion) {\n clack.log.warn('Could not determine installed Angular version.');\n\n installedAngularVersion = await abortIfCancelled(\n clack.text({\n message: `Please enter your installed Angular major version (e.g. ${chalk.cyan(\n '18',\n )} for Angular 18)`,\n validate(value) {\n if (!value) {\n return 'Angular version is required';\n }\n\n try {\n if (!minVersion(value)) {\n return `Invalid Angular version provided: ${value}`;\n }\n } catch (error) {\n return `Invalid Angular version provided: ${value}`;\n }\n },\n }),\n );\n }\n\n Sentry.setTag('angular-version', installedAngularVersion);\n\n const installedMinVersion = minVersion(installedAngularVersion) as SemVer;\n\n const sdkSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_ANGULAR_VERSION,\n );\n\n const wizardSupportsAngularVersion = gte(\n installedMinVersion,\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n );\n\n if (!sdkSupportsAngularVersion) {\n Sentry.setTag('angular-version-compatible', false);\n\n clack.log.warn(\n `Angular version ${chalk.cyan(\n MIN_SUPPORTED_ANGULAR_VERSION,\n )} or higher is required for the Sentry SDK.`,\n );\n clack.log.warn(\n `Please refer to Sentry's version compatibility table for more information:\n\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/angular/#angular-version-compatibility',\n)}\n`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n if (!wizardSupportsAngularVersion) {\n Sentry.setTag('angular-wizard-version-compatible', false);\n\n clack.log.warn(\n `The Sentry Angular Wizard requires Angular version ${chalk.cyan(\n MIN_SUPPORTED_WIZARD_ANGULAR_VERSION,\n )} or higher.`,\n );\n clack.log.warn(\n `Your Angular version (${installedAngularVersion}) is compatible with the Sentry SDK but you need to set it up manually by following our documentation:\n\n${chalk.underline('https://docs.sentry.io/platforms/javascript/guides/angular')}\n\nApologies for the inconvenience!`,\n );\n\n return abort('Exiting the wizard.', 0);\n }\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-angular');\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const sdkAlreadyInstalled = hasPackageInstalled(\n '@sentry/angular',\n packageJson,\n );\n\n Sentry.setTag('sdk-already-installed', sdkAlreadyInstalled);\n\n await installPackage({\n packageName: '@sentry/angular@^10',\n packageNameDisplayLabel: '@sentry/angular',\n alreadyInstalled: sdkAlreadyInstalled,\n });\n\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'recommended',\n },\n ] as const);\n\n await traceStep(\n 'Initialize Sentry on Angular application entry point',\n async () => {\n await initializeSentryOnApplicationEntry(dsn, selectedFeatures);\n },\n );\n\n await traceStep('Update Angular project configuration', async () => {\n await updateAppConfig(installedMinVersion, selectedFeatures.performance);\n });\n\n await traceStep('Setup for sourcemap uploads', async () => {\n await addSourcemapEntryToAngularJSON();\n\n if (!options.preSelectedProject) {\n options.preSelectedProject = {\n authToken,\n selfHosted,\n project: {\n organization: {\n id: selectedProject.organization.id,\n name: selectedProject.organization.name,\n slug: selectedProject.organization.slug,\n },\n id: selectedProject.id,\n slug: selectedProject.slug,\n keys: [\n {\n dsn: {\n public: dsn,\n },\n },\n ],\n },\n };\n\n options.url = sentryUrl;\n }\n\n await runSourcemapsWizard(options, 'angular');\n });\n\n const shouldCreateExampleComponent = await askShouldCreateExampleComponent();\n\n Sentry.setTag('create-example-component', shouldCreateExampleComponent);\n\n if (shouldCreateExampleComponent) {\n await traceStep(\n 'create-example-component',\n async () =>\n await createExampleComponent({\n url: sentryUrl,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n }),\n );\n }\n\n await traceStep('Run Prettier', async () => {\n await runPrettierIfInstalled({ cwd: undefined });\n });\n\n clack.outro(buildOutroMessage(shouldCreateExampleComponent));\n}\n\nexport function buildOutroMessage(createdExampleComponent: boolean): string {\n let msg = chalk.green('\\nSuccessfully installed the Sentry Angular SDK!');\n\n if (createdExampleComponent) {\n msg += `\\n\\nYou can validate your setup by starting your dev environment (${chalk.cyan(\n 'ng serve',\n )}) and throwing an error in the example component.`;\n }\n\n msg += `\\n\\nCheck out the SDK documentation for further configuration:\nhttps://docs.sentry.io/platforms/javascript/guides/angular/`;\n\n return msg;\n}\n"]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.runAppleWizard = void 0;
|
|
7
7
|
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
8
8
|
const prompts_1 = __importDefault(require("@clack/prompts"));
|
|
9
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
10
|
const telemetry_1 = require("../telemetry");
|
|
10
11
|
const clack_1 = require("../utils/clack");
|
|
11
12
|
const check_installed_cli_1 = require("./check-installed-cli");
|
|
@@ -62,11 +63,20 @@ async function runAppleWizardWithTelementry(options) {
|
|
|
62
63
|
target,
|
|
63
64
|
shouldUseSPM,
|
|
64
65
|
});
|
|
66
|
+
// Step - Feature Selection
|
|
67
|
+
const selectedFeatures = await (0, clack_1.featureSelectionPrompt)([
|
|
68
|
+
{
|
|
69
|
+
id: 'logs',
|
|
70
|
+
prompt: `Do you want to enable ${chalk_1.default.bold('Logs')} to send your application logs to Sentry?`,
|
|
71
|
+
enabledHint: 'optional',
|
|
72
|
+
},
|
|
73
|
+
]);
|
|
65
74
|
// Step - Add Code Snippet
|
|
66
75
|
(0, inject_code_snippet_1.injectCodeSnippet)({
|
|
67
76
|
project: xcProject,
|
|
68
77
|
target,
|
|
69
78
|
dsn: selectedProject.keys[0].dsn.public,
|
|
79
|
+
enableLogs: selectedFeatures.logs ?? false,
|
|
70
80
|
});
|
|
71
81
|
// Step - Fastlane Configuration
|
|
72
82
|
await (0, configure_fastlane_1.configureFastlane)({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;
|
|
1
|
+
{"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,kDAA0B;AAE1B,4CAA6C;AAC7C,0CAKwB;AACxB,+DAA0D;AAC1D,6DAAyD;AACzD,2EAAsE;AACtE,iEAA4D;AAC5D,uEAAkE;AAClE,+DAA0D;AAC1D,iEAA4D;AAGrD,KAAK,UAAU,cAAc,CAClC,OAA2B;IAE3B,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;AAXD,wCAWC;AAED,KAAK,UAAU,4BAA4B,CACzC,OAA2B;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iB,EAAC;QAChB,OAAO,EAAE,SAAS;QAClB,MAAM;QACN,GAAG,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM;QACvC,UAAU,EAAE,gBAAgB,CAAC,IAAI,IAAI,KAAK;KAC3C,CAAC,CAAC;IAEH,gCAAgC;IAChC,MAAM,IAAA,sCAAiB,EAAC;QACtB,UAAU;QACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;QAC1C,WAAW,EAAE,eAAe,CAAC,IAAI;KAClC,CAAC,CAAC;IAEH,iBAAK,CAAC,GAAG,CAAC,OAAO,CACf,gKAAgK,CACjK,CAAC;AACJ,CAAC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport { withTelemetry } from '../telemetry';\nimport {\n confirmContinueIfNoOrDirtyGitRepo,\n featureSelectionPrompt,\n getOrAskForProjectData,\n printWelcome,\n} from '../utils/clack';\nimport { checkInstalledCLI } from './check-installed-cli';\nimport { configureFastlane } from './configure-fastlane';\nimport { configurePackageManager } from './configure-package-manager';\nimport { configureSentryCLI } from './configure-sentry-cli';\nimport { configureXcodeProject } from './configure-xcode-project';\nimport { injectCodeSnippet } from './inject-code-snippet';\nimport { lookupXcodeProject } from './lookup-xcode-project';\nimport { AppleWizardOptions } from './options';\n\nexport async function runAppleWizard(\n options: AppleWizardOptions,\n): 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: AppleWizardOptions,\n): Promise<void> {\n // Define options with defaults\n const projectDir = options.projectDir ?? process.cwd();\n\n // Step - Welcome Message\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n // Step - Git Status Check\n await confirmContinueIfNoOrDirtyGitRepo({\n ignoreGitChanges: options.ignoreGitChanges,\n cwd: projectDir,\n });\n\n // Step - Sentry CLI Check\n await checkInstalledCLI();\n\n // Step - Xcode Project Lookup\n // This step should be run before the Sentry Project and API Key step\n // because it can abort the wizard if no Xcode project is found.\n const { xcProject, target } = await lookupXcodeProject({\n projectDir,\n });\n\n // Step - Sentry Project and API Key\n const { selectedProject, authToken } = await getOrAskForProjectData(\n options,\n 'apple-ios',\n );\n\n // Step - Sentry CLI Configuration Setup\n configureSentryCLI({\n projectDir,\n authToken: authToken,\n });\n\n // Step - Set up Package Manager\n const { shouldUseSPM } = await configurePackageManager({\n projectDir,\n });\n\n // Step - Configure Xcode Project\n configureXcodeProject({\n xcProject,\n project: selectedProject,\n target,\n shouldUseSPM,\n });\n\n // Step - Feature Selection\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'logs',\n prompt: `Do you want to enable ${chalk.bold(\n 'Logs',\n )} to send your application logs to Sentry?`,\n enabledHint: 'optional',\n },\n ]);\n\n // Step - Add Code Snippet\n injectCodeSnippet({\n project: xcProject,\n target,\n dsn: selectedProject.keys[0].dsn.public,\n enableLogs: selectedFeatures.logs ?? false,\n });\n\n // Step - Fastlane Configuration\n await configureFastlane({\n projectDir,\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\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"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
declare function isAppDelegateFile(filePath: string): boolean;
|
|
2
2
|
declare function findAppDidFinishLaunchingWithOptionsInDirectory(dir: string): string | null;
|
|
3
3
|
declare function findAppDidFinishLaunchingWithOptions(files: string[]): string | null;
|
|
4
|
-
export declare function addCodeSnippetToProject(files: string[], dsn: string): boolean;
|
|
4
|
+
export declare function addCodeSnippetToProject(files: string[], dsn: string, enableLogs: boolean): boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Exported for testing purposes, but should not be used in other modules.
|
|
7
7
|
*/
|
|
@@ -80,7 +80,7 @@ function findAppDidFinishLaunchingWithOptions(files) {
|
|
|
80
80
|
}
|
|
81
81
|
return null;
|
|
82
82
|
}
|
|
83
|
-
function addCodeSnippetToProject(files, dsn) {
|
|
83
|
+
function addCodeSnippetToProject(files, dsn, enableLogs) {
|
|
84
84
|
const appDelegate = findAppDidFinishLaunchingWithOptions(files);
|
|
85
85
|
if (!appDelegate) {
|
|
86
86
|
return false;
|
|
@@ -91,8 +91,8 @@ function addCodeSnippetToProject(files, dsn) {
|
|
|
91
91
|
const importStatement = isSwift ? 'import Sentry\n' : '@import Sentry;\n';
|
|
92
92
|
const checkForSentryInit = isSwift ? 'SentrySDK.start' : '[SentrySDK start';
|
|
93
93
|
let codeSnippet = isSwift
|
|
94
|
-
? templates.getSwiftSnippet(dsn)
|
|
95
|
-
: templates.getObjcSnippet(dsn);
|
|
94
|
+
? templates.getSwiftSnippet(dsn, enableLogs)
|
|
95
|
+
: templates.getObjcSnippet(dsn, enableLogs);
|
|
96
96
|
Sentry.setTag('code-language', isSwift ? 'swift' : 'objc');
|
|
97
97
|
Sentry.setTag('ui-engine', swiftUIRegex.test(fileContent) ? 'swiftui' : 'uikit');
|
|
98
98
|
if (fileContent.includes(checkForSentryInit)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tools.js","sourceRoot":"","sources":["../../../src/apple/code-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,uCAAyB;AACzB,2CAA6B;AAC7B,uDAAyC;AACzC,+EAA+E;AAC/E,sDAAwC;AACxC,0CAAuC;AAEvC,MAAM,mBAAmB,GACvB,mNAAmN,CAAC;AACtN,MAAM,kBAAkB,GACtB,qKAAqK,CAAC;AACxK,MAAM,YAAY,GAAG,8CAA8C,CAAC;AAEpE,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAA,aAAK,EAAC,cAAc,GAAG,QAAQ,GAAG,yBAAyB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AW,EAAE;YACf,MAAM,WAAW,GAAG,WAAW,CAAC,KAAK,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YAC9D,cAAc;gBACZ,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;oBACpC,IAAI;oBACJ,eAAe;oBACf,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SACrC;aAAM;YACL,cAAc,GAAG,eAAe,GAAG,cAAc,CAAC;SACnD;KACF;IAED,EAAE,CAAC,aAAa,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IAEtD,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,8CAA8C,GAAG,WAAW,CAAC,CAAC;IAC7E,OAAO,IAAI,CAAC;AACd,CAAC;AAtED,0DAsEC;AAUD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;IACnC,wBAAgB,GAAG;QACjB,iBAAiB;QACjB,+CAA+C;QAC/C,oCAAoC;KACrC,CAAC;CACH","sourcesContent":["import * as Sentry from '@sentry/node';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport * as templates from './templates';\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { debug } from '../utils/debug';\n\nconst swiftAppLaunchRegex =\n /(func\\s+application\\s*\\(\\s*_\\s+application:\\s*[^,]+,\\s*didFinishLaunchingWithOptions[^,]+:\\s*[^)]+\\s*\\)\\s+->\\s+Bool\\s+{)|func\\s+applicationDidFinishLaunching\\s*\\(\\s*_\\s+aNotification:\\s+Notification\\s*\\)\\s*{/im;\nconst objcAppLaunchRegex =\n /-\\s*\\(\\s*BOOL\\s*\\)\\s*application:\\s*\\(\\s*UIApplication\\s*\\*\\s*\\)\\s*application\\s+didFinishLaunchingWithOptions:\\s*\\(\\s*NSDictionary\\s*\\*\\s*\\)\\s*launchOptions\\s*{/im;\nconst swiftUIRegex = /@main\\s+struct[^:]+:\\s*(SwiftUI\\.)?App\\s*{/im;\n\nfunction isAppDelegateFile(filePath: string): boolean {\n debug('Checking if ' + filePath + ' is an AppDelegate file');\n const appLaunchRegex = filePath.toLowerCase().endsWith('.swift')\n ? swiftAppLaunchRegex\n : objcAppLaunchRegex;\n\n const fileContent = fs.readFileSync(filePath, 'utf8');\n return appLaunchRegex.test(fileContent) || swiftUIRegex.test(fileContent);\n}\n\nfunction findAppDidFinishLaunchingWithOptionsInDirectory(\n dir: string,\n): string | null {\n debug('Searching for AppDelegate in directory: ' + dir);\n const files = fs.readdirSync(dir);\n const filePaths = files.map((f) => path.join(dir, f));\n return findAppDidFinishLaunchingWithOptions(filePaths);\n}\n\nfunction findAppDidFinishLaunchingWithOptions(files: string[]): string | null {\n debug(`Searching for AppDelegate in ${files.length} files`);\n\n // Iterate over subdirectories after iterating over files,\n // because the AppDelegate is usually in the top level\n const dirs: string[] = [];\n for (const filePath of files) {\n debug('Checking file: ' + filePath);\n if (\n filePath.endsWith('.swift') ||\n filePath.endsWith('.m') ||\n filePath.endsWith('.mm')\n ) {\n if (fs.existsSync(filePath) && isAppDelegateFile(filePath)) {\n debug('Found AppDelegate in ' + filePath);\n return filePath;\n }\n } else if (\n !path.basename(filePath).startsWith('.') &&\n !filePath.endsWith('.xcodeproj') &&\n !filePath.endsWith('.xcassets') &&\n fs.existsSync(filePath) &&\n fs.lstatSync(filePath).isDirectory()\n ) {\n dirs.push(filePath);\n }\n }\n\n for (const dr of dirs) {\n const result = findAppDidFinishLaunchingWithOptionsInDirectory(dr);\n if (result) {\n debug('Found AppDelegate in ' + dr);\n return result;\n }\n }\n return null;\n}\n\nexport function addCodeSnippetToProject(\n files: string[],\n dsn: string,\n enableLogs: boolean,\n): boolean {\n const appDelegate = findAppDidFinishLaunchingWithOptions(files);\n if (!appDelegate) {\n return false;\n }\n\n const fileContent = fs.readFileSync(appDelegate, 'utf8');\n const isSwift = appDelegate.toLowerCase().endsWith('.swift');\n const appLaunchRegex = isSwift ? swiftAppLaunchRegex : objcAppLaunchRegex;\n const importStatement = isSwift ? 'import Sentry\\n' : '@import Sentry;\\n';\n const checkForSentryInit = isSwift ? 'SentrySDK.start' : '[SentrySDK start';\n let codeSnippet = isSwift\n ? templates.getSwiftSnippet(dsn, enableLogs)\n : templates.getObjcSnippet(dsn, enableLogs);\n\n Sentry.setTag('code-language', isSwift ? 'swift' : 'objc');\n Sentry.setTag(\n 'ui-engine',\n swiftUIRegex.test(fileContent) ? 'swiftui' : 'uikit',\n );\n\n if (fileContent.includes(checkForSentryInit)) {\n //already initialized\n clack.log.info(\n 'Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.',\n );\n return true;\n }\n\n let match = appLaunchRegex.exec(fileContent);\n if (!match) {\n const swiftUIMatch = swiftUIRegex.exec(fileContent);\n if (!swiftUIMatch) {\n // This branch is not reached, because we already checked for SwiftUI in isAppDelegateFile\n return false;\n }\n //Is SwiftUI with no init\n match = swiftUIMatch;\n codeSnippet = ` init() {\\n${codeSnippet} }`;\n }\n\n const insertIndex = match.index + match[0].length;\n let newFileContent =\n fileContent.slice(0, insertIndex) +\n '\\n' +\n codeSnippet +\n fileContent.slice(insertIndex);\n\n if (newFileContent.indexOf(importStatement) < 0) {\n const firstImport = /^[ \\t]*import +\\w+.*$/m.exec(newFileContent);\n if (firstImport) {\n const importIndex = firstImport.index + firstImport[0].length;\n newFileContent =\n newFileContent.slice(0, importIndex) +\n '\\n' +\n importStatement +\n newFileContent.slice(importIndex);\n } else {\n newFileContent = importStatement + newFileContent;\n }\n }\n\n fs.writeFileSync(appDelegate, newFileContent, 'utf8');\n\n clack.log.step('Added Sentry initialization code snippet to ' + appDelegate);\n return true;\n}\n\n/**\n * Exported for testing purposes, but should not be used in other modules.\n */\nexport let exportForTesting: {\n isAppDelegateFile: typeof isAppDelegateFile;\n findAppDidFinishLaunchingWithOptionsInDirectory: typeof findAppDidFinishLaunchingWithOptionsInDirectory;\n findAppDidFinishLaunchingWithOptions: typeof findAppDidFinishLaunchingWithOptions;\n};\nif (process.env.NODE_ENV === 'test') {\n exportForTesting = {\n isAppDelegateFile,\n findAppDidFinishLaunchingWithOptionsInDirectory,\n findAppDidFinishLaunchingWithOptions,\n };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { XcodeProject } from './xcode-manager';
|
|
2
|
-
export declare function injectCodeSnippet({ project, target, dsn, }: {
|
|
2
|
+
export declare function injectCodeSnippet({ project, target, dsn, enableLogs, }: {
|
|
3
3
|
project: XcodeProject;
|
|
4
4
|
target: string;
|
|
5
5
|
dsn: string;
|
|
6
|
+
enableLogs: boolean;
|
|
6
7
|
}): void;
|
|
@@ -34,7 +34,7 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
34
34
|
const telemetry_1 = require("../telemetry");
|
|
35
35
|
const debug_1 = require("../utils/debug");
|
|
36
36
|
const codeTools = __importStar(require("./code-tools"));
|
|
37
|
-
function injectCodeSnippet({ project, target, dsn, }) {
|
|
37
|
+
function injectCodeSnippet({ project, target, dsn, enableLogs, }) {
|
|
38
38
|
(0, debug_1.debug)(`Injecting code snippet into project at path: ${chalk_1.default.cyan(project.baseDir)}`);
|
|
39
39
|
const codeAdded = (0, telemetry_1.traceStep)('Add code snippet', () => {
|
|
40
40
|
const files = project.getSourceFilesForTarget(target);
|
|
@@ -44,7 +44,7 @@ function injectCodeSnippet({ project, target, dsn, }) {
|
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
(0, debug_1.debug)(`Adding code snippet to ${files.length} candidate files`);
|
|
47
|
-
return codeTools.addCodeSnippetToProject(files, dsn);
|
|
47
|
+
return codeTools.addCodeSnippetToProject(files, dsn, enableLogs);
|
|
48
48
|
});
|
|
49
49
|
Sentry.setTag('Snippet-Added', codeAdded);
|
|
50
50
|
(0, debug_1.debug)(`Snippet added: ${chalk_1.default.cyan(codeAdded.toString())}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inject-code-snippet.js","sourceRoot":"","sources":["../../../src/apple/inject-code-snippet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,qDAAuC;AACvC,kDAA0B;AAC1B,4CAAyC;AACzC,0CAAuC;AACvC,wDAA0C;AAG1C,SAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,GAAG,
|
|
1
|
+
{"version":3,"file":"inject-code-snippet.js","sourceRoot":"","sources":["../../../src/apple/inject-code-snippet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,6DAAmC;AACnC,qDAAuC;AACvC,kDAA0B;AAC1B,4CAAyC;AACzC,0CAAuC;AACvC,wDAA0C;AAG1C,SAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,GAAG,EACH,UAAU,GAMX;IACC,IAAA,aAAK,EACH,gDAAgD,eAAK,CAAC,IAAI,CACxD,OAAO,CAAC,OAAO,CAChB,EAAE,CACJ,CAAC;IACF,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,kBAAkB,EAAE,GAAG,EAAE;QACnD,MAAM,KAAK,GAAG,OAAO,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACtD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,EAAE;YAC5C,IAAA,aAAK,EAAC,6BAA6B,GAAG,MAAM,CAAC,CAAC;YAC9C,MAAM,CAAC,MAAM,CAAC,mCAAmC,EAAE,IAAI,CAAC,CAAC;YACzD,OAAO,KAAK,CAAC;SACd;QAED,IAAA,aAAK,EAAC,0BAA0B,KAAK,CAAC,MAAM,kBAAkB,CAAC,CAAC;QAChE,OAAO,SAAS,CAAC,uBAAuB,CAAC,KAAK,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC1C,IAAA,aAAK,EAAC,kBAAkB,eAAK,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAE5D,IAAI,CAAC,SAAS,EAAE;QACd,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,iNAAiN,CAClN,CAAC;KACH;AACH,CAAC;AAnCD,8CAmCC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport { traceStep } from '../telemetry';\nimport { debug } from '../utils/debug';\nimport * as codeTools from './code-tools';\nimport { XcodeProject } from './xcode-manager';\n\nexport function injectCodeSnippet({\n project,\n target,\n dsn,\n enableLogs,\n}: {\n project: XcodeProject;\n target: string;\n dsn: string;\n enableLogs: boolean;\n}) {\n debug(\n `Injecting code snippet into project at path: ${chalk.cyan(\n project.baseDir,\n )}`,\n );\n const codeAdded = traceStep('Add code snippet', () => {\n const files = project.getSourceFilesForTarget(target);\n if (files === undefined || files.length == 0) {\n debug('No files found for target: ' + target);\n Sentry.setTag('snippet-candidate-files-not-found', true);\n return false;\n }\n\n debug(`Adding code snippet to ${files.length} candidate files`);\n return codeTools.addCodeSnippetToProject(files, dsn, enableLogs);\n });\n Sentry.setTag('Snippet-Added', codeAdded);\n debug(`Snippet added: ${chalk.cyan(codeAdded.toString())}`);\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 snippet manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare function getRunScriptTemplate(orgSlug: string, projectSlug: string, uploadSource: boolean, includeHomebrewPath: boolean): string;
|
|
2
2
|
export declare const scriptInputPath = "\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"";
|
|
3
|
-
export declare function getSwiftSnippet(dsn: string): string;
|
|
4
|
-
export declare function getObjcSnippet(dsn: string): string;
|
|
3
|
+
export declare function getSwiftSnippet(dsn: string, enableLogs: boolean): string;
|
|
4
|
+
export declare function getObjcSnippet(dsn: string, enableLogs: boolean): string;
|
|
5
5
|
export declare function getFastlaneSnippet(org: string, project: string): string;
|
|
@@ -25,8 +25,8 @@ fi
|
|
|
25
25
|
}
|
|
26
26
|
exports.getRunScriptTemplate = getRunScriptTemplate;
|
|
27
27
|
exports.scriptInputPath = '"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}"';
|
|
28
|
-
function getSwiftSnippet(dsn) {
|
|
29
|
-
|
|
28
|
+
function getSwiftSnippet(dsn, enableLogs) {
|
|
29
|
+
let snippet = ` SentrySDK.start { options in
|
|
30
30
|
options.dsn = "${dsn}"
|
|
31
31
|
options.debug = true // Enabled debug when first installing is always helpful
|
|
32
32
|
|
|
@@ -46,14 +46,22 @@ function getSwiftSnippet(dsn) {
|
|
|
46
46
|
|
|
47
47
|
// Uncomment the following lines to add more data to your events
|
|
48
48
|
// options.attachScreenshot = true // This adds a screenshot to the error events
|
|
49
|
-
// options.attachViewHierarchy = true // This adds the view hierarchy to the error events
|
|
49
|
+
// options.attachViewHierarchy = true // This adds the view hierarchy to the error events`;
|
|
50
|
+
if (enableLogs) {
|
|
51
|
+
snippet += `
|
|
52
|
+
|
|
53
|
+
// Enable experimental logging features
|
|
54
|
+
options.experimental.enableLogs = true`;
|
|
55
|
+
}
|
|
56
|
+
snippet += `
|
|
50
57
|
}
|
|
51
58
|
// Remove the next line after confirming that your Sentry integration is working.
|
|
52
59
|
SentrySDK.capture(message: "This app uses Sentry! :)")\n`;
|
|
60
|
+
return snippet;
|
|
53
61
|
}
|
|
54
62
|
exports.getSwiftSnippet = getSwiftSnippet;
|
|
55
|
-
function getObjcSnippet(dsn) {
|
|
56
|
-
|
|
63
|
+
function getObjcSnippet(dsn, enableLogs) {
|
|
64
|
+
let snippet = ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
|
|
57
65
|
options.dsn = @"${dsn}";
|
|
58
66
|
options.debug = YES; // Enabled debug when first installing is always helpful
|
|
59
67
|
|
|
@@ -73,10 +81,18 @@ function getObjcSnippet(dsn) {
|
|
|
73
81
|
|
|
74
82
|
//Uncomment the following lines to add more data to your events
|
|
75
83
|
//options.attachScreenshot = YES; //This will add a screenshot to the error events
|
|
76
|
-
//options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events
|
|
84
|
+
//options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events`;
|
|
85
|
+
if (enableLogs) {
|
|
86
|
+
snippet += `
|
|
87
|
+
|
|
88
|
+
// Enable experimental logging features
|
|
89
|
+
options.experimental.enableLogs = YES;`;
|
|
90
|
+
}
|
|
91
|
+
snippet += `
|
|
77
92
|
}];
|
|
78
93
|
//Remove the next line after confirming that your Sentry integration is working.
|
|
79
94
|
[SentrySDK captureMessage:@"This app uses Sentry!"];\n`;
|
|
95
|
+
return snippet;
|
|
80
96
|
}
|
|
81
97
|
exports.getObjcSnippet = getObjcSnippet;
|
|
82
98
|
function getFastlaneSnippet(org, project) {
|