@sentry/wizard 3.40.0 → 3.41.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/README.md +19 -19
  3. package/bin.ts +5 -0
  4. package/codecov.yml +15 -0
  5. package/dist/bin.js +4 -0
  6. package/dist/bin.js.map +1 -1
  7. package/dist/e2e-tests/jest.config.d.ts +1 -0
  8. package/dist/e2e-tests/jest.config.js +1 -0
  9. package/dist/e2e-tests/jest.config.js.map +1 -1
  10. package/dist/package.json +3 -2
  11. package/dist/src/apple/apple-wizard.js +1 -2
  12. package/dist/src/apple/apple-wizard.js.map +1 -1
  13. package/dist/src/apple/code-tools.d.ts +10 -0
  14. package/dist/src/apple/code-tools.js +16 -12
  15. package/dist/src/apple/code-tools.js.map +1 -1
  16. package/dist/src/apple/fastlane.d.ts +23 -0
  17. package/dist/src/apple/fastlane.js +11 -7
  18. package/dist/src/apple/fastlane.js.map +1 -1
  19. package/dist/src/apple/templates.d.ts +1 -1
  20. package/dist/src/apple/templates.js +0 -2
  21. package/dist/src/apple/templates.js.map +1 -1
  22. package/dist/src/apple/xcode-manager.d.ts +10 -6
  23. package/dist/src/apple/xcode-manager.js +146 -61
  24. package/dist/src/apple/xcode-manager.js.map +1 -1
  25. package/dist/src/nextjs/nextjs-wizard.js +5 -3
  26. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  27. package/dist/src/nuxt/nuxt-wizard.js +6 -4
  28. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  29. package/dist/src/nuxt/sdk-setup.d.ts +1 -1
  30. package/dist/src/nuxt/sdk-setup.js +2 -1
  31. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  32. package/dist/src/react-native/react-native-wizard.js +5 -3
  33. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  34. package/dist/src/remix/remix-wizard.js +5 -3
  35. package/dist/src/remix/remix-wizard.js.map +1 -1
  36. package/dist/src/run.d.ts +1 -0
  37. package/dist/src/run.js +1 -0
  38. package/dist/src/run.js.map +1 -1
  39. package/dist/src/sveltekit/sveltekit-wizard.js +5 -3
  40. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  41. package/dist/src/utils/clack-utils.d.ts +3 -1
  42. package/dist/src/utils/clack-utils.js +18 -12
  43. package/dist/src/utils/clack-utils.js.map +1 -1
  44. package/dist/src/utils/package-manager.d.ts +1 -0
  45. package/dist/src/utils/package-manager.js +5 -0
  46. package/dist/src/utils/package-manager.js.map +1 -1
  47. package/dist/src/utils/types.d.ts +9 -0
  48. package/dist/src/utils/types.js.map +1 -1
  49. package/dist/test/apple/cocoapod.test.d.ts +1 -0
  50. package/dist/test/apple/cocoapod.test.js +409 -0
  51. package/dist/test/apple/cocoapod.test.js.map +1 -0
  52. package/dist/test/apple/code-tools.test.d.ts +1 -0
  53. package/dist/test/apple/code-tools.test.js +673 -0
  54. package/dist/test/apple/code-tools.test.js.map +1 -0
  55. package/dist/test/apple/fastfile.test.d.ts +1 -0
  56. package/dist/test/apple/fastfile.test.js +431 -0
  57. package/dist/test/apple/fastfile.test.js.map +1 -0
  58. package/dist/test/apple/templates.test.d.ts +1 -0
  59. package/dist/test/apple/templates.test.js +73 -0
  60. package/dist/test/apple/templates.test.js.map +1 -0
  61. package/dist/test/apple/xcode-manager.test.d.ts +1 -0
  62. package/dist/test/apple/xcode-manager.test.js +834 -0
  63. package/dist/test/apple/xcode-manager.test.js.map +1 -0
  64. package/dist/test/utils/clack-utils.test.js +89 -0
  65. package/dist/test/utils/clack-utils.test.js.map +1 -1
  66. package/e2e-tests/jest.config.ts +1 -0
  67. package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/project.pbxproj +52 -0
  68. package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +78 -0
  69. package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/project.pbxproj +62 -0
  70. package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +78 -0
  71. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/project.pbxproj +470 -0
  72. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +78 -0
  73. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/ContentView.swift +7 -0
  74. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/Project1App.swift +10 -0
  75. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/ContentView.swift +7 -0
  76. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/Project2App.swift +10 -0
  77. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/project.pbxproj +382 -0
  78. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/xcshareddata/xcschemes/Project.xcscheme +78 -0
  79. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/ContentView.swift +7 -0
  80. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/MainApp.swift +10 -0
  81. package/package.json +3 -2
  82. package/src/apple/apple-wizard.ts +1 -2
  83. package/src/apple/code-tools.ts +21 -6
  84. package/src/apple/fastlane.ts +18 -2
  85. package/src/apple/templates.ts +2 -2
  86. package/src/apple/xcode-manager.ts +181 -94
  87. package/src/nextjs/nextjs-wizard.ts +5 -2
  88. package/src/nuxt/nuxt-wizard.ts +6 -3
  89. package/src/nuxt/sdk-setup.ts +2 -0
  90. package/src/react-native/react-native-wizard.ts +5 -2
  91. package/src/remix/remix-wizard.ts +5 -2
  92. package/src/run.ts +2 -0
  93. package/src/sveltekit/sveltekit-wizard.ts +5 -2
  94. package/src/utils/clack-utils.ts +12 -2
  95. package/src/utils/package-manager.ts +6 -0
  96. package/src/utils/types.ts +10 -0
  97. package/test/apple/cocoapod.test.ts +306 -0
  98. package/test/apple/code-tools.test.ts +1042 -0
  99. package/test/apple/fastfile.test.ts +550 -0
  100. package/test/apple/templates.test.ts +191 -0
  101. package/test/apple/xcode-manager.test.ts +1066 -0
  102. package/test/utils/clack-utils.test.ts +92 -0
  103. package/types/xcode.d.ts +526 -0
@@ -0,0 +1,191 @@
1
+ import {
2
+ getFastlaneSnippet,
3
+ getObjcSnippet,
4
+ getRunScriptTemplate,
5
+ getSwiftSnippet,
6
+ scriptInputPath,
7
+ } from '../../src/apple/templates';
8
+
9
+ describe('templates', () => {
10
+ describe('getRunScriptTemplate', () => {
11
+ const variations: {
12
+ uploadSource: boolean;
13
+ includeHomebrewPath: boolean;
14
+ expectedScript: string;
15
+ }[] = [
16
+ {
17
+ uploadSource: true,
18
+ includeHomebrewPath: true,
19
+ expectedScript:
20
+ `# This script is responsable to upload debug symbols and source context for Sentry.
21
+ if [[ "$(uname -m)" == arm64 ]]; then
22
+ export PATH="/opt/homebrew/bin:$PATH"
23
+ fi
24
+ if which sentry-cli >/dev/null; then
25
+ export SENTRY_ORG=test-org
26
+ export SENTRY_PROJECT=test-project
27
+ ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
28
+ if [ ! $? -eq 0 ]; then
29
+ echo "warning: sentry-cli - $ERROR"
30
+ fi
31
+ else
32
+ echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
33
+ fi
34
+ `.replace(/\n/g, '\\n'),
35
+ },
36
+ {
37
+ uploadSource: true,
38
+ includeHomebrewPath: false,
39
+ expectedScript:
40
+ `# This script is responsable to upload debug symbols and source context for Sentry.
41
+ if which sentry-cli >/dev/null; then
42
+ export SENTRY_ORG=test-org
43
+ export SENTRY_PROJECT=test-project
44
+ ERROR=$(sentry-cli debug-files upload --include-sources "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
45
+ if [ ! $? -eq 0 ]; then
46
+ echo "warning: sentry-cli - $ERROR"
47
+ fi
48
+ else
49
+ echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
50
+ fi
51
+ `.replace(/\n/g, '\\n'),
52
+ },
53
+ {
54
+ uploadSource: false,
55
+ includeHomebrewPath: true,
56
+ expectedScript:
57
+ `# This script is responsable to upload debug symbols and source context for Sentry.
58
+ if [[ "$(uname -m)" == arm64 ]]; then
59
+ export PATH="/opt/homebrew/bin:$PATH"
60
+ fi
61
+ if which sentry-cli >/dev/null; then
62
+ export SENTRY_ORG=test-org
63
+ export SENTRY_PROJECT=test-project
64
+ ERROR=$(sentry-cli debug-files upload "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
65
+ if [ ! $? -eq 0 ]; then
66
+ echo "warning: sentry-cli - $ERROR"
67
+ fi
68
+ else
69
+ echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
70
+ fi
71
+ `.replace(/\n/g, '\\n'),
72
+ },
73
+ {
74
+ uploadSource: false,
75
+ includeHomebrewPath: false,
76
+ expectedScript:
77
+ `# This script is responsable to upload debug symbols and source context for Sentry.
78
+ if which sentry-cli >/dev/null; then
79
+ export SENTRY_ORG=test-org
80
+ export SENTRY_PROJECT=test-project
81
+ ERROR=$(sentry-cli debug-files upload "$DWARF_DSYM_FOLDER_PATH" 2>&1 >/dev/null)
82
+ if [ ! $? -eq 0 ]; then
83
+ echo "warning: sentry-cli - $ERROR"
84
+ fi
85
+ else
86
+ echo "warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases"
87
+ fi
88
+ `.replace(/\n/g, '\\n'),
89
+ },
90
+ ];
91
+
92
+ for (const variation of variations) {
93
+ describe(`uploadSource: ${variation.uploadSource.toString()} and includeHomebrewPath: ${variation.includeHomebrewPath.toString()}`, () => {
94
+ it('should return the correct script', () => {
95
+ // -- ct --
96
+ const script = getRunScriptTemplate(
97
+ 'test-org',
98
+ 'test-project',
99
+ variation.uploadSource,
100
+ variation.includeHomebrewPath,
101
+ );
102
+
103
+ // -- Assert --
104
+ expect(script).toBe(variation.expectedScript);
105
+ });
106
+ });
107
+ }
108
+ });
109
+
110
+ describe('scriptInputPath', () => {
111
+ it('should return the correct path', () => {
112
+ expect(scriptInputPath).toBe(
113
+ '"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}"',
114
+ );
115
+ });
116
+ });
117
+
118
+ describe('getSwiftSnippet', () => {
119
+ it('should return the correct snippet', () => {
120
+ // -- Arrange --
121
+ const snippet = getSwiftSnippet('test-dsn');
122
+
123
+ // -- Assert --
124
+ expect(snippet).toBe(
125
+ ` SentrySDK.start { options in
126
+ options.dsn = "test-dsn"
127
+ options.debug = true // Enabled debug when first installing is always helpful
128
+ // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
129
+ // We recommend adjusting this value in production.
130
+ options.tracesSampleRate = 1.0
131
+
132
+ // Sample rate for profiling, applied on top of TracesSampleRate.
133
+ // We recommend adjusting this value in production.
134
+ options.profilesSampleRate = 1.0
135
+
136
+ // Uncomment the following lines to add more data to your events
137
+ // options.attachScreenshot = true // This adds a screenshot to the error events
138
+ // options.attachViewHierarchy = true // This adds the view hierarchy to the error events
139
+ }
140
+ // Remove the next line after confirming that your Sentry integration is working.
141
+ SentrySDK.capture(message: "This app uses Sentry! :)")
142
+ `,
143
+ );
144
+ });
145
+ });
146
+
147
+ describe('getObjcSnippet', () => {
148
+ it('should return the correct snippet', () => {
149
+ // -- Arrange --
150
+ const snippet = getObjcSnippet('test-dsn');
151
+
152
+ // -- Assert --
153
+ expect(snippet).toBe(
154
+ ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {
155
+ options.dsn = @"test-dsn";
156
+ options.debug = YES; // Enabled debug when first installing is always helpful
157
+ // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.
158
+ // We recommend adjusting this value in production.
159
+ options.tracesSampleRate = @1.0;
160
+
161
+ // Sample rate for profiling, applied on top of TracesSampleRate.
162
+ // We recommend adjusting this value in production.
163
+ options.profilesSampleRate = @1.0;
164
+
165
+ //Uncomment the following lines to add more data to your events
166
+ //options.attachScreenshot = YES; //This will add a screenshot to the error events
167
+ //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events
168
+ }];
169
+ //Remove the next line after confirming that your Sentry integration is working.
170
+ [SentrySDK captureMessage:@"This app uses Sentry!"];
171
+ `,
172
+ );
173
+ });
174
+ });
175
+
176
+ describe('getFastlaneSnippet', () => {
177
+ it('should return the correct snippet', () => {
178
+ // -- Arrange --
179
+ const snippet = getFastlaneSnippet('test-org', 'test-project');
180
+
181
+ // -- Assert --
182
+ expect(snippet).toBe(
183
+ ` sentry_cli(
184
+ org_slug: 'test-org',
185
+ project_slug: 'test-project',
186
+ include_sources: true
187
+ )`,
188
+ );
189
+ });
190
+ });
191
+ });