@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
@@ -0,0 +1,409 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
+ return new (P || (P = Promise))(function (resolve, reject) {
28
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
+ var __generator = (this && this.__generator) || function (thisArg, body) {
35
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
36
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
37
+ function verb(n) { return function (v) { return step([n, v]); }; }
38
+ function step(op) {
39
+ if (f) throw new TypeError("Generator is already executing.");
40
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
41
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
42
+ if (y = 0, t) op = [op[0] & 2, t.value];
43
+ switch (op[0]) {
44
+ case 0: case 1: t = op; break;
45
+ case 4: _.label++; return { value: op[1], done: false };
46
+ case 5: _.label++; y = op[1]; op = [0]; continue;
47
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
48
+ default:
49
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
50
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
51
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
52
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
53
+ if (t[2]) _.ops.pop();
54
+ _.trys.pop(); continue;
55
+ }
56
+ op = body.call(thisArg, _);
57
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
58
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
59
+ }
60
+ };
61
+ Object.defineProperty(exports, "__esModule", { value: true });
62
+ var Sentry = __importStar(require("@sentry/node"));
63
+ var fs = __importStar(require("fs"));
64
+ var os = __importStar(require("os"));
65
+ var path = __importStar(require("path"));
66
+ var cocoapod_1 = require("../../src/apple/cocoapod");
67
+ var bash = __importStar(require("../../src/utils/bash"));
68
+ // @ts-ignore - clack is ESM and TS complains about that. It works though
69
+ var clack = __importStar(require("@clack/prompts"));
70
+ jest.mock('../../src/utils/bash');
71
+ jest.spyOn(Sentry, 'setTag').mockImplementation();
72
+ jest.spyOn(Sentry, 'captureException').mockImplementation();
73
+ var clackSpinnerMock = {
74
+ start: jest.fn(),
75
+ stop: jest.fn(),
76
+ message: jest.fn(),
77
+ };
78
+ describe('cocoapod', function () {
79
+ beforeEach(function () {
80
+ jest.spyOn(clack, 'spinner').mockReturnValue(clackSpinnerMock);
81
+ jest.spyOn(clack.log, 'error').mockImplementation();
82
+ });
83
+ afterEach(function () {
84
+ jest.clearAllMocks();
85
+ });
86
+ describe('usesCocoaPod', function () {
87
+ describe('Podfile exists', function () {
88
+ it('should return true', function () {
89
+ // -- Arrange --
90
+ var projPath = path.join(os.tmpdir(), 'test-project-with-podfile');
91
+ var tempDir = fs.mkdtempSync(projPath);
92
+ var podfile = path.join(tempDir, 'Podfile');
93
+ fs.writeFileSync(podfile, '');
94
+ // -- Act --
95
+ var result = (0, cocoapod_1.usesCocoaPod)(tempDir);
96
+ // -- Assert --
97
+ expect(result).toBeTruthy();
98
+ });
99
+ });
100
+ describe('Podfile does not exist', function () {
101
+ it('should return false', function () {
102
+ // -- Arrange --
103
+ var projPath = path.join(os.tmpdir(), 'test-project-without-podfile');
104
+ var tempDir = fs.mkdtempSync(projPath);
105
+ // -- Act --
106
+ var result = (0, cocoapod_1.usesCocoaPod)(tempDir);
107
+ // -- Assert --
108
+ expect(result).toBeFalsy();
109
+ });
110
+ });
111
+ });
112
+ describe('addCocoaPods', function () {
113
+ describe('Podfile does not exist', function () {
114
+ it('should throw an error', function () { return __awaiter(void 0, void 0, void 0, function () {
115
+ var projPath, tempDir;
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0:
119
+ projPath = path.join(os.tmpdir(), 'test-project-without-podfile');
120
+ tempDir = fs.mkdtempSync(projPath);
121
+ // -- Act & Assert --
122
+ return [4 /*yield*/, expect((0, cocoapod_1.addCocoaPods)(tempDir)).rejects.toThrow('ENOENT: no such file or directory, open')];
123
+ case 1:
124
+ // -- Act & Assert --
125
+ _a.sent();
126
+ return [2 /*return*/];
127
+ }
128
+ });
129
+ }); });
130
+ });
131
+ describe('Podfile exists', function () {
132
+ describe('Podfile includes Sentry pod', function () {
133
+ var variations = [
134
+ {
135
+ case: 'simple',
136
+ content: 'pod "Sentry"',
137
+ },
138
+ {
139
+ case: 'with-swiftui',
140
+ content: 'pod "SentrySwiftUI"',
141
+ },
142
+ {
143
+ case: 'leading-space',
144
+ content: ' pod "Sentry"',
145
+ },
146
+ {
147
+ case: 'leading-space-and-swiftui',
148
+ content: ' pod "SentrySwiftUI"',
149
+ },
150
+ {
151
+ case: 'trailing-space',
152
+ content: 'pod "Sentry" ',
153
+ },
154
+ {
155
+ case: 'trailing-space-and-swiftui',
156
+ content: 'pod "SentrySwiftUI" ',
157
+ },
158
+ {
159
+ case: 'single-quotes',
160
+ content: "pod 'Sentry'",
161
+ },
162
+ {
163
+ case: 'double-quotes',
164
+ content: 'pod "Sentry"',
165
+ },
166
+ ];
167
+ var _loop_1 = function (variation) {
168
+ it("should not change the Podfile for ".concat(variation.case), function () { return __awaiter(void 0, void 0, void 0, function () {
169
+ var projPath, podfile, result;
170
+ return __generator(this, function (_a) {
171
+ switch (_a.label) {
172
+ case 0:
173
+ projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
174
+ fs.mkdirSync(projPath, {
175
+ recursive: true,
176
+ });
177
+ podfile = path.join(projPath, 'Podfile');
178
+ fs.writeFileSync(podfile, variation.content, 'utf8');
179
+ return [4 /*yield*/, (0, cocoapod_1.addCocoaPods)(projPath)];
180
+ case 1:
181
+ result = _a.sent();
182
+ // -- Assert --
183
+ expect(result).toBeTruthy();
184
+ expect(fs.readFileSync(podfile, 'utf8')).toBe(variation.content);
185
+ return [2 /*return*/];
186
+ }
187
+ });
188
+ }); });
189
+ };
190
+ for (var _i = 0, variations_1 = variations; _i < variations_1.length; _i++) {
191
+ var variation = variations_1[_i];
192
+ _loop_1(variation);
193
+ }
194
+ });
195
+ describe('Podfile includes no other pods', function () {
196
+ describe('Podfile does not include use_frameworks!', function () {
197
+ it('should not change the Podfile', function () { return __awaiter(void 0, void 0, void 0, function () {
198
+ var projPath, podfile, result;
199
+ return __generator(this, function (_a) {
200
+ switch (_a.label) {
201
+ case 0:
202
+ projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
203
+ fs.mkdirSync(projPath, {
204
+ recursive: true,
205
+ });
206
+ podfile = path.join(projPath, 'Podfile');
207
+ fs.writeFileSync(podfile, '', 'utf8');
208
+ return [4 /*yield*/, (0, cocoapod_1.addCocoaPods)(projPath)];
209
+ case 1:
210
+ result = _a.sent();
211
+ // -- Assert --
212
+ expect(result).toBeFalsy();
213
+ expect(fs.readFileSync(podfile, 'utf8')).toBe('');
214
+ return [2 /*return*/];
215
+ }
216
+ });
217
+ }); });
218
+ });
219
+ describe('Podfile includes use_frameworks!', function () {
220
+ it('should change the Podfile', function () { return __awaiter(void 0, void 0, void 0, function () {
221
+ var projPath, podfile, result;
222
+ return __generator(this, function (_a) {
223
+ switch (_a.label) {
224
+ case 0:
225
+ projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
226
+ fs.mkdirSync(projPath, {
227
+ recursive: true,
228
+ });
229
+ podfile = path.join(projPath, 'Podfile');
230
+ fs.writeFileSync(podfile, "use_frameworks!", 'utf8');
231
+ return [4 /*yield*/, (0, cocoapod_1.addCocoaPods)(projPath)];
232
+ case 1:
233
+ result = _a.sent();
234
+ // -- Assert --
235
+ expect(result).toBeTruthy();
236
+ expect(fs.readFileSync(podfile, 'utf8')).toBe("use_frameworks!\npod 'Sentry'\n");
237
+ return [2 /*return*/];
238
+ }
239
+ });
240
+ }); });
241
+ });
242
+ });
243
+ describe('Podfile includes other pods', function () {
244
+ it('should append Sentry pod after last pod', function () { return __awaiter(void 0, void 0, void 0, function () {
245
+ var projPath, podfile, result;
246
+ return __generator(this, function (_a) {
247
+ switch (_a.label) {
248
+ case 0:
249
+ projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));
250
+ fs.mkdirSync(projPath, {
251
+ recursive: true,
252
+ });
253
+ podfile = path.join(projPath, 'Podfile');
254
+ fs.writeFileSync(podfile, 'pod "OtherPod"', 'utf8');
255
+ return [4 /*yield*/, (0, cocoapod_1.addCocoaPods)(projPath)];
256
+ case 1:
257
+ result = _a.sent();
258
+ // -- Assert --
259
+ expect(result).toBeTruthy();
260
+ expect(fs.readFileSync(podfile, 'utf8')).toBe("pod \"OtherPod\"\npod 'Sentry'\n");
261
+ return [2 /*return*/];
262
+ }
263
+ });
264
+ }); });
265
+ });
266
+ });
267
+ });
268
+ describe('podInstall', function () {
269
+ var workDir;
270
+ beforeEach(function () {
271
+ workDir = path.join(os.tmpdir(), 'test-project');
272
+ });
273
+ describe('any bash scripts fail', function () {
274
+ beforeEach(function () {
275
+ jest.spyOn(bash, 'execute').mockRejectedValue(new Error('test error'));
276
+ });
277
+ it('should not throw an error', function () { return __awaiter(void 0, void 0, void 0, function () {
278
+ return __generator(this, function (_a) {
279
+ switch (_a.label) {
280
+ case 0:
281
+ // -- Act & Assert --
282
+ return [4 /*yield*/, expect((0, cocoapod_1.podInstall)(workDir)).resolves.not.toThrow()];
283
+ case 1:
284
+ // -- Act & Assert --
285
+ _a.sent();
286
+ return [2 /*return*/];
287
+ }
288
+ });
289
+ }); });
290
+ it('should set tag', function () { return __awaiter(void 0, void 0, void 0, function () {
291
+ return __generator(this, function (_a) {
292
+ switch (_a.label) {
293
+ case 0:
294
+ // -- Act --
295
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)(workDir)];
296
+ case 1:
297
+ // -- Act --
298
+ _a.sent();
299
+ // -- Assert --
300
+ expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', false);
301
+ return [2 /*return*/];
302
+ }
303
+ });
304
+ }); });
305
+ it('should capture exception', function () { return __awaiter(void 0, void 0, void 0, function () {
306
+ return __generator(this, function (_a) {
307
+ switch (_a.label) {
308
+ case 0:
309
+ // -- Act --
310
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)(workDir)];
311
+ case 1:
312
+ // -- Act --
313
+ _a.sent();
314
+ // -- Assert --
315
+ expect(Sentry.captureException).toHaveBeenCalledWith('Sentry pod install failed.');
316
+ return [2 /*return*/];
317
+ }
318
+ });
319
+ }); });
320
+ it('should start and stop spinner', function () { return __awaiter(void 0, void 0, void 0, function () {
321
+ return __generator(this, function (_a) {
322
+ switch (_a.label) {
323
+ case 0:
324
+ // -- Act --
325
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)(workDir)];
326
+ case 1:
327
+ // -- Act --
328
+ _a.sent();
329
+ // -- Assert --
330
+ expect(clackSpinnerMock.start).toHaveBeenCalledWith("Running 'pod install'. This may take a few minutes...");
331
+ expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Failed to install pods.');
332
+ return [2 /*return*/];
333
+ }
334
+ });
335
+ }); });
336
+ });
337
+ describe('all bash scripts work', function () {
338
+ beforeEach(function () {
339
+ jest.spyOn(bash, 'execute').mockResolvedValue('');
340
+ });
341
+ it('should call pod update and install', function () { return __awaiter(void 0, void 0, void 0, function () {
342
+ return __generator(this, function (_a) {
343
+ switch (_a.label) {
344
+ case 0:
345
+ // -- Act --
346
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)(workDir)];
347
+ case 1:
348
+ // -- Act --
349
+ _a.sent();
350
+ // -- Assert --
351
+ expect(bash.execute).toHaveBeenCalledWith("cd ".concat(workDir, " && pod repo update"));
352
+ expect(bash.execute).toHaveBeenCalledWith("cd ".concat(workDir, " && pod install --silent"));
353
+ return [2 /*return*/];
354
+ }
355
+ });
356
+ }); });
357
+ it('should set tag', function () { return __awaiter(void 0, void 0, void 0, function () {
358
+ return __generator(this, function (_a) {
359
+ switch (_a.label) {
360
+ case 0:
361
+ // -- Act --
362
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)(workDir)];
363
+ case 1:
364
+ // -- Act --
365
+ _a.sent();
366
+ // -- Assert --
367
+ expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', true);
368
+ return [2 /*return*/];
369
+ }
370
+ });
371
+ }); });
372
+ it('should start and stop spinner', function () { return __awaiter(void 0, void 0, void 0, function () {
373
+ return __generator(this, function (_a) {
374
+ switch (_a.label) {
375
+ case 0:
376
+ // -- Act --
377
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)(workDir)];
378
+ case 1:
379
+ // -- Act --
380
+ _a.sent();
381
+ // -- Assert --
382
+ expect(clackSpinnerMock.start).toHaveBeenCalledWith("Running 'pod install'. This may take a few minutes...");
383
+ expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Pods installed.');
384
+ return [2 /*return*/];
385
+ }
386
+ });
387
+ }); });
388
+ });
389
+ describe('dir not given', function () {
390
+ it('should use current directory', function () { return __awaiter(void 0, void 0, void 0, function () {
391
+ return __generator(this, function (_a) {
392
+ switch (_a.label) {
393
+ case 0:
394
+ // -- Act --
395
+ return [4 /*yield*/, (0, cocoapod_1.podInstall)()];
396
+ case 1:
397
+ // -- Act --
398
+ _a.sent();
399
+ // -- Assert --
400
+ expect(bash.execute).toHaveBeenCalledWith("cd . && pod repo update");
401
+ expect(bash.execute).toHaveBeenCalledWith("cd . && pod install --silent");
402
+ return [2 /*return*/];
403
+ }
404
+ });
405
+ }); });
406
+ });
407
+ });
408
+ });
409
+ //# sourceMappingURL=cocoapod.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cocoapod.test.js","sourceRoot":"","sources":["../../../test/apple/cocoapod.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAuC;AACvC,qCAAyB;AACzB,qCAAyB;AACzB,yCAA6B;AAC7B,qDAIkC;AAClC,yDAA6C;AAC7C,yEAAyE;AACzE,oDAAwC;AAExC,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAClC,IAAI,CAAC,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I,CAAC,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;;;;iBACvE,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,QAAQ,CAAC,eAAe,EAAE;YACxB,EAAE,CAAC,8BAA8B,EAAE;;;;wBACjC,YAAY;wBACZ,qBAAM,IAAA,qBAAU,GAAE,EAAA;;4BADlB,YAAY;4BACZ,SAAkB,CAAC;4BAEnB,eAAe;4BACf,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,yBAAyB,CAAC,CAAC;4BACrE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CACvC,8BAA8B,CAC/B,CAAC;;;;iBACH,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as Sentry from '@sentry/node';\nimport * as fs from 'fs';\nimport * as os from 'os';\nimport * as path from 'path';\nimport {\n addCocoaPods,\n podInstall,\n usesCocoaPod,\n} from '../../src/apple/cocoapod';\nimport * as bash from '../../src/utils/bash';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\n\njest.mock('../../src/utils/bash');\njest.spyOn(Sentry, 'setTag').mockImplementation();\njest.spyOn(Sentry, 'captureException').mockImplementation();\n\nconst clackSpinnerMock = {\n start: jest.fn(),\n stop: jest.fn(),\n message: jest.fn(),\n};\n\ndescribe('cocoapod', () => {\n beforeEach(() => {\n jest.spyOn(clack, 'spinner').mockReturnValue(clackSpinnerMock);\n jest.spyOn(clack.log, 'error').mockImplementation();\n });\n\n afterEach(() => {\n jest.clearAllMocks();\n });\n\n describe('usesCocoaPod', () => {\n describe('Podfile exists', () => {\n it('should return true', () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-with-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n const podfile = path.join(tempDir, 'Podfile');\n fs.writeFileSync(podfile, '');\n\n // -- Act --\n const result = usesCocoaPod(tempDir);\n\n // -- Assert --\n expect(result).toBeTruthy();\n });\n });\n\n describe('Podfile does not exist', () => {\n it('should return false', () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n // -- Act --\n const result = usesCocoaPod(tempDir);\n\n // -- Assert --\n expect(result).toBeFalsy();\n });\n });\n });\n\n describe('addCocoaPods', () => {\n describe('Podfile does not exist', () => {\n it('should throw an error', async () => {\n // -- Arrange --\n const projPath = path.join(os.tmpdir(), 'test-project-without-podfile');\n const tempDir = fs.mkdtempSync(projPath);\n\n // -- Act & Assert --\n await expect(addCocoaPods(tempDir)).rejects.toThrow(\n 'ENOENT: no such file or directory, open',\n );\n });\n });\n\n describe('Podfile exists', () => {\n describe('Podfile includes Sentry pod', () => {\n const variations = [\n {\n case: 'simple',\n content: 'pod \"Sentry\"',\n },\n {\n case: 'with-swiftui',\n content: 'pod \"SentrySwiftUI\"',\n },\n {\n case: 'leading-space',\n content: ' pod \"Sentry\"',\n },\n {\n case: 'leading-space-and-swiftui',\n content: ' pod \"SentrySwiftUI\"',\n },\n {\n case: 'trailing-space',\n content: 'pod \"Sentry\" ',\n },\n {\n case: 'trailing-space-and-swiftui',\n content: 'pod \"SentrySwiftUI\" ',\n },\n {\n case: 'single-quotes',\n content: \"pod 'Sentry'\",\n },\n {\n case: 'double-quotes',\n content: 'pod \"Sentry\"',\n },\n ];\n for (const variation of variations) {\n it(`should not change the Podfile for ${variation.case}`, async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, variation.content, 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(variation.content);\n });\n }\n });\n\n describe('Podfile includes no other pods', () => {\n describe('Podfile does not include use_frameworks!', () => {\n it('should not change the Podfile', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, '', 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeFalsy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe('');\n });\n });\n\n describe('Podfile includes use_frameworks!', () => {\n it('should change the Podfile', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, `use_frameworks!`, 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(\n `use_frameworks!\\npod 'Sentry'\\n`,\n );\n });\n });\n });\n\n describe('Podfile includes other pods', () => {\n it('should append Sentry pod after last pod', async () => {\n // -- Arrange --\n const projPath = fs.mkdtempSync(path.join(os.tmpdir(), 'project'));\n fs.mkdirSync(projPath, {\n recursive: true,\n });\n\n const podfile = path.join(projPath, 'Podfile');\n fs.writeFileSync(podfile, 'pod \"OtherPod\"', 'utf8');\n\n // -- Act --\n const result = await addCocoaPods(projPath);\n\n // -- Assert --\n expect(result).toBeTruthy();\n expect(fs.readFileSync(podfile, 'utf8')).toBe(\n `pod \"OtherPod\"\\npod 'Sentry'\\n`,\n );\n });\n });\n });\n });\n\n describe('podInstall', () => {\n let workDir: string;\n\n beforeEach(() => {\n workDir = path.join(os.tmpdir(), 'test-project');\n });\n\n describe('any bash scripts fail', () => {\n beforeEach(() => {\n jest.spyOn(bash, 'execute').mockRejectedValue(new Error('test error'));\n });\n\n it('should not throw an error', async () => {\n // -- Act & Assert --\n await expect(podInstall(workDir)).resolves.not.toThrow();\n });\n\n it('should set tag', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', false);\n });\n\n it('should capture exception', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.captureException).toHaveBeenCalledWith(\n 'Sentry pod install failed.',\n );\n });\n\n it('should start and stop spinner', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(clackSpinnerMock.start).toHaveBeenCalledWith(\n \"Running 'pod install'. This may take a few minutes...\",\n );\n expect(clackSpinnerMock.stop).toHaveBeenCalledWith(\n 'Failed to install pods.',\n );\n });\n });\n\n describe('all bash scripts work', () => {\n beforeEach(() => {\n jest.spyOn(bash, 'execute').mockResolvedValue('');\n });\n\n it('should call pod update and install', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(bash.execute).toHaveBeenCalledWith(\n `cd ${workDir} && pod repo update`,\n );\n expect(bash.execute).toHaveBeenCalledWith(\n `cd ${workDir} && pod install --silent`,\n );\n });\n\n it('should set tag', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(Sentry.setTag).toHaveBeenCalledWith('pods-installed', true);\n });\n\n it('should start and stop spinner', async () => {\n // -- Act --\n await podInstall(workDir);\n\n // -- Assert --\n expect(clackSpinnerMock.start).toHaveBeenCalledWith(\n \"Running 'pod install'. This may take a few minutes...\",\n );\n expect(clackSpinnerMock.stop).toHaveBeenCalledWith('Pods installed.');\n });\n });\n\n describe('dir not given', () => {\n it('should use current directory', async () => {\n // -- Act --\n await podInstall();\n\n // -- Assert --\n expect(bash.execute).toHaveBeenCalledWith(`cd . && pod repo update`);\n expect(bash.execute).toHaveBeenCalledWith(\n `cd . && pod install --silent`,\n );\n });\n });\n });\n});\n"]}
@@ -0,0 +1 @@
1
+ export {};