@sentry/wizard 3.39.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 (221) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/README.md +21 -21
  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/e2e-tests/tests/flutter.test.d.ts +1 -0
  11. package/dist/e2e-tests/tests/flutter.test.js +190 -0
  12. package/dist/e2e-tests/tests/flutter.test.js.map +1 -0
  13. package/dist/e2e-tests/utils/index.d.ts +11 -0
  14. package/dist/e2e-tests/utils/index.js +36 -1
  15. package/dist/e2e-tests/utils/index.js.map +1 -1
  16. package/dist/lib/Constants.d.ts +1 -0
  17. package/dist/lib/Constants.js +5 -0
  18. package/dist/lib/Constants.js.map +1 -1
  19. package/dist/package.json +3 -2
  20. package/dist/src/apple/apple-wizard.js +2 -3
  21. package/dist/src/apple/apple-wizard.js.map +1 -1
  22. package/dist/src/apple/code-tools.d.ts +10 -0
  23. package/dist/src/apple/code-tools.js +16 -12
  24. package/dist/src/apple/code-tools.js.map +1 -1
  25. package/dist/src/apple/fastlane.d.ts +23 -0
  26. package/dist/src/apple/fastlane.js +11 -7
  27. package/dist/src/apple/fastlane.js.map +1 -1
  28. package/dist/src/apple/templates.d.ts +1 -1
  29. package/dist/src/apple/templates.js +0 -2
  30. package/dist/src/apple/templates.js.map +1 -1
  31. package/dist/src/apple/xcode-manager.d.ts +13 -9
  32. package/dist/src/apple/xcode-manager.js +146 -61
  33. package/dist/src/apple/xcode-manager.js.map +1 -1
  34. package/dist/src/flutter/code-tools.d.ts +17 -0
  35. package/dist/src/flutter/code-tools.js +263 -0
  36. package/dist/src/flutter/code-tools.js.map +1 -0
  37. package/dist/src/flutter/flutter-wizard.d.ts +2 -0
  38. package/dist/src/flutter/flutter-wizard.js +171 -0
  39. package/dist/src/flutter/flutter-wizard.js.map +1 -0
  40. package/dist/src/flutter/templates.d.ts +9 -0
  41. package/dist/src/flutter/templates.js +40 -0
  42. package/dist/src/flutter/templates.js.map +1 -0
  43. package/dist/src/nextjs/nextjs-wizard.js +5 -3
  44. package/dist/src/nextjs/nextjs-wizard.js.map +1 -1
  45. package/dist/src/nuxt/nuxt-wizard.js +6 -4
  46. package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
  47. package/dist/src/nuxt/sdk-setup.d.ts +1 -1
  48. package/dist/src/nuxt/sdk-setup.js +2 -1
  49. package/dist/src/nuxt/sdk-setup.js.map +1 -1
  50. package/dist/src/react-native/react-native-wizard.js +5 -3
  51. package/dist/src/react-native/react-native-wizard.js.map +1 -1
  52. package/dist/src/remix/remix-wizard.js +5 -3
  53. package/dist/src/remix/remix-wizard.js.map +1 -1
  54. package/dist/src/run.d.ts +2 -1
  55. package/dist/src/run.js +40 -32
  56. package/dist/src/run.js.map +1 -1
  57. package/dist/src/sveltekit/sveltekit-wizard.js +5 -3
  58. package/dist/src/sveltekit/sveltekit-wizard.js.map +1 -1
  59. package/dist/src/utils/clack-utils.d.ts +4 -2
  60. package/dist/src/utils/clack-utils.js +18 -12
  61. package/dist/src/utils/clack-utils.js.map +1 -1
  62. package/dist/src/utils/package-manager.d.ts +1 -0
  63. package/dist/src/utils/package-manager.js +5 -0
  64. package/dist/src/utils/package-manager.js.map +1 -1
  65. package/dist/src/utils/types.d.ts +9 -0
  66. package/dist/src/utils/types.js.map +1 -1
  67. package/dist/test/apple/cocoapod.test.d.ts +1 -0
  68. package/dist/test/apple/cocoapod.test.js +409 -0
  69. package/dist/test/apple/cocoapod.test.js.map +1 -0
  70. package/dist/test/apple/code-tools.test.d.ts +1 -0
  71. package/dist/test/apple/code-tools.test.js +673 -0
  72. package/dist/test/apple/code-tools.test.js.map +1 -0
  73. package/dist/test/apple/fastfile.test.d.ts +1 -0
  74. package/dist/test/apple/fastfile.test.js +431 -0
  75. package/dist/test/apple/fastfile.test.js.map +1 -0
  76. package/dist/test/apple/templates.test.d.ts +1 -0
  77. package/dist/test/apple/templates.test.js +73 -0
  78. package/dist/test/apple/templates.test.js.map +1 -0
  79. package/dist/test/apple/xcode-manager.test.d.ts +1 -0
  80. package/dist/test/apple/xcode-manager.test.js +834 -0
  81. package/dist/test/apple/xcode-manager.test.js.map +1 -0
  82. package/dist/test/flutter/code-tools.test.d.ts +1 -0
  83. package/dist/test/flutter/code-tools.test.js +84 -0
  84. package/dist/test/flutter/code-tools.test.js.map +1 -0
  85. package/dist/test/flutter/templates.test.d.ts +1 -0
  86. package/dist/test/flutter/templates.test.js +41 -0
  87. package/dist/test/flutter/templates.test.js.map +1 -0
  88. package/dist/test/utils/clack-utils.test.js +89 -0
  89. package/dist/test/utils/clack-utils.test.js.map +1 -1
  90. package/e2e-tests/README.md +5 -1
  91. package/e2e-tests/jest.config.ts +1 -0
  92. package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/project.pbxproj +52 -0
  93. package/e2e-tests/test-applications/apple/damaged-missing-configuration-list/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +78 -0
  94. package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/project.pbxproj +62 -0
  95. package/e2e-tests/test-applications/apple/no-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +78 -0
  96. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/project.pbxproj +470 -0
  97. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project.xcodeproj/xcshareddata/xcschemes/Project1.xcscheme +78 -0
  98. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/ContentView.swift +7 -0
  99. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project1/Project1App.swift +10 -0
  100. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/ContentView.swift +7 -0
  101. package/e2e-tests/test-applications/apple/spm-swiftui-multi-targets/Project2/Project2App.swift +10 -0
  102. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/project.pbxproj +382 -0
  103. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Project.xcodeproj/xcshareddata/xcschemes/Project.xcscheme +78 -0
  104. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/ContentView.swift +7 -0
  105. package/e2e-tests/test-applications/apple/spm-swiftui-single-target/Sources/MainApp.swift +10 -0
  106. package/e2e-tests/test-applications/flutter-test-app/.metadata +45 -0
  107. package/e2e-tests/test-applications/flutter-test-app/README.md +16 -0
  108. package/e2e-tests/test-applications/flutter-test-app/analysis_options.yaml +28 -0
  109. package/e2e-tests/test-applications/flutter-test-app/android/app/build.gradle +44 -0
  110. package/e2e-tests/test-applications/flutter-test-app/android/app/src/debug/AndroidManifest.xml +7 -0
  111. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/AndroidManifest.xml +45 -0
  112. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/kotlin/com/example/flutter_magic/MainActivity.kt +5 -0
  113. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable/launch_background.xml +12 -0
  114. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
  115. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  116. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  117. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  118. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  119. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  120. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values/styles.xml +18 -0
  121. package/e2e-tests/test-applications/flutter-test-app/android/app/src/main/res/values-night/styles.xml +18 -0
  122. package/e2e-tests/test-applications/flutter-test-app/android/app/src/profile/AndroidManifest.xml +7 -0
  123. package/e2e-tests/test-applications/flutter-test-app/android/build.gradle +18 -0
  124. package/e2e-tests/test-applications/flutter-test-app/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  125. package/e2e-tests/test-applications/flutter-test-app/android/gradle.properties +3 -0
  126. package/e2e-tests/test-applications/flutter-test-app/android/settings.gradle +25 -0
  127. package/e2e-tests/test-applications/flutter-test-app/lib/main.dart +125 -0
  128. package/e2e-tests/test-applications/flutter-test-app/linux/CMakeLists.txt +145 -0
  129. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/CMakeLists.txt +88 -0
  130. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.cc +11 -0
  131. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugin_registrant.h +15 -0
  132. package/e2e-tests/test-applications/flutter-test-app/linux/flutter/generated_plugins.cmake +23 -0
  133. package/e2e-tests/test-applications/flutter-test-app/linux/main.cc +6 -0
  134. package/e2e-tests/test-applications/flutter-test-app/linux/my_application.cc +124 -0
  135. package/e2e-tests/test-applications/flutter-test-app/linux/my_application.h +18 -0
  136. package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Debug.xcconfig +2 -0
  137. package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/Flutter-Release.xcconfig +2 -0
  138. package/e2e-tests/test-applications/flutter-test-app/macos/Flutter/GeneratedPluginRegistrant.swift +10 -0
  139. package/e2e-tests/test-applications/flutter-test-app/macos/Podfile +43 -0
  140. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/AppDelegate.swift +9 -0
  141. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  142. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  143. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  144. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  145. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  146. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  147. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  148. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  149. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Base.lproj/MainMenu.xib +343 -0
  150. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/AppInfo.xcconfig +14 -0
  151. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Debug.xcconfig +2 -0
  152. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Release.xcconfig +2 -0
  153. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Configs/Warnings.xcconfig +13 -0
  154. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/DebugProfile.entitlements +12 -0
  155. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Info.plist +32 -0
  156. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/MainFlutterWindow.swift +15 -0
  157. package/e2e-tests/test-applications/flutter-test-app/macos/Runner/Release.entitlements +8 -0
  158. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.pbxproj +705 -0
  159. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  160. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +98 -0
  161. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  162. package/e2e-tests/test-applications/flutter-test-app/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  163. package/e2e-tests/test-applications/flutter-test-app/macos/RunnerTests/RunnerTests.swift +12 -0
  164. package/e2e-tests/test-applications/flutter-test-app/pubspec.lock +213 -0
  165. package/e2e-tests/test-applications/flutter-test-app/pubspec.yaml +89 -0
  166. package/e2e-tests/test-applications/flutter-test-app/test/widget_test.dart +30 -0
  167. package/e2e-tests/test-applications/flutter-test-app/web/favicon.png +0 -0
  168. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-192.png +0 -0
  169. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-512.png +0 -0
  170. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-192.png +0 -0
  171. package/e2e-tests/test-applications/flutter-test-app/web/icons/Icon-maskable-512.png +0 -0
  172. package/e2e-tests/test-applications/flutter-test-app/web/index.html +38 -0
  173. package/e2e-tests/test-applications/flutter-test-app/web/manifest.json +35 -0
  174. package/e2e-tests/test-applications/flutter-test-app/windows/CMakeLists.txt +108 -0
  175. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/CMakeLists.txt +109 -0
  176. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.cc +11 -0
  177. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugin_registrant.h +15 -0
  178. package/e2e-tests/test-applications/flutter-test-app/windows/flutter/generated_plugins.cmake +23 -0
  179. package/e2e-tests/test-applications/flutter-test-app/windows/runner/CMakeLists.txt +40 -0
  180. package/e2e-tests/test-applications/flutter-test-app/windows/runner/Runner.rc +121 -0
  181. package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.cpp +71 -0
  182. package/e2e-tests/test-applications/flutter-test-app/windows/runner/flutter_window.h +33 -0
  183. package/e2e-tests/test-applications/flutter-test-app/windows/runner/main.cpp +43 -0
  184. package/e2e-tests/test-applications/flutter-test-app/windows/runner/resource.h +16 -0
  185. package/e2e-tests/test-applications/flutter-test-app/windows/runner/resources/app_icon.ico +0 -0
  186. package/e2e-tests/test-applications/flutter-test-app/windows/runner/runner.exe.manifest +14 -0
  187. package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.cpp +65 -0
  188. package/e2e-tests/test-applications/flutter-test-app/windows/runner/utils.h +19 -0
  189. package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.cpp +288 -0
  190. package/e2e-tests/test-applications/flutter-test-app/windows/runner/win32_window.h +102 -0
  191. package/e2e-tests/tests/flutter.test.ts +127 -0
  192. package/e2e-tests/utils/index.ts +33 -0
  193. package/lib/Constants.ts +5 -0
  194. package/package.json +3 -2
  195. package/src/apple/apple-wizard.ts +2 -3
  196. package/src/apple/code-tools.ts +21 -6
  197. package/src/apple/fastlane.ts +18 -2
  198. package/src/apple/templates.ts +2 -2
  199. package/src/apple/xcode-manager.ts +186 -99
  200. package/src/flutter/code-tools.ts +284 -0
  201. package/src/flutter/flutter-wizard.ts +164 -0
  202. package/src/flutter/templates.ts +90 -0
  203. package/src/nextjs/nextjs-wizard.ts +5 -2
  204. package/src/nuxt/nuxt-wizard.ts +6 -3
  205. package/src/nuxt/sdk-setup.ts +2 -0
  206. package/src/react-native/react-native-wizard.ts +5 -2
  207. package/src/remix/remix-wizard.ts +5 -2
  208. package/src/run.ts +9 -0
  209. package/src/sveltekit/sveltekit-wizard.ts +5 -2
  210. package/src/utils/clack-utils.ts +16 -4
  211. package/src/utils/package-manager.ts +6 -0
  212. package/src/utils/types.ts +10 -0
  213. package/test/apple/cocoapod.test.ts +306 -0
  214. package/test/apple/code-tools.test.ts +1042 -0
  215. package/test/apple/fastfile.test.ts +550 -0
  216. package/test/apple/templates.test.ts +191 -0
  217. package/test/apple/xcode-manager.test.ts +1066 -0
  218. package/test/flutter/code-tools.test.ts +212 -0
  219. package/test/flutter/templates.test.ts +100 -0
  220. package/test/utils/clack-utils.test.ts +92 -0
  221. package/types/xcode.d.ts +526 -0
@@ -5,6 +5,7 @@ exports.DEFAULT_URL = exports.getIntegrationChoices = exports.mapIntegrationToPl
5
5
  var Integration;
6
6
  (function (Integration) {
7
7
  Integration["reactNative"] = "reactNative";
8
+ Integration["flutter"] = "flutter";
8
9
  Integration["ios"] = "ios";
9
10
  Integration["android"] = "android";
10
11
  Integration["cordova"] = "cordova";
@@ -44,6 +45,8 @@ function getIntegrationDescription(type) {
44
45
  return 'Android';
45
46
  case Integration.reactNative:
46
47
  return 'React Native';
48
+ case Integration.flutter:
49
+ return 'Flutter';
47
50
  case Integration.cordova:
48
51
  return 'Cordova';
49
52
  case Integration.electron:
@@ -69,6 +72,8 @@ function mapIntegrationToPlatform(type) {
69
72
  return 'android';
70
73
  case Integration.reactNative:
71
74
  return 'react-native';
75
+ case Integration.flutter:
76
+ return 'flutter';
72
77
  case Integration.cordova:
73
78
  return 'cordova';
74
79
  case Integration.electron:
@@ -1 +1 @@
1
- {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAWX;AAXD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,sCAAuB,CAAA;IACvB,wCAAyB,CAAA;AAC3B,CAAC,EAXW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAWtB;AAED,wCAAwC;AACxC,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,uBAAW,CAAA;IACX,+BAAmB,CAAA;AACrB,CAAC,EAHW,QAAQ,GAAR,gBAAQ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cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,8BAAuB,IAAI,CAAE,CAAC,CAAC;KAClD;AACH,CAAC;AAvBD,4DAuBC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,EAHoD,CAGpD,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAeY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.cordova:\n return 'cordova';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
1
+ {"version":3,"file":"Constants.js","sourceRoot":"","sources":["../../lib/Constants.ts"],"names":[],"mappings":";;;AAAA,wCAAwC;AACxC,IAAY,WAYX;AAZD,WAAY,WAAW;IACrB,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,0BAAW,CAAA;IACX,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,sCAAuB,CAAA;IACvB,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AW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,OAAO,cAAc,CAAC;KACzB;AACH,CAAC;AAzBD,8DAyBC;AAED,SAAgB,wBAAwB,CAAC,IAAY;IACnD,QAAQ,IAAI,EAAE;QACZ,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,WAAW;YAC1B,OAAO,cAAc,CAAC;QACxB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,OAAO;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,QAAQ;YACvB,OAAO,qBAAqB,CAAC;QAC/B,KAAK,WAAW,CAAC,MAAM;YACrB,OAAO,mBAAmB,CAAC;QAC7B,KAAK,WAAW,CAAC,KAAK;YACpB,OAAO,kBAAkB,CAAC;QAC5B,KAAK,WAAW,CAAC,SAAS;YACxB,OAAO,sBAAsB,CAAC;QAChC,KAAK,WAAW,CAAC,UAAU;YACzB,OAAO,SAAS,CAAC;QACnB,KAAK,WAAW,CAAC,GAAG;YAClB,OAAO,KAAK,CAAC;QACf;YACE,MAAM,IAAI,KAAK,CAAC,8BAAuB,IAAI,CAAE,CAAC,CAAC;KAClD;AACH,CAAC;AAzBD,4DAyBC;AAOD,SAAgB,qBAAqB;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,UAAC,IAAY,IAAK,OAAA,CAAC;QACrD,IAAI,EAAE,yBAAyB,CAAC,IAAI,CAAC;QACrC,KAAK,EAAE,IAAI;KACZ,CAAC,EAHoD,CAGpD,CAAC,CAAC;AACN,CAAC;AALD,sDAKC;AAeY,QAAA,WAAW,GAAG,oBAAoB,CAAC","sourcesContent":["/** Key value should be the same here */\nexport enum Integration {\n reactNative = 'reactNative',\n flutter = 'flutter',\n ios = 'ios',\n android = 'android',\n cordova = 'cordova',\n electron = 'electron',\n nextjs = 'nextjs',\n nuxt = 'nuxt',\n remix = 'remix',\n sveltekit = 'sveltekit',\n sourcemaps = 'sourcemaps',\n}\n\n/** Key value should be the same here */\nexport enum Platform {\n ios = 'ios',\n android = 'android',\n}\n\nexport function getPlatformChoices(): any[] {\n return Object.keys(Platform).map((platform: string) => ({\n checked: true,\n name: getPlatformDescription(platform),\n value: platform,\n }));\n}\n\nexport function getPlatformDescription(type: string): string {\n switch (type) {\n case Platform.ios:\n return 'iOS';\n default:\n return 'Android';\n }\n}\n\nexport function getIntegrationDescription(type: string): string {\n switch (type) {\n case Integration.android:\n return 'Android';\n case Integration.reactNative:\n return 'React Native';\n case Integration.flutter:\n return 'Flutter';\n case Integration.cordova:\n return 'Cordova';\n case Integration.electron:\n return 'Electron';\n case Integration.nextjs:\n return 'Next.js';\n case Integration.remix:\n return 'Remix';\n case Integration.sveltekit:\n return 'SvelteKit';\n case Integration.sourcemaps:\n return 'Configure Source Maps Upload';\n case Integration.ios:\n return 'iOS';\n default:\n return 'React Native';\n }\n}\n\nexport function mapIntegrationToPlatform(type: string): string | undefined {\n switch (type) {\n case Integration.android:\n return 'android';\n case Integration.reactNative:\n return 'react-native';\n case Integration.flutter:\n return 'flutter';\n case Integration.cordova:\n return 'cordova';\n case Integration.electron:\n return 'javascript-electron';\n case Integration.nextjs:\n return 'javascript-nextjs';\n case Integration.remix:\n return 'javascript-remix';\n case Integration.sveltekit:\n return 'javascript-sveltekit';\n case Integration.sourcemaps:\n return undefined;\n case Integration.ios:\n return 'iOS';\n default:\n throw new Error(`Unknown integration ${type}`);\n }\n}\n\ntype IntegrationChoice = {\n name: string;\n value: string;\n};\n\nexport function getIntegrationChoices(): IntegrationChoice[] {\n return Object.keys(Integration).map((type: string) => ({\n name: getIntegrationDescription(type),\n value: type,\n }));\n}\n\nexport interface Args {\n url: string;\n debug: boolean;\n uninstall: boolean;\n integration: Integration;\n platform: Platform[];\n skipConnect: boolean;\n quiet: boolean;\n signup: boolean;\n promoCode?: string;\n disableTelemetry?: boolean;\n}\n\nexport const DEFAULT_URL = 'https://sentry.io/';\n"]}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/wizard",
3
- "version": "3.39.0",
3
+ "version": "3.41.0",
4
4
  "homepage": "https://github.com/getsentry/sentry-wizard",
5
5
  "repository": "https://github.com/getsentry/sentry-wizard",
6
6
  "description": "Sentry wizard helping you to configure your project",
@@ -123,5 +123,6 @@
123
123
  "volta": {
124
124
  "node": "14.18.3",
125
125
  "yarn": "1.22.19"
126
- }
126
+ },
127
+ "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
127
128
  }
@@ -80,7 +80,6 @@ var Sentry = __importStar(require("@sentry/node"));
80
80
  var telemetry_1 = require("../telemetry");
81
81
  var cocoapod = __importStar(require("./cocoapod"));
82
82
  var fastlane = __importStar(require("./fastlane"));
83
- var xcode = require('xcode');
84
83
  /* eslint-enable @typescript-eslint/no-unused-vars */
85
84
  var clack_utils_1 = require("../utils/clack-utils");
86
85
  function runAppleWizard(options) {
@@ -158,7 +157,7 @@ function runAppleWizardWithTelementry(options) {
158
157
  xcProject = new xcode_manager_1.XcodeProject(pbxproj);
159
158
  availableTargets = xcProject.getAllTargets();
160
159
  if (!(availableTargets.length == 0)) return [3 /*break*/, 15];
161
- prompts_1.default.log.error("No suttable target found in ".concat(xcodeProjFile));
160
+ prompts_1.default.log.error("No suitable target found in ".concat(xcodeProjFile));
162
161
  Sentry.setTag('No-Target', true);
163
162
  return [4 /*yield*/, (0, clack_utils_1.abort)()];
164
163
  case 14:
@@ -201,7 +200,7 @@ function runAppleWizardWithTelementry(options) {
201
200
  case 21:
202
201
  Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');
203
202
  (0, telemetry_1.traceStep)('Update Xcode project', function () {
204
- xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);
203
+ xcProject.updateXcodeProject(project, target, !hasCocoa, true);
205
204
  });
206
205
  codeAdded = (0, telemetry_1.traceStep)('Add code snippet', function () {
207
206
  var files = xcProject.filesForTarget(target);
@@ -1 +1 @@
1
- {"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AACzB,yCAA6B;AAC7B,iDAA+C;AAC/C,sDAA0C;AAC1C,kDAAsC;AACtC,oEAAwD;AAExD,mDAAuC;AACvC,0CAAwD;AACxD,mDAAuC;AACvC,mDAAuC;AAEvC,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,qDAAqD;AAErD,oDAO8B;AAE9B,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,KAAK;oBAClB,aAAa,EAAE,OAAO;iBACvB,EACD,cAAM,OAAA,4BAA4B,CAAC,OAAO,CAAC,EAArC,CAAqC,CAC5C,EAAC;;;CACH;AATD,wCASC;AAED,SAAe,4BAA4B,CACzC,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEpC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;oBACnC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;yBAC7B,CAAC,MAA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AAC,QAAQ,CAAC,YAAY,CAAC;YAC5B,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EACxB;YACA,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACnB;QACD,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qCAAqC;AACrC,SAAS,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IAC5D,IAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAxB,CAAwB,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\nconst xcode = require('xcode');\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n wizardOptions: options,\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suttable target found in ${xcodeProjFile}`);\n Sentry.setTag('No-Target', true);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n Sentry.setTag('cocoapod-exists', hasCocoa);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n Sentry.setTag('cocoapod-added', podAdded);\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, apiKey, !hasCocoa, true);\n });\n\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n\n Sentry.setTag('Snippet-Added', codeAdded);\n\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n Sentry.setTag('fastlane-desired', addLane);\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n Sentry.setTag('fastlane-added', added);\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
1
+ {"version":3,"file":"apple-wizard.js","sourceRoot":"","sources":["../../../src/apple/apple-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8BAA8B;AAC9B,+DAA+D;AAC/D,4DAA4D;AAC5D,sDAAsD;AACtD,sDAAsD;AACtD,yEAAyE;AACzE,2DAAmC;AACnC,qCAAyB;AACzB,yCAA6B;AAC7B,iDAA+C;AAC/C,sDAA0C;AAC1C,kDAAsC;AACtC,oEAAwD;AAExD,mDAAuC;AACvC,0CAAwD;AACxD,mDAAuC;AACvC,mDAAuC;AAEvC,qDAAqD;AAErD,oDAO8B;AAE9B,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,KAAK;oBAClB,aAAa,EAAE,OAAO;iBACvB,EACD,cAAM,OAAA,4BAA4B,CAAC,OAAO,CAAC,EAArC,CAAqC,CAC5C,EAAC;;;CACH;AATD,wCASC;AAED,SAAe,4BAA4B,CACzC,OAAsB;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;qBAC7B,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEpC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;oBACnC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;yBAC7B,CAAC,MAAM,EAAP,wBAAO;oBAEL,qBAAM,IAAA,qBAAS,EAAC,mBAAmB,EAAE,cAAM,OAAA,IAAA,mCAAqB,GAAE,EAAvB,CAAuB,CAAC,EAAA;;yBAArE,CAAC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,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACpC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qCAAqC;AACrC,SAAS,sBAAsB,CAAC,GAAW,EAAE,SAAiB;IAC5D,IAAM,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC,MAAM,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAxB,CAAwB,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/* eslint-disable max-lines */\n/* eslint-disable @typescript-eslint/no-unsafe-member-access */\n/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n/* eslint-disable @typescript-eslint/no-unsafe-call */\n/* eslint-disable @typescript-eslint/no-unused-vars */\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { XcodeProject } from './xcode-manager';\nimport * as codeTools from './code-tools';\nimport * as bash from '../utils/bash';\nimport * as SentryUtils from '../utils/sentrycli-utils';\nimport { SentryProjectData, WizardOptions } from '../utils/types';\nimport * as Sentry from '@sentry/node';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport * as cocoapod from './cocoapod';\nimport * as fastlane from './fastlane';\n\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\nimport {\n askToInstallSentryCLI,\n printWelcome,\n abort,\n askForItemSelection,\n confirmContinueIfNoOrDirtyGitRepo,\n getOrAskForProjectData,\n} from '../utils/clack-utils';\n\nexport async function runAppleWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'ios',\n wizardOptions: options,\n },\n () => runAppleWizardWithTelementry(options),\n );\n}\n\nasync function runAppleWizardWithTelementry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Apple Wizard',\n promoCode: options.promoCode,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const hasCli = bash.hasSentryCLI();\n Sentry.setTag('has-cli', hasCli);\n if (!hasCli) {\n if (\n !(await traceStep('Ask for SentryCLI', () => askToInstallSentryCLI()))\n ) {\n clack.log.warn(\n \"Without sentry-cli, you won't be able to upload debug symbols to Sentry. You can install it later by following the instructions at https://docs.sentry.io/cli/\",\n );\n Sentry.setTag('CLI-Installed', false);\n } else {\n await bash.installSentryCLI();\n Sentry.setTag('CLI-Installed', true);\n }\n }\n\n const projectDir = process.cwd();\n const xcodeProjFiles = searchXcodeProject(projectDir);\n\n if (!xcodeProjFiles || xcodeProjFiles.length === 0) {\n clack.log.error(\n 'No Xcode project found. Please run this command from the root of your project.',\n );\n await abort();\n return;\n }\n\n let xcodeProjFile;\n\n if (xcodeProjFiles.length === 1) {\n xcodeProjFile = xcodeProjFiles[0];\n Sentry.setTag('multiple-projects', false);\n } else {\n Sentry.setTag('multiple-projects', true);\n xcodeProjFile = (\n await traceStep('Choose Xcode project', () =>\n askForItemSelection(\n xcodeProjFiles,\n 'Which project do you want to add Sentry to?',\n ),\n )\n ).value;\n }\n\n const pbxproj = path.join(projectDir, xcodeProjFile, 'project.pbxproj');\n\n if (!fs.existsSync(pbxproj)) {\n clack.log.error(`No pbxproj found at ${xcodeProjFile}`);\n await abort();\n return;\n }\n\n const { project, apiKey } = await getSentryProjectAndApiKey(options);\n\n const xcProject = new XcodeProject(pbxproj);\n\n const availableTargets = xcProject.getAllTargets();\n\n if (availableTargets.length == 0) {\n clack.log.error(`No suitable target found in ${xcodeProjFile}`);\n Sentry.setTag('No-Target', true);\n await abort();\n return;\n }\n\n const target =\n availableTargets.length == 1\n ? availableTargets[0]\n : (\n await traceStep('Choose target', () =>\n askForItemSelection(\n availableTargets,\n 'Which target do you want to add Sentry to?',\n ),\n )\n ).value;\n\n SentryUtils.createSentryCLIRC(projectDir, { auth_token: apiKey.token });\n clack.log.info(\n 'We created a \".sentryclirc\" file in your project directory in order to provide an auth token for Sentry CLI.\\nIt was also added to your \".gitignore\" file.\\nAt your CI enviroment, you can set the SENTRY_AUTH_TOKEN environment variable instead. See https://docs.sentry.io/cli/configuration/#auth-token for more information.',\n );\n\n let hasCocoa = cocoapod.usesCocoaPod(projectDir);\n Sentry.setTag('cocoapod-exists', hasCocoa);\n\n if (hasCocoa) {\n const pm = (\n await traceStep('Choose a package manager', () =>\n askForItemSelection(\n ['Swift Package Manager', 'CocoaPods'],\n 'Which package manager would you like to use to add Sentry?',\n ),\n )\n ).value;\n\n hasCocoa = pm === 'CocoaPods';\n if (hasCocoa) {\n const podAdded = await traceStep('Add CocoaPods reference', () =>\n cocoapod.addCocoaPods(projectDir),\n );\n Sentry.setTag('cocoapod-added', podAdded);\n if (!podAdded) {\n clack.log.warn(\n \"Could not add Sentry pod to your Podfile. You'll have to add it manually.\\nPlease follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/#install\",\n );\n }\n }\n }\n\n Sentry.setTag('package-manager', hasCocoa ? 'cocoapods' : 'SPM');\n traceStep('Update Xcode project', () => {\n xcProject.updateXcodeProject(project, target, !hasCocoa, true);\n });\n\n const codeAdded = traceStep('Add code snippet', () => {\n const files = xcProject.filesForTarget(target);\n if (files === undefined || files.length == 0) return false;\n\n return codeTools.addCodeSnippetToProject(\n projectDir,\n files,\n project.keys[0].dsn.public,\n );\n });\n\n Sentry.setTag('Snippet-Added', codeAdded);\n\n if (!codeAdded) {\n clack.log.warn(\n 'Added the Sentry dependency to your project but could not add the Sentry code snippet. Please add the code snipped manually by following the docs: https://docs.sentry.io/platforms/apple/guides/ios/#configure',\n );\n }\n\n const hasFastlane = fastlane.fastFile(projectDir);\n Sentry.setTag('fastlane-exists', hasFastlane);\n if (hasFastlane) {\n const addLane = await clack.confirm({\n message:\n 'Found a Fastfile in your project. Do you want to configure a lane to upload debug symbols to Sentry?',\n });\n Sentry.setTag('fastlane-desired', addLane);\n if (addLane) {\n const added = await traceStep('Configure fastlane', () =>\n fastlane.addSentryToFastlane(\n projectDir,\n project.organization.slug,\n project.slug,\n ),\n );\n Sentry.setTag('fastlane-added', added);\n if (added) {\n clack.log.step(\n 'A new step was added to your fastlane file. Now and you build your project with fastlane, debug symbols and source context will be uploaded to Sentry.',\n );\n } else {\n clack.log.warn(\n 'Could not edit your fastlane file to upload debug symbols to Sentry. Please follow the instructions at https://docs.sentry.io/platforms/apple/guides/ios/dsym/#fastlane',\n );\n }\n }\n }\n\n clack.log.success(\n 'Sentry was successfully added to your project! Run your project to send your first event to Sentry. Go to Sentry.io to see whether everything is working fine.',\n );\n}\n\n//Prompt for Sentry project and API key\nasync function getSentryProjectAndApiKey(\n options: WizardOptions,\n): Promise<{ project: SentryProjectData; apiKey: { token: string } }> {\n const { selectedProject, authToken } = await getOrAskForProjectData(options);\n return { project: selectedProject, apiKey: { token: authToken } };\n}\n\nfunction searchXcodeProject(at: string): string[] {\n const projs = findFilesWithExtension(at, '.xcodeproj');\n if (projs.length > 0) {\n return projs;\n }\n\n const workspace = findFilesWithExtension(at, '.xcworkspace');\n if (workspace.length == 0) {\n return [];\n }\n\n const xsworkspacedata = path.join(\n at,\n workspace[0],\n 'contents.xcworkspacedata',\n );\n if (!fs.existsSync(xsworkspacedata)) {\n return [];\n }\n const groupRegex = /location *= *\"group:([^\"]+)\"/gim;\n const content = fs.readFileSync(xsworkspacedata, 'utf8');\n let matches = groupRegex.exec(content);\n\n while (matches) {\n const group = matches[1];\n const groupPath = path.join(at, group);\n if (\n !group.endsWith('Pods.xcodeproj') &&\n group.endsWith('.xcodeproj') &&\n fs.existsSync(groupPath)\n ) {\n projs.push(group);\n }\n matches = groupRegex.exec(content);\n }\n return projs;\n}\n\n//find files with the given extension\nfunction findFilesWithExtension(dir: string, extension: string): string[] {\n const files = fs.readdirSync(dir);\n return files.filter((file) => file.endsWith(extension));\n}\n"]}
@@ -1 +1,11 @@
1
+ declare function isAppDelegateFile(filePath: string): boolean;
2
+ declare function findAppDidFinishLaunchingWithOptions(dir: string, files?: string[] | undefined): string | null;
1
3
  export declare function addCodeSnippetToProject(projPath: string, files: string[], dsn: string): boolean;
4
+ /**
5
+ * Exported for testing purposes, but should not be used in other modules.
6
+ */
7
+ export declare let exportForTesting: {
8
+ isAppDelegateFile: typeof isAppDelegateFile;
9
+ findAppDidFinishLaunchingWithOptions: typeof findAppDidFinishLaunchingWithOptions;
10
+ };
11
+ export {};
@@ -22,20 +22,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.addCodeSnippetToProject = void 0;
26
+ exports.exportForTesting = exports.addCodeSnippetToProject = void 0;
27
+ var Sentry = __importStar(require("@sentry/node"));
30
28
  var fs = __importStar(require("fs"));
31
29
  var path = __importStar(require("path"));
32
30
  var templates = __importStar(require("./templates"));
33
- var Sentry = __importStar(require("@sentry/node"));
34
31
  // @ts-ignore - clack is ESM and TS complains about that. It works though
35
- var prompts_1 = __importDefault(require("@clack/prompts"));
36
- var swiftAppLaunchRegex = /(func\s+application\s*\(_\sapplication:[^,]+,\s*didFinishLaunchingWithOptions[^,]+:[^)]+\)\s+->\s+Bool\s+{)|func\s+applicationDidFinishLaunching\(_\s+aNotification:\s+Notification\)\s+{/im;
37
- var objcAppLaunchRegex = /-\s*\(BOOL\)\s*application:\s*\(UIApplication\s*\*\)\s*application\s+didFinishLaunchingWithOptions:\s*\(NSDictionary\s*\*\)\s*launchOptions\s*{/im;
38
- var swiftUIRegex = /@main\s+struct[^:]+:\s*App\s*{/im;
32
+ var clack = __importStar(require("@clack/prompts"));
33
+ var swiftAppLaunchRegex = /(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;
34
+ var objcAppLaunchRegex = /-\s*\(\s*BOOL\s*\)\s*application:\s*\(\s*UIApplication\s*\*\s*\)\s*application\s+didFinishLaunchingWithOptions:\s*\(\s*NSDictionary\s*\*\s*\)\s*launchOptions\s*{/im;
35
+ var swiftUIRegex = /@main\s+struct[^:]+:\s*(SwiftUI\.)?App\s*{/im;
39
36
  function isAppDelegateFile(filePath) {
40
37
  var appLaunchRegex = filePath.toLowerCase().endsWith('.swift')
41
38
  ? swiftAppLaunchRegex
@@ -61,7 +58,7 @@ function findAppDidFinishLaunchingWithOptions(dir, files) {
61
58
  return filePath;
62
59
  }
63
60
  }
64
- else if (!filePath.startsWith('.') &&
61
+ else if (!path.basename(filePath).startsWith('.') &&
65
62
  !filePath.endsWith('.xcodeproj') &&
66
63
  !filePath.endsWith('.xcassets') &&
67
64
  fs.existsSync(filePath) &&
@@ -94,13 +91,14 @@ function addCodeSnippetToProject(projPath, files, dsn) {
94
91
  Sentry.setTag('ui-engine', swiftUIRegex.test(fileContent) ? 'swiftui' : 'uikit');
95
92
  if (fileContent.includes(checkForSentryInit)) {
96
93
  //already initialized
97
- prompts_1.default.log.info('Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.');
94
+ clack.log.info('Sentry is already initialized in your AppDelegate. Skipping adding the code snippet.');
98
95
  return true;
99
96
  }
100
97
  var match = appLaunchRegex.exec(fileContent);
101
98
  if (!match) {
102
99
  var swiftUIMatch = swiftUIRegex.exec(fileContent);
103
100
  if (!swiftUIMatch) {
101
+ // This branch is not reached, because we already checked for SwiftUI in isAppDelegateFile
104
102
  return false;
105
103
  }
106
104
  //Is SwiftUI with no init
@@ -127,8 +125,14 @@ function addCodeSnippetToProject(projPath, files, dsn) {
127
125
  }
128
126
  }
129
127
  fs.writeFileSync(appDelegate, newFileContent, 'utf8');
130
- prompts_1.default.log.step('Added Sentry initialization code snippet to ' + appDelegate);
128
+ clack.log.step('Added Sentry initialization code snippet to ' + appDelegate);
131
129
  return true;
132
130
  }
133
131
  exports.addCodeSnippetToProject = addCodeSnippetToProject;
132
+ if (process.env.NODE_ENV === 'test') {
133
+ exports.exportForTesting = {
134
+ isAppDelegateFile: isAppDelegateFile,
135
+ findAppDidFinishLaunchingWithOptions: findAppDidFinishLaunchingWithOptions,
136
+ };
137
+ }
134
138
  //# sourceMappingURL=code-tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-tools.js","sourceRoot":"","sources":["../../../src/apple/code-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,qDAAyC;AACzC,mDAAuC;AACvC,yEAAyE;AACzE,2DAAmC;AAEnC,IAAM,mBAAmB,GACvB,6LAA6L,CAAC;AAChM,IAAM,kBAAkB,GACtB,mJAAmJ,CAAC;AACtJ,IAAM,YAAY,GAAG,kCAAkC,CAAC;AAExD,SAAS,iBAAiB,CAAC,QAAgB;IACzC,IAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC9D,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,kBAAkB,CAAC;IAEvB,IAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACtD,OAAO,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,oCAAoC,CAC3C,GAAW,EACX,KAAuC;IAAvC,sBAAA,EAAA,iBAAuC;IAEvC,IAAI,CAAC,KAAK,EAAE;QACV,KAAK,GAAG,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAC5B,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAjB,CAAiB,CAAC,CAAC;KAC7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O,CAAC;KACnD;IAED,IAAM,WAAW,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAClD,IAAI,cAAc,GAChB,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;QACjC,IAAI;QACJ,WAAW;QACX,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAEjC,IAAI,cAAc,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE;QAC/C,IAAM,WAAW,GAAG,wBAAwB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAClE,IAAI,WAAW,EAAE;YACf,IAAM,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,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,8CAA8C,GAAG,WAAW,CAAC,CAAC;IAC7E,OAAO,IAAI,CAAC;AACd,CAAC;AArED,0DAqEC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as templates from './templates';\nimport * as Sentry from '@sentry/node';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nconst swiftAppLaunchRegex =\n /(func\\s+application\\s*\\(_\\sapplication:[^,]+,\\s*didFinishLaunchingWithOptions[^,]+:[^)]+\\)\\s+->\\s+Bool\\s+{)|func\\s+applicationDidFinishLaunching\\(_\\s+aNotification:\\s+Notification\\)\\s+{/im;\nconst objcAppLaunchRegex =\n /-\\s*\\(BOOL\\)\\s*application:\\s*\\(UIApplication\\s*\\*\\)\\s*application\\s+didFinishLaunchingWithOptions:\\s*\\(NSDictionary\\s*\\*\\)\\s*launchOptions\\s*{/im;\nconst swiftUIRegex = /@main\\s+struct[^:]+:\\s*App\\s*{/im;\n\nfunction isAppDelegateFile(filePath: string): boolean {\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 findAppDidFinishLaunchingWithOptions(\n dir: string,\n files: string[] | undefined = undefined,\n): string | null {\n if (!files) {\n files = fs.readdirSync(dir);\n files = files.map((f) => path.join(dir, f));\n }\n\n //iterate over subdirectories later,\n //the appdelegate usually is in the top level\n const dirs: string[] = [];\n\n for (const filePath of files) {\n if (\n filePath.endsWith('.swift') ||\n filePath.endsWith('.m') ||\n filePath.endsWith('.mm')\n ) {\n if (fs.existsSync(filePath) && isAppDelegateFile(filePath)) {\n return filePath;\n }\n } else if (\n !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 = findAppDidFinishLaunchingWithOptions(dr);\n if (result) return result;\n }\n return null;\n}\n\nexport function addCodeSnippetToProject(\n projPath: string,\n files: string[],\n dsn: string,\n): boolean {\n const appDelegate = findAppDidFinishLaunchingWithOptions(projPath, 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)\n : templates.getObjcSnippet(dsn);\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 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"]}
1
+ {"version":3,"file":"code-tools.js","sourceRoot":"","sources":["../../../src/apple/code-tools.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AACvC,qCAAyB;AACzB,yCAA6B;AAC7B,qDAAyC;AACzC,yEAAyE;AACzE,oDAAwC;AAExC,IAAM,mBAAmB,GACvB,mNAAmN,CAAC;AACtN,IAAM,kBAAkB,GACtB,qKAAqK,CAAC;AACxK,IAAM,YAAY,GAAG,8CAA8C,CAAC;AAEpE,SAAS,iBAAiB,CAAC,QA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C,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;AASD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;IACnC,wBAAgB,GAAG;QACjB,iBAAiB,mBAAA;QACjB,oCAAoC,sCAAA;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-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\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 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 findAppDidFinishLaunchingWithOptions(\n dir: string,\n files: string[] | undefined = undefined,\n): string | null {\n if (!files) {\n files = fs.readdirSync(dir);\n files = files.map((f) => path.join(dir, f));\n }\n\n //iterate over subdirectories later,\n //the appdelegate usually is in the top level\n const dirs: string[] = [];\n\n for (const filePath of files) {\n if (\n filePath.endsWith('.swift') ||\n filePath.endsWith('.m') ||\n filePath.endsWith('.mm')\n ) {\n if (fs.existsSync(filePath) && isAppDelegateFile(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 = findAppDidFinishLaunchingWithOptions(dr);\n if (result) return result;\n }\n return null;\n}\n\nexport function addCodeSnippetToProject(\n projPath: string,\n files: string[],\n dsn: string,\n): boolean {\n const appDelegate = findAppDidFinishLaunchingWithOptions(projPath, 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)\n : templates.getObjcSnippet(dsn);\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 findAppDidFinishLaunchingWithOptions: typeof findAppDidFinishLaunchingWithOptions;\n};\nif (process.env.NODE_ENV === 'test') {\n exportForTesting = {\n isAppDelegateFile,\n findAppDidFinishLaunchingWithOptions,\n };\n}\n"]}
@@ -1,2 +1,25 @@
1
1
  export declare function fastFile(projectPath: string): string | null;
2
+ declare function findIOSPlatform(content: string): {
3
+ index: number;
4
+ length: number;
5
+ } | null;
6
+ declare function findLanes(content: string): {
7
+ index: number;
8
+ length: number;
9
+ name: string;
10
+ }[] | null;
11
+ declare function addSentryToLane(content: string, lane: {
12
+ index: number;
13
+ length: number;
14
+ name: string;
15
+ }, org: string, project: string): string;
2
16
  export declare function addSentryToFastlane(projectPath: string, org: string, project: string): Promise<boolean>;
17
+ /**
18
+ * Exported for testing purposes, but should not be used in other modules.
19
+ */
20
+ export declare let exportForTesting: {
21
+ findIOSPlatform: typeof findIOSPlatform;
22
+ findLanes: typeof findLanes;
23
+ addSentryToLane: typeof addSentryToLane;
24
+ };
25
+ export {};
@@ -58,17 +58,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
58
58
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
59
  }
60
60
  };
61
- var __importDefault = (this && this.__importDefault) || function (mod) {
62
- return (mod && mod.__esModule) ? mod : { "default": mod };
63
- };
64
61
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.addSentryToFastlane = exports.fastFile = void 0;
62
+ exports.exportForTesting = exports.addSentryToFastlane = exports.fastFile = void 0;
66
63
  var fs = __importStar(require("fs"));
67
64
  var path = __importStar(require("path"));
68
- var templates = __importStar(require("./templates"));
69
65
  var clack_utils_1 = require("../utils/clack-utils");
66
+ var templates = __importStar(require("./templates"));
70
67
  // @ts-ignore - clack is ESM and TS complains about that. It works though
71
- var prompts_1 = __importDefault(require("@clack/prompts"));
68
+ var clack = __importStar(require("@clack/prompts"));
72
69
  function fastFile(projectPath) {
73
70
  var fastlanePath = path.join(projectPath, 'fastlane', 'Fastfile');
74
71
  return fs.existsSync(fastlanePath) ? fastlanePath : null;
@@ -158,7 +155,7 @@ function addSentryToFastlane(projectPath, org, project) {
158
155
  lanes = findLanes(platformContent);
159
156
  lanes === null || lanes === void 0 ? void 0 : lanes.forEach(function (l) { return (l.index += platform.index); });
160
157
  if (!lanes || lanes.length === 0) {
161
- prompts_1.default.log.warn('No suitable lanes in your Fastfile.');
158
+ clack.log.warn('No suitable lanes in your Fastfile.');
162
159
  return [2 /*return*/, false];
163
160
  }
164
161
  if (!(lanes.length === 1)) return [3 /*break*/, 1];
@@ -182,4 +179,11 @@ function addSentryToFastlane(projectPath, org, project) {
182
179
  });
183
180
  }
184
181
  exports.addSentryToFastlane = addSentryToFastlane;
182
+ if (process.env.NODE_ENV === 'test') {
183
+ exports.exportForTesting = {
184
+ findIOSPlatform: findIOSPlatform,
185
+ findLanes: findLanes,
186
+ addSentryToLane: addSentryToLane,
187
+ };
188
+ }
185
189
  //# sourceMappingURL=fastlane.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../../src/apple/fastlane.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,qDAAyC;AACzC,oDAA2D;AAC3D,yEAAyE;AACzE,2DAAmC;AAEnC,SAAgB,QAAQ,CAAC,WAAmB;IAC1C,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACpE,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAHD,4BAGC;AAED,SAAS,eAAe,CACtB,OAAe;IAEf,IAAM,aAAa,GAAG,mCAAmC,CAAC;IAC1D,IAAI,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxC,IAAI,CAAC,KAAK,EAAE;QACV,uDAAuD;QACvD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;KAC7C;IAED,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC;IACf,OAAO,KAAK,EAAE;QACZ,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE;YACtB,KAAK,GAAG,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;YACtC,MAAM;SACP;QACD,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KACrC;IAED,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,IAAI,CAAC;KACb;IAED,4EAA4E;IAC5E,gEA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oBACI,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC;oBACzC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,EAA3B,CAA2B,CAAC,CAAC;oBAEnD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;wBAChC,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;wBACtD,sBAAO,KAAK,EAAC;qBACd;yBAGG,CAAA,KAAK,CAAC,MAAM,KAAK,CAAC,CAAA,EAAlB,wBAAkB;oBACpB,cAAc,GAAG,eAAe,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;;;oBAEhE,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,CAAC;oBACtB,qBAAM,IAAA,iCAAmB,EAC5C,SAAS,EACT,+BAA+B,CAChC,EAAA;;oBAHK,YAAY,GAAG,SAGpB;oBACD,IAAI,YAAY,KAAK,SAAS,EAAE;wBAC9B,sBAAO,KAAK,EAAC;qBACd;oBACD,cAAc,GAAG,eAAe,CAC9B,WAAW,EACX,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EACzB,GAAG,EACH,OAAO,CACR,CAAC;;;oBAGJ,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;oBACvD,sBAAO,IAAI,EAAC;;;;CACb;AAlDD,kDAkDC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport * as templates from './templates';\nimport { askForItemSelection } from '../utils/clack-utils';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\nexport function fastFile(projectPath: string): string | null {\n const fastlanePath = path.join(projectPath, 'fastlane', 'Fastfile');\n return fs.existsSync(fastlanePath) ? fastlanePath : null;\n}\n\nfunction findIOSPlatform(\n content: string,\n): { index: number; length: number } | null {\n const platformRegex = /^ *platform\\s+:([^ ]+)[^\\n]*\\n/gim;\n let match = platformRegex.exec(content);\n if (!match) {\n // No platform found, treat whole file as one platform.\n return { index: 0, length: content.length };\n }\n\n let index = -1;\n while (match) {\n if (match[1] === 'ios') {\n index = match.index + match[0].length;\n break;\n }\n match = platformRegex.exec(content);\n }\n\n if (index === -1) {\n return null;\n }\n\n //After finding the platform, we need to find the end of the platform block.\n //This solution has the assumption that the file is well formed,\n //which is not a perfect solution, but it's good enough assumption.\n const platformEndRegex = /^end[^\\n]*/gim;\n match = platformEndRegex.exec(content.slice(index));\n if (!match) {\n return null;\n }\n\n return { index, length: match.index };\n}\n\nfunction findLanes(\n content: string,\n): { index: number; length: number; name: string }[] | null {\n const laneRegex = /^ {2}lane\\s+:([^ ]+)[^\\n]*\\n/gim;\n let match = laneRegex.exec(content);\n if (!match) {\n return null;\n }\n\n const lanes: { index: number; length: number; name: string }[] = [];\n while (match) {\n const laneEnd = /^ {2}end/m.exec(\n content.slice(match.index + match[0].length),\n );\n if (laneEnd === null) {\n return null;\n }\n lanes.push({\n index: match.index + match[0].length,\n length: laneEnd.index,\n name: match[1],\n });\n match = laneRegex.exec(content);\n }\n return lanes;\n}\n\nfunction addSentryToLane(\n content: string,\n lane: { index: number; length: number; name: string },\n org: string,\n project: string,\n): string {\n const laneContent = content.slice(lane.index, lane.index + lane.length);\n const sentryCLIMatch = /sentry_cli\\s*\\([^)]+\\)/gim.exec(laneContent);\n if (sentryCLIMatch) {\n // Sentry already added to lane. Update it.\n return (\n content.slice(0, sentryCLIMatch.index + lane.index) +\n templates.getFastlaneSnippet(org, project).trim() +\n content.slice(\n sentryCLIMatch.index + sentryCLIMatch[0].length + lane.index,\n )\n );\n }\n\n // Sentry not added to lane. Add it.\n return (\n content.slice(0, lane.index + lane.length) +\n '\\n' +\n templates.getFastlaneSnippet(org, project) +\n '\\n' +\n content.slice(lane.index + lane.length)\n );\n}\n\nexport async function addSentryToFastlane(\n projectPath: string,\n org: string,\n project: string,\n): Promise<boolean> {\n const fastFilePath = fastFile(projectPath);\n if (!fastFilePath) {\n return false;\n }\n\n const fileContent = fs.readFileSync(fastFilePath, 'utf8');\n const platform = findIOSPlatform(fileContent);\n if (!platform) {\n return false;\n }\n\n const platformContent = fileContent.slice(\n platform.index,\n platform.index + platform.length,\n );\n const lanes = findLanes(platformContent);\n lanes?.forEach((l) => (l.index += platform.index));\n\n if (!lanes || lanes.length === 0) {\n clack.log.warn('No suitable lanes in your Fastfile.');\n return false;\n }\n\n let newFileContent: string | undefined;\n if (lanes.length === 1) {\n newFileContent = addSentryToLane(fileContent, lanes[0], org, project);\n } else {\n const laneNames = lanes.map((l) => l.name);\n const selectedLane = await askForItemSelection(\n laneNames,\n 'Select lane to add Sentry to:',\n );\n if (selectedLane === undefined) {\n return false;\n }\n newFileContent = addSentryToLane(\n fileContent,\n lanes[selectedLane.index],\n org,\n project,\n );\n }\n\n fs.writeFileSync(fastFilePath, newFileContent, 'utf8');\n return true;\n}\n"]}
1
+ {"version":3,"file":"fastlane.js","sourceRoot":"","sources":["../../../src/apple/fastlane.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,oDAA2D;AAC3D,qDAAyC;AACzC,yEAAyE;AACzE,oDAAwC;AAExC,SAAgB,QAAQ,CAAC,WAAmB;IAC1C,IAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACpE,OAAO,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAHD,4BAGC;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CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,IAAI,EAAN,CAAM,CAAC,CAAC;oBACtB,qBAAM,IAAA,iCAAmB,EAC5C,SAAS,EACT,+BAA+B,CAChC,EAAA;;oBAHK,YAAY,GAAG,SAGpB;oBACD,IAAI,YAAY,KAAK,SAAS,EAAE;wBAC9B,sBAAO,KAAK,EAAC;qBACd;oBACD,cAAc,GAAG,eAAe,CAC9B,WAAW,EACX,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,EACzB,GAAG,EACH,OAAO,CACR,CAAC;;;oBAGJ,EAAE,CAAC,aAAa,CAAC,YAAY,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;oBACvD,sBAAO,IAAI,EAAC;;;;CACb;AAlDD,kDAkDC;AAUD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;IACnC,wBAAgB,GAAG;QACjB,eAAe,iBAAA;QACf,SAAS,WAAA;QACT,eAAe,iBAAA;KAChB,CAAC;CACH","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { askForItemSelection } from '../utils/clack-utils';\nimport * as templates from './templates';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n\nexport function fastFile(projectPath: string): string | null {\n const fastlanePath = path.join(projectPath, 'fastlane', 'Fastfile');\n return fs.existsSync(fastlanePath) ? fastlanePath : null;\n}\n\nfunction findIOSPlatform(\n content: string,\n): { index: number; length: number } | null {\n const platformRegex = /^ *platform\\s+:([^ ]+)[^\\n]*\\n/gim;\n let match = platformRegex.exec(content);\n if (!match) {\n // No platform found, treat whole file as one platform.\n return { index: 0, length: content.length };\n }\n\n let index = -1;\n while (match) {\n if (match[1] === 'ios') {\n index = match.index + match[0].length;\n break;\n }\n match = platformRegex.exec(content);\n }\n\n if (index === -1) {\n return null;\n }\n\n //After finding the platform, we need to find the end of the platform block.\n //This solution has the assumption that the file is well formed,\n //which is not a perfect solution, but it's good enough assumption.\n const platformEndRegex = /^end[^\\n]*/gim;\n match = platformEndRegex.exec(content.slice(index));\n if (!match) {\n return null;\n }\n\n return { index, length: match.index };\n}\n\nfunction findLanes(\n content: string,\n): { index: number; length: number; name: string }[] | null {\n const laneRegex = /^ {2}lane\\s+:([^ ]+)[^\\n]*\\n/gim;\n let match = laneRegex.exec(content);\n if (!match) {\n return null;\n }\n\n const lanes: { index: number; length: number; name: string }[] = [];\n while (match) {\n const laneEnd = /^ {2}end/m.exec(\n content.slice(match.index + match[0].length),\n );\n if (laneEnd === null) {\n return null;\n }\n lanes.push({\n index: match.index + match[0].length,\n length: laneEnd.index,\n name: match[1],\n });\n match = laneRegex.exec(content);\n }\n return lanes;\n}\n\nfunction addSentryToLane(\n content: string,\n lane: { index: number; length: number; name: string },\n org: string,\n project: string,\n): string {\n const laneContent = content.slice(lane.index, lane.index + lane.length);\n const sentryCLIMatch = /sentry_cli\\s*\\([^)]+\\)/gim.exec(laneContent);\n if (sentryCLIMatch) {\n // Sentry already added to lane. Update it.\n return (\n content.slice(0, sentryCLIMatch.index + lane.index) +\n templates.getFastlaneSnippet(org, project).trim() +\n content.slice(\n sentryCLIMatch.index + sentryCLIMatch[0].length + lane.index,\n )\n );\n }\n\n // Sentry not added to lane. Add it.\n return (\n content.slice(0, lane.index + lane.length) +\n '\\n' +\n templates.getFastlaneSnippet(org, project) +\n '\\n' +\n content.slice(lane.index + lane.length)\n );\n}\n\nexport async function addSentryToFastlane(\n projectPath: string,\n org: string,\n project: string,\n): Promise<boolean> {\n const fastFilePath = fastFile(projectPath);\n if (!fastFilePath) {\n return false;\n }\n\n const fileContent = fs.readFileSync(fastFilePath, 'utf8');\n const platform = findIOSPlatform(fileContent);\n if (!platform) {\n return false;\n }\n\n const platformContent = fileContent.slice(\n platform.index,\n platform.index + platform.length,\n );\n const lanes = findLanes(platformContent);\n lanes?.forEach((l) => (l.index += platform.index));\n\n if (!lanes || lanes.length === 0) {\n clack.log.warn('No suitable lanes in your Fastfile.');\n return false;\n }\n\n let newFileContent: string | undefined;\n if (lanes.length === 1) {\n newFileContent = addSentryToLane(fileContent, lanes[0], org, project);\n } else {\n const laneNames = lanes.map((l) => l.name);\n const selectedLane = await askForItemSelection(\n laneNames,\n 'Select lane to add Sentry to:',\n );\n if (selectedLane === undefined) {\n return false;\n }\n newFileContent = addSentryToLane(\n fileContent,\n lanes[selectedLane.index],\n org,\n project,\n );\n }\n\n fs.writeFileSync(fastFilePath, newFileContent, 'utf8');\n return true;\n}\n\n/**\n * Exported for testing purposes, but should not be used in other modules.\n */\nexport let exportForTesting: {\n findIOSPlatform: typeof findIOSPlatform;\n findLanes: typeof findLanes;\n addSentryToLane: typeof addSentryToLane;\n};\nif (process.env.NODE_ENV === 'test') {\n exportForTesting = {\n findIOSPlatform,\n findLanes,\n addSentryToLane,\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- export declare function getRunScriptTemplate(orgSlug: string, projectSlug: string, uploadSource?: boolean, includeHomebrewPath?: boolean): string;
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
3
  export declare function getSwiftSnippet(dsn: string): string;
4
4
  export declare function getObjcSnippet(dsn: string): string;
@@ -2,8 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getFastlaneSnippet = exports.getObjcSnippet = exports.getSwiftSnippet = exports.scriptInputPath = exports.getRunScriptTemplate = void 0;
4
4
  function getRunScriptTemplate(orgSlug, projectSlug, uploadSource, includeHomebrewPath) {
5
- if (uploadSource === void 0) { uploadSource = true; }
6
- if (includeHomebrewPath === void 0) { includeHomebrewPath = false; }
7
5
  // eslint-disable-next-line no-useless-escape
8
6
  var includeHomebrew = includeHomebrewPath
9
7
  ? '\\nif [[ "$(uname -m)" == arm64 ]]; then\\nexport PATH="/opt/homebrew/bin:$PATH"\\nfi'
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/apple/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,CAClC,OAAe,EACf,WAAmB,EACnB,YAAmB,EACnB,mBAA2B;IAD3B,6BAAA,EAAA,mBAAmB;IACnB,oCAAA,EAAA,2BAA2B;IAE3B,6CAA6C;IAC7C,IAAM,eAAe,GAAG,mBAAmB;QACzC,CAAC,CAAC,uFAAuF;QACzF,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,6FAAsF,eAAe,yEAA+D,OAAO,sCAA4B,WAAW,sDACvN,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,oPACiM,CAAC;AAC9O,CAAC;AAbD,oDAaC;AAEY,QAAA,eAAe,GAC1B,6FAA6F,CAAC;AAEhG,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,4EACoB,GAAG,u7BAeiC,CAAC;AAClE,CAAC;AAlBD,0CAkBC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,0GACiB,GAAG,y4BAe8B,CAAC;AAC5D,CAAC;AAlBD,wCAkBC;AAED,SAAgB,kBAAkB,CAAC,GAAW,EAAE,OAAe;IAC7D,OAAO,4CACU,GAAG,sCACC,OAAO,2CAExB,CAAC;AACP,CAAC;AAND,gDAMC","sourcesContent":["export function getRunScriptTemplate(\n orgSlug: string,\n projectSlug: string,\n uploadSource = true,\n includeHomebrewPath = false,\n): string {\n // eslint-disable-next-line no-useless-escape\n const includeHomebrew = includeHomebrewPath\n ? '\\\\nif [[ \"$(uname -m)\" == arm64 ]]; then\\\\nexport PATH=\"/opt/homebrew/bin:$PATH\"\\\\nfi'\n : '';\n return `# This script is responsable to upload debug symbols and source context for Sentry.${includeHomebrew}\\\\nif which sentry-cli >/dev/null; then\\\\nexport SENTRY_ORG=${orgSlug}\\\\nexport SENTRY_PROJECT=${projectSlug}\\\\nERROR=$(sentry-cli debug-files upload ${\n uploadSource ? '--include-sources ' : ''\n }\"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\\\\nif [ ! $? -eq 0 ]; then\\\\necho \"warning: sentry-cli - $ERROR\"\\\\nfi\\\\nelse\\\\necho \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\\\\nfi\\\\n`;\n}\n\nexport const scriptInputPath =\n '\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"';\n\nexport function getSwiftSnippet(dsn: string): string {\n return ` SentrySDK.start { options in\n options.dsn = \"${dsn}\"\n options.debug = true // Enabled debug when first installing is always helpful\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n\n // Sample rate for profiling, applied on top of TracesSampleRate.\n // We recommend adjusting this value in production.\n options.profilesSampleRate = 1.0 \n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\\n`;\n}\n\nexport function getObjcSnippet(dsn: string): string {\n return ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"${dsn}\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = @1.0;\n\n // Sample rate for profiling, applied on top of TracesSampleRate.\n // We recommend adjusting this value in production.\n options.profilesSampleRate = @1.0;\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\\n`;\n}\n\nexport function getFastlaneSnippet(org: string, project: string): string {\n return ` sentry_cli(\n org_slug: '${org}',\n project_slug: '${project}',\n include_sources: true\n )`;\n}\n"]}
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/apple/templates.ts"],"names":[],"mappings":";;;AAAA,SAAgB,oBAAoB,CAClC,OAAe,EACf,WAAmB,EACnB,YAAqB,EACrB,mBAA4B;IAE5B,6CAA6C;IAC7C,IAAM,eAAe,GAAG,mBAAmB;QACzC,CAAC,CAAC,uFAAuF;QACzF,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,6FAAsF,eAAe,yEAA+D,OAAO,sCAA4B,WAAW,sDACvN,YAAY,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,oPACiM,CAAC;AAC9O,CAAC;AAbD,oDAaC;AAEY,QAAA,eAAe,GAC1B,6FAA6F,CAAC;AAEhG,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO,4EACoB,GAAG,u7BAeiC,CAAC;AAClE,CAAC;AAlBD,0CAkBC;AAED,SAAgB,cAAc,CAAC,GAAW;IACxC,OAAO,0GACiB,GAAG,y4BAe8B,CAAC;AAC5D,CAAC;AAlBD,wCAkBC;AAED,SAAgB,kBAAkB,CAAC,GAAW,EAAE,OAAe;IAC7D,OAAO,4CACU,GAAG,sCACC,OAAO,2CAExB,CAAC;AACP,CAAC;AAND,gDAMC","sourcesContent":["export function getRunScriptTemplate(\n orgSlug: string,\n projectSlug: string,\n uploadSource: boolean,\n includeHomebrewPath: boolean,\n): string {\n // eslint-disable-next-line no-useless-escape\n const includeHomebrew = includeHomebrewPath\n ? '\\\\nif [[ \"$(uname -m)\" == arm64 ]]; then\\\\nexport PATH=\"/opt/homebrew/bin:$PATH\"\\\\nfi'\n : '';\n return `# This script is responsable to upload debug symbols and source context for Sentry.${includeHomebrew}\\\\nif which sentry-cli >/dev/null; then\\\\nexport SENTRY_ORG=${orgSlug}\\\\nexport SENTRY_PROJECT=${projectSlug}\\\\nERROR=$(sentry-cli debug-files upload ${\n uploadSource ? '--include-sources ' : ''\n }\"$DWARF_DSYM_FOLDER_PATH\" 2>&1 >/dev/null)\\\\nif [ ! $? -eq 0 ]; then\\\\necho \"warning: sentry-cli - $ERROR\"\\\\nfi\\\\nelse\\\\necho \"warning: sentry-cli not installed, download from https://github.com/getsentry/sentry-cli/releases\"\\\\nfi\\\\n`;\n}\n\nexport const scriptInputPath =\n '\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"';\n\nexport function getSwiftSnippet(dsn: string): string {\n return ` SentrySDK.start { options in\n options.dsn = \"${dsn}\"\n options.debug = true // Enabled debug when first installing is always helpful\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = 1.0\n\n // Sample rate for profiling, applied on top of TracesSampleRate.\n // We recommend adjusting this value in production.\n options.profilesSampleRate = 1.0 \n\n // Uncomment the following lines to add more data to your events\n // options.attachScreenshot = true // This adds a screenshot to the error events\n // options.attachViewHierarchy = true // This adds the view hierarchy to the error events\n }\n // Remove the next line after confirming that your Sentry integration is working.\n SentrySDK.capture(message: \"This app uses Sentry! :)\")\\n`;\n}\n\nexport function getObjcSnippet(dsn: string): string {\n return ` [SentrySDK startWithConfigureOptions:^(SentryOptions * options) {\n options.dsn = @\"${dsn}\";\n options.debug = YES; // Enabled debug when first installing is always helpful\n // Set tracesSampleRate to 1.0 to capture 100% of transactions for performance monitoring.\n // We recommend adjusting this value in production.\n options.tracesSampleRate = @1.0;\n\n // Sample rate for profiling, applied on top of TracesSampleRate.\n // We recommend adjusting this value in production.\n options.profilesSampleRate = @1.0;\n\n //Uncomment the following lines to add more data to your events\n //options.attachScreenshot = YES; //This will add a screenshot to the error events\n //options.attachViewHierarchy = YES; //This will add the view hierarchy to the error events\n }];\n //Remove the next line after confirming that your Sentry integration is working.\n [SentrySDK captureMessage:@\"This app uses Sentry!\"];\\n`;\n}\n\nexport function getFastlaneSnippet(org: string, project: string): string {\n return ` sentry_cli(\n org_slug: '${org}',\n project_slug: '${project}',\n include_sources: true\n )`;\n}\n"]}
@@ -1,20 +1,24 @@
1
1
  import { SentryProjectData } from '../utils/types';
2
- interface ProjetFile {
2
+ import { PBXGroup, PBXObjects, Project } from 'xcode';
3
+ interface ProjectFile {
3
4
  key: string;
4
5
  path: string;
5
6
  }
6
7
  export declare class XcodeProject {
7
8
  projectPath: string;
8
- project: any;
9
- objects: any;
10
- files: ProjetFile[] | undefined;
9
+ project: Project;
10
+ objects: PBXObjects;
11
+ files: ProjectFile[] | undefined;
12
+ /**
13
+ * Creates a new XcodeProject instance, a wrapper around the Xcode project file `<PROJECT>.xcodeproj/project.pbxproj`.
14
+ *
15
+ * @param projectPath - The path to the Xcode project file
16
+ */
11
17
  constructor(projectPath: string);
12
18
  getAllTargets(): string[];
13
- updateXcodeProject(sentryProject: SentryProjectData, target: string, apiKeys: {
14
- token: string;
15
- }, addSPMReference: boolean, uploadSource?: boolean): void;
19
+ updateXcodeProject(sentryProject: SentryProjectData, target: string, addSPMReference: boolean, uploadSource?: boolean): void;
16
20
  filesForTarget(target: string): string[] | undefined;
17
- projectFiles(): ProjetFile[];
18
- buildGroup(group: any, path?: string): ProjetFile[];
21
+ projectFiles(): ProjectFile[];
22
+ buildGroup(group: PBXGroup, path?: string): ProjectFile[];
19
23
  }
20
24
  export {};