@nx/react-native 0.0.0-pr-22179-271588f

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 (276) hide show
  1. package/.eslintrc.json +48 -0
  2. package/LICENSE +22 -0
  3. package/README.md +68 -0
  4. package/executors.json +59 -0
  5. package/generators.json +58 -0
  6. package/index.d.ts +5 -0
  7. package/index.js +13 -0
  8. package/migrations.json +632 -0
  9. package/package.json +57 -0
  10. package/plugin.d.ts +1 -0
  11. package/plugin.js +6 -0
  12. package/plugins/jest/svg-mock.d.ts +0 -0
  13. package/plugins/jest/svg-mock.js +3 -0
  14. package/plugins/metro-resolver.d.ts +1 -0
  15. package/plugins/metro-resolver.js +136 -0
  16. package/plugins/plugin.d.ts +14 -0
  17. package/plugins/plugin.js +162 -0
  18. package/plugins/with-nx-metro.d.ts +8 -0
  19. package/plugins/with-nx-metro.js +31 -0
  20. package/project.json +54 -0
  21. package/src/executors/build-android/build-android.impl.d.ts +6 -0
  22. package/src/executors/build-android/build-android.impl.js +48 -0
  23. package/src/executors/build-android/build-android.impl.ts +69 -0
  24. package/src/executors/build-android/schema.d.ts +14 -0
  25. package/src/executors/build-android/schema.json +81 -0
  26. package/src/executors/build-ios/build-ios.impl.d.ts +6 -0
  27. package/src/executors/build-ios/build-ios.impl.js +55 -0
  28. package/src/executors/build-ios/build-ios.impl.ts +77 -0
  29. package/src/executors/build-ios/schema.d.ts +17 -0
  30. package/src/executors/build-ios/schema.json +91 -0
  31. package/src/executors/bundle/bundle.impl.d.ts +6 -0
  32. package/src/executors/bundle/bundle.impl.js +56 -0
  33. package/src/executors/bundle/bundle.impl.ts +77 -0
  34. package/src/executors/bundle/schema.d.ts +16 -0
  35. package/src/executors/bundle/schema.json +92 -0
  36. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +9 -0
  37. package/src/executors/ensure-symlink/ensure-symlink.impl.js +13 -0
  38. package/src/executors/ensure-symlink/ensure-symlink.impl.ts +22 -0
  39. package/src/executors/ensure-symlink/schema.json +11 -0
  40. package/src/executors/pod-install/pod-install.impl.d.ts +6 -0
  41. package/src/executors/pod-install/pod-install.impl.js +11 -0
  42. package/src/executors/pod-install/pod-install.impl.ts +21 -0
  43. package/src/executors/pod-install/schema.d.ts +6 -0
  44. package/src/executors/pod-install/schema.json +33 -0
  45. package/src/executors/run-android/run-android.impl.d.ts +6 -0
  46. package/src/executors/run-android/run-android.impl.js +66 -0
  47. package/src/executors/run-android/run-android.impl.ts +94 -0
  48. package/src/executors/run-android/schema.d.ts +13 -0
  49. package/src/executors/run-android/schema.json +100 -0
  50. package/src/executors/run-ios/run-ios.impl.d.ts +6 -0
  51. package/src/executors/run-ios/run-ios.impl.js +65 -0
  52. package/src/executors/run-ios/run-ios.impl.ts +92 -0
  53. package/src/executors/run-ios/schema.d.ts +7 -0
  54. package/src/executors/run-ios/schema.json +96 -0
  55. package/src/executors/start/lib/is-packager-running.d.ts +1 -0
  56. package/src/executors/start/lib/is-packager-running.js +15 -0
  57. package/src/executors/start/schema.d.ts +7 -0
  58. package/src/executors/start/schema.json +28 -0
  59. package/src/executors/start/start.impl.d.ts +10 -0
  60. package/src/executors/start/start.impl.js +87 -0
  61. package/src/executors/start/start.impl.ts +111 -0
  62. package/src/executors/storybook/schema.d.ts +5 -0
  63. package/src/executors/storybook/schema.json +29 -0
  64. package/src/executors/storybook/storybook.impl.d.ts +10 -0
  65. package/src/executors/storybook/storybook.impl.js +51 -0
  66. package/src/executors/storybook/storybook.impl.ts +85 -0
  67. package/src/executors/sync-deps/schema.d.ts +5 -0
  68. package/src/executors/sync-deps/schema.json +33 -0
  69. package/src/executors/sync-deps/sync-deps.impl.d.ts +9 -0
  70. package/src/executors/sync-deps/sync-deps.impl.js +78 -0
  71. package/src/executors/sync-deps/sync-deps.impl.ts +140 -0
  72. package/src/executors/upgrade/schema.d.ts +1 -0
  73. package/src/executors/upgrade/schema.json +11 -0
  74. package/src/executors/upgrade/upgrade.impl.d.ts +13 -0
  75. package/src/executors/upgrade/upgrade.impl.js +47 -0
  76. package/src/executors/upgrade/upgrade.impl.ts +64 -0
  77. package/src/generators/application/application.d.ts +5 -0
  78. package/src/generators/application/application.js +87 -0
  79. package/src/generators/application/application.spec.ts +258 -0
  80. package/src/generators/application/files/app/.babelrc.js.template +23 -0
  81. package/src/generators/application/files/app/Gemfile.template +7 -0
  82. package/src/generators/application/files/app/android/app/build.gradle.template +119 -0
  83. package/src/generators/application/files/app/android/app/debug.keystore +0 -0
  84. package/src/generators/application/files/app/android/app/proguard-rules.pro +10 -0
  85. package/src/generators/application/files/app/android/app/src/androidTest/java/com/__lowerCaseName__/DetoxTest.java.template +30 -0
  86. package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +10 -0
  87. package/src/generators/application/files/app/android/app/src/main/AndroidManifest.xml.template +26 -0
  88. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +22 -0
  89. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +45 -0
  90. package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +36 -0
  91. package/src/generators/application/files/app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  92. package/src/generators/application/files/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  93. package/src/generators/application/files/app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  94. package/src/generators/application/files/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  95. package/src/generators/application/files/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  96. package/src/generators/application/files/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  97. package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  98. package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  99. package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  100. package/src/generators/application/files/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  101. package/src/generators/application/files/app/android/app/src/main/res/values/strings.xml.template +3 -0
  102. package/src/generators/application/files/app/android/app/src/main/res/values/styles.xml +9 -0
  103. package/src/generators/application/files/app/android/app/src/main/res/xml/network_security_config.xml +7 -0
  104. package/src/generators/application/files/app/android/build.gradle.template +21 -0
  105. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  106. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  107. package/src/generators/application/files/app/android/gradle.properties +41 -0
  108. package/src/generators/application/files/app/android/gradlew.bat +92 -0
  109. package/src/generators/application/files/app/android/gradlew.template +249 -0
  110. package/src/generators/application/files/app/android/settings.gradle.template +4 -0
  111. package/src/generators/application/files/app/app.json.template +4 -0
  112. package/src/generators/application/files/app/ios/.xcode.env.template +12 -0
  113. package/src/generators/application/files/app/ios/Podfile.template +55 -0
  114. package/src/generators/application/files/app/ios/__className__/AppDelegate.h +6 -0
  115. package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +31 -0
  116. package/src/generators/application/files/app/ios/__className__/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  117. package/src/generators/application/files/app/ios/__className__/Images.xcassets/Contents.json +6 -0
  118. package/src/generators/application/files/app/ios/__className__/Info.plist.template +52 -0
  119. package/src/generators/application/files/app/ios/__className__/LaunchScreen.storyboard.template +47 -0
  120. package/src/generators/application/files/app/ios/__className__/main.m +10 -0
  121. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +684 -0
  122. package/src/generators/application/files/app/ios/__className__.xcodeproj/xcshareddata/xcschemes/__className__.xcscheme.template +88 -0
  123. package/src/generators/application/files/app/ios/__className__.xcworkspace/contents.xcworkspacedata +10 -0
  124. package/src/generators/application/files/app/ios/__className__Tests/Info.plist +24 -0
  125. package/src/generators/application/files/app/ios/__className__Tests/__className__Tests.m +66 -0
  126. package/src/generators/application/files/app/metro.config.js.template +31 -0
  127. package/src/generators/application/files/app/package.json.template +14 -0
  128. package/src/generators/application/files/app/src/app/App.spec.tsx.template +9 -0
  129. package/src/generators/application/files/app/src/app/App.tsx.template +731 -0
  130. package/src/generators/application/files/app/src/main.tsx.template +4 -0
  131. package/src/generators/application/files/app/test-setup.ts.template +1 -0
  132. package/src/generators/application/files/app/tsconfig.app.json.template +10 -0
  133. package/src/generators/application/files/app/tsconfig.json.template +19 -0
  134. package/src/generators/application/lib/add-e2e.d.ts +3 -0
  135. package/src/generators/application/lib/add-e2e.js +46 -0
  136. package/src/generators/application/lib/add-project.d.ts +3 -0
  137. package/src/generators/application/lib/add-project.js +91 -0
  138. package/src/generators/application/lib/create-application-files.d.ts +3 -0
  139. package/src/generators/application/lib/create-application-files.js +24 -0
  140. package/src/generators/application/lib/normalize-options.d.ts +17 -0
  141. package/src/generators/application/lib/normalize-options.js +47 -0
  142. package/src/generators/application/lib/normalize-options.spec.ts +196 -0
  143. package/src/generators/application/schema.d.ts +23 -0
  144. package/src/generators/application/schema.json +103 -0
  145. package/src/generators/component/component.d.ts +5 -0
  146. package/src/generators/component/component.js +64 -0
  147. package/src/generators/component/component.spec.ts +127 -0
  148. package/src/generators/component/files/__fileName__.spec.tsx__tmpl__ +11 -0
  149. package/src/generators/component/files/__fileName__.tsx__tmpl__ +32 -0
  150. package/src/generators/component/lib/add-import.d.ts +3 -0
  151. package/src/generators/component/lib/add-import.js +33 -0
  152. package/src/generators/component/lib/normalize-options.d.ts +10 -0
  153. package/src/generators/component/lib/normalize-options.js +50 -0
  154. package/src/generators/component/schema.d.ts +24 -0
  155. package/src/generators/component/schema.json +85 -0
  156. package/src/generators/component-story/component-story.d.ts +8 -0
  157. package/src/generators/component-story/component-story.js +15 -0
  158. package/src/generators/component-story/schema.d.ts +6 -0
  159. package/src/generators/component-story/schema.json +42 -0
  160. package/src/generators/init/init.d.ts +6 -0
  161. package/src/generators/init/init.js +78 -0
  162. package/src/generators/init/init.spec.ts +38 -0
  163. package/src/generators/init/lib/add-git-ignore-entry.d.ts +2 -0
  164. package/src/generators/init/lib/add-git-ignore-entry.js +24 -0
  165. package/src/generators/init/lib/gitignore-entries.d.ts +1 -0
  166. package/src/generators/init/lib/gitignore-entries.js +74 -0
  167. package/src/generators/init/schema.d.ts +7 -0
  168. package/src/generators/init/schema.json +35 -0
  169. package/src/generators/library/files/lib/.babelrc.js.template +21 -0
  170. package/src/generators/library/files/lib/README.md +7 -0
  171. package/src/generators/library/files/lib/package.json.template +4 -0
  172. package/src/generators/library/files/lib/src/index.ts.template +0 -0
  173. package/src/generators/library/files/lib/test-setup.ts.template +1 -0
  174. package/src/generators/library/files/lib/tsconfig.json.template +16 -0
  175. package/src/generators/library/files/lib/tsconfig.lib.json.template +9 -0
  176. package/src/generators/library/lib/normalize-options.d.ts +12 -0
  177. package/src/generators/library/lib/normalize-options.js +33 -0
  178. package/src/generators/library/library.d.ts +5 -0
  179. package/src/generators/library/library.js +154 -0
  180. package/src/generators/library/library.spec.ts +420 -0
  181. package/src/generators/library/schema.d.ts +25 -0
  182. package/src/generators/library/schema.json +107 -0
  183. package/src/generators/stories/schema.d.ts +7 -0
  184. package/src/generators/stories/schema.json +58 -0
  185. package/src/generators/stories/stories.d.ts +8 -0
  186. package/src/generators/stories/stories.js +13 -0
  187. package/src/generators/storybook-configuration/configuration.d.ts +9 -0
  188. package/src/generators/storybook-configuration/configuration.js +26 -0
  189. package/src/generators/storybook-configuration/schema.d.ts +13 -0
  190. package/src/generators/storybook-configuration/schema.json +79 -0
  191. package/src/generators/upgrade-native/lib/create-native-files.d.ts +3 -0
  192. package/src/generators/upgrade-native/lib/create-native-files.js +14 -0
  193. package/src/generators/upgrade-native/lib/normalize-options.d.ts +12 -0
  194. package/src/generators/upgrade-native/lib/normalize-options.js +27 -0
  195. package/src/generators/upgrade-native/schema.d.ts +9 -0
  196. package/src/generators/upgrade-native/schema.json +41 -0
  197. package/src/generators/upgrade-native/upgrade-native.d.ts +10 -0
  198. package/src/generators/upgrade-native/upgrade-native.js +31 -0
  199. package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +23 -0
  200. package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +15 -0
  201. package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
  202. package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
  203. package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +9 -0
  204. package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +82 -0
  205. package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +23 -0
  206. package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
  207. package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
  208. package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +14 -0
  209. package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +9 -0
  210. package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +77 -0
  211. package/src/generators/web-configuration/lib/normalize-schema.d.ts +17 -0
  212. package/src/generators/web-configuration/lib/normalize-schema.js +16 -0
  213. package/src/generators/web-configuration/lib/webpack-targets.d.ts +7 -0
  214. package/src/generators/web-configuration/lib/webpack-targets.js +75 -0
  215. package/src/generators/web-configuration/schema.d.ts +6 -0
  216. package/src/generators/web-configuration/schema.json +42 -0
  217. package/src/generators/web-configuration/web-configuration.d.ts +12 -0
  218. package/src/generators/web-configuration/web-configuration.js +87 -0
  219. package/src/migrations/update-15-0-0/add-babel-inputs.d.ts +2 -0
  220. package/src/migrations/update-15-0-0/add-babel-inputs.js +9 -0
  221. package/src/migrations/update-15-0-0/add-babel-inputs.spec.ts +73 -0
  222. package/src/migrations/update-15-9-1/add-build-ios-target.d.ts +5 -0
  223. package/src/migrations/update-15-9-1/add-build-ios-target.js +29 -0
  224. package/src/migrations/update-15-9-1/add-build-ios-target.spec.ts +36 -0
  225. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  226. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  227. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.spec.ts +37 -0
  228. package/src/migrations/update-16-1-0/upgrade-storybook-6-5.d.ts +6 -0
  229. package/src/migrations/update-16-1-0/upgrade-storybook-6-5.js +21 -0
  230. package/src/migrations/update-16-6-0/add-depends-on.d.ts +6 -0
  231. package/src/migrations/update-16-6-0/add-depends-on.js +63 -0
  232. package/src/migrations/update-16-6-0/update-metro-config.d.ts +6 -0
  233. package/src/migrations/update-16-6-0/update-metro-config.js +63 -0
  234. package/src/migrations/update-16-9-0/remove-types-react-native.d.ts +7 -0
  235. package/src/migrations/update-16-9-0/remove-types-react-native.js +13 -0
  236. package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +6 -0
  237. package/src/migrations/update-18-0-0/add-upgrade-target.js +33 -0
  238. package/src/migrations/update-18-0-0/add-web-configuration.d.ts +8 -0
  239. package/src/migrations/update-18-0-0/add-web-configuration.js +33 -0
  240. package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +39 -0
  241. package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +5 -0
  242. package/src/migrations/update-18-0-0/change-storybook-targets.js +57 -0
  243. package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
  244. package/src/migrations/update-18-0-0/remove-block-list.js +28 -0
  245. package/src/migrations/update-18-0-0/remove-block-list.spec.ts +68 -0
  246. package/src/migrations/update-18-0-0/remove-metro.d.ts +14 -0
  247. package/src/migrations/update-18-0-0/remove-metro.js +29 -0
  248. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
  249. package/src/migrations/update-18-0-0/remove-symlink-target.js +30 -0
  250. package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +40 -0
  251. package/src/utils/add-jest.d.ts +2 -0
  252. package/src/utils/add-jest.js +48 -0
  253. package/src/utils/add-linting.d.ts +13 -0
  254. package/src/utils/add-linting.js +36 -0
  255. package/src/utils/add-linting.spec.ts +40 -0
  256. package/src/utils/chmod-android-gradle-files.d.ts +3 -0
  257. package/src/utils/chmod-android-gradle-files.js +27 -0
  258. package/src/utils/ensure-dependencies.d.ts +2 -0
  259. package/src/utils/ensure-dependencies.js +30 -0
  260. package/src/utils/ensure-node-modules-symlink.d.ts +9 -0
  261. package/src/utils/ensure-node-modules-symlink.js +28 -0
  262. package/src/utils/ensure-node-modules-symlink.spec.ts +108 -0
  263. package/src/utils/find-all-npm-dependencies.d.ts +2 -0
  264. package/src/utils/find-all-npm-dependencies.js +27 -0
  265. package/src/utils/find-all-npm-dependencies.spec.ts +103 -0
  266. package/src/utils/format-file.d.ts +1 -0
  267. package/src/utils/format-file.js +16 -0
  268. package/src/utils/get-cli-options.d.ts +8 -0
  269. package/src/utils/get-cli-options.js +33 -0
  270. package/src/utils/pod-install-task.d.ts +18 -0
  271. package/src/utils/pod-install-task.js +73 -0
  272. package/src/utils/testing-generators.d.ts +3 -0
  273. package/src/utils/testing-generators.js +32 -0
  274. package/src/utils/versions.d.ts +17 -0
  275. package/src/utils/versions.js +20 -0
  276. package/typings/svg.d.ts +7 -0
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCliUpgrade = void 0;
4
+ const path_1 = require("path");
5
+ const child_process_1 = require("child_process");
6
+ /**
7
+ * This executor is equivalent to `npx react-native upgrade`.
8
+ * https://github.com/react-native-community/cli/blob/main/packages/cli/src/commands/upgrade/upgrade.ts
9
+ */
10
+ async function* upgradeExecutor(options, context) {
11
+ const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
12
+ await runCliUpgrade(context.root, projectRoot);
13
+ yield { success: true };
14
+ }
15
+ exports.default = upgradeExecutor;
16
+ function runCliUpgrade(workspaceRoot, projectRoot) {
17
+ return new Promise((resolve, reject) => {
18
+ const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['upgrade'], {
19
+ stdio: 'inherit',
20
+ cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
21
+ env: process.env,
22
+ });
23
+ /**
24
+ * Ensure the child process is killed when the parent exits
25
+ */
26
+ const processExitListener = (signal) => () => {
27
+ childProcess.kill(signal);
28
+ process.exit();
29
+ };
30
+ process.once('exit', (signal) => childProcess.kill(signal));
31
+ process.once('SIGTERM', processExitListener);
32
+ process.once('SIGINT', processExitListener);
33
+ process.once('SIGQUIT', processExitListener);
34
+ childProcess.on('error', (err) => {
35
+ reject(err);
36
+ });
37
+ childProcess.on('exit', (code) => {
38
+ if (code === 0) {
39
+ resolve(childProcess);
40
+ }
41
+ else {
42
+ reject(code);
43
+ }
44
+ });
45
+ });
46
+ }
47
+ exports.runCliUpgrade = runCliUpgrade;
@@ -0,0 +1,64 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { resolve as pathResolve } from 'path';
3
+ import { ChildProcess, fork } from 'child_process';
4
+
5
+ import { UpgradeExecutorSchema } from './schema';
6
+
7
+ export interface ReactNativeUpgradeOutput {
8
+ success: boolean;
9
+ }
10
+
11
+ /**
12
+ * This executor is equivalent to `npx react-native upgrade`.
13
+ * https://github.com/react-native-community/cli/blob/main/packages/cli/src/commands/upgrade/upgrade.ts
14
+ */
15
+ export default async function* upgradeExecutor(
16
+ options: UpgradeExecutorSchema,
17
+ context: ExecutorContext
18
+ ): AsyncGenerator<ReactNativeUpgradeOutput> {
19
+ const projectRoot =
20
+ context.projectsConfigurations.projects[context.projectName].root;
21
+
22
+ await runCliUpgrade(context.root, projectRoot);
23
+ yield { success: true };
24
+ }
25
+
26
+ export function runCliUpgrade(
27
+ workspaceRoot: string,
28
+ projectRoot: string
29
+ ): Promise<ChildProcess> {
30
+ return new Promise<ChildProcess>((resolve, reject) => {
31
+ const childProcess = fork(
32
+ require.resolve('react-native/cli.js'),
33
+ ['upgrade'],
34
+ {
35
+ stdio: 'inherit',
36
+ cwd: pathResolve(workspaceRoot, projectRoot),
37
+ env: process.env,
38
+ }
39
+ );
40
+
41
+ /**
42
+ * Ensure the child process is killed when the parent exits
43
+ */
44
+ const processExitListener = (signal?: number | NodeJS.Signals) => () => {
45
+ childProcess.kill(signal);
46
+ process.exit();
47
+ };
48
+ process.once('exit', (signal) => childProcess.kill(signal));
49
+ process.once('SIGTERM', processExitListener);
50
+ process.once('SIGINT', processExitListener);
51
+ process.once('SIGQUIT', processExitListener);
52
+
53
+ childProcess.on('error', (err) => {
54
+ reject(err);
55
+ });
56
+ childProcess.on('exit', (code) => {
57
+ if (code === 0) {
58
+ resolve(childProcess);
59
+ } else {
60
+ reject(code);
61
+ }
62
+ });
63
+ });
64
+ }
@@ -0,0 +1,5 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function reactNativeApplicationGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
4
+ export declare function reactNativeApplicationGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
5
+ export default reactNativeApplicationGenerator;
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reactNativeApplicationGeneratorInternal = exports.reactNativeApplicationGenerator = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const js_1 = require("@nx/js");
6
+ const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
7
+ const add_linting_1 = require("../../utils/add-linting");
8
+ const add_jest_1 = require("../../utils/add-jest");
9
+ const chmod_android_gradle_files_1 = require("../../utils/chmod-android-gradle-files");
10
+ const pod_install_task_1 = require("../../utils/pod-install-task");
11
+ const web_configuration_1 = require("../web-configuration/web-configuration");
12
+ const normalize_options_1 = require("./lib/normalize-options");
13
+ const init_1 = require("../init/init");
14
+ const add_project_1 = require("./lib/add-project");
15
+ const create_application_files_1 = require("./lib/create-application-files");
16
+ const add_e2e_1 = require("./lib/add-e2e");
17
+ const ensure_dependencies_1 = require("../../utils/ensure-dependencies");
18
+ const sync_deps_impl_1 = require("../../executors/sync-deps/sync-deps.impl");
19
+ async function reactNativeApplicationGenerator(host, schema) {
20
+ return await reactNativeApplicationGeneratorInternal(host, {
21
+ addPlugin: false,
22
+ projectNameAndRootFormat: 'derived',
23
+ ...schema,
24
+ });
25
+ }
26
+ exports.reactNativeApplicationGenerator = reactNativeApplicationGenerator;
27
+ async function reactNativeApplicationGeneratorInternal(host, schema) {
28
+ const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
29
+ const tasks = [];
30
+ const jsInitTask = await (0, js_1.initGenerator)(host, {
31
+ ...schema,
32
+ skipFormat: true,
33
+ });
34
+ tasks.push(jsInitTask);
35
+ const initTask = await (0, init_1.default)(host, { ...options, skipFormat: true });
36
+ tasks.push(initTask);
37
+ if (!options.skipPackageJson) {
38
+ tasks.push((0, ensure_dependencies_1.ensureDependencies)(host));
39
+ }
40
+ (0, create_application_files_1.createApplicationFiles)(host, options);
41
+ (0, add_project_1.addProject)(host, options);
42
+ const lintTask = await (0, add_linting_1.addLinting)(host, {
43
+ ...options,
44
+ projectRoot: options.appProjectRoot,
45
+ tsConfigPaths: [
46
+ (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
47
+ ],
48
+ });
49
+ tasks.push(lintTask);
50
+ const jestTask = await (0, add_jest_1.addJest)(host, options.unitTestRunner, options.projectName, options.appProjectRoot, options.js, options.skipPackageJson, options.addPlugin);
51
+ tasks.push(jestTask);
52
+ const webTask = await (0, web_configuration_1.webConfigurationGenerator)(host, {
53
+ ...options,
54
+ project: options.name,
55
+ skipFormat: true,
56
+ });
57
+ tasks.push(webTask);
58
+ const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
59
+ tasks.push(e2eTask);
60
+ const chmodTaskGradlewTask = (0, chmod_android_gradle_files_1.chmodAndroidGradlewFilesTask)((0, devkit_1.joinPathFragments)(host.root, options.androidProjectRoot));
61
+ tasks.push(chmodTaskGradlewTask);
62
+ const podInstallTask = (0, pod_install_task_1.runPodInstall)((0, devkit_1.joinPathFragments)(host.root, options.iosProjectRoot));
63
+ if (options.install) {
64
+ const projectPackageJsonPath = (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json');
65
+ const workspacePackageJson = (0, devkit_1.readJson)(host, 'package.json');
66
+ const projectPackageJson = (0, devkit_1.readJson)(host, projectPackageJsonPath);
67
+ await (0, sync_deps_impl_1.syncDeps)(options.name, projectPackageJson, projectPackageJsonPath, workspacePackageJson);
68
+ tasks.push(podInstallTask);
69
+ }
70
+ else {
71
+ devkit_1.output.log({
72
+ title: 'Skip `pod install`',
73
+ bodyLines: [
74
+ `run 'nx run ${options.name}:pod-install' to install native modules before running iOS app`,
75
+ ],
76
+ });
77
+ }
78
+ if (!options.skipFormat) {
79
+ await (0, devkit_1.formatFiles)(host);
80
+ }
81
+ tasks.push(() => {
82
+ (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
83
+ });
84
+ return (0, devkit_1.runTasksInSerial)(...tasks);
85
+ }
86
+ exports.reactNativeApplicationGeneratorInternal = reactNativeApplicationGeneratorInternal;
87
+ exports.default = reactNativeApplicationGenerator;
@@ -0,0 +1,258 @@
1
+ import {
2
+ Tree,
3
+ getProjects,
4
+ readJson,
5
+ readProjectConfiguration,
6
+ } from '@nx/devkit';
7
+ import { createTreeWithEmptyWorkspace } from '@nx/devkit/testing';
8
+ import { Linter } from '@nx/eslint';
9
+ import { reactNativeApplicationGenerator } from './application';
10
+
11
+ describe('app', () => {
12
+ let appTree: Tree;
13
+
14
+ beforeEach(() => {
15
+ appTree = createTreeWithEmptyWorkspace();
16
+ appTree.write('.gitignore', '');
17
+ });
18
+
19
+ it('should update configuration', async () => {
20
+ await reactNativeApplicationGenerator(appTree, {
21
+ name: 'my-app',
22
+ displayName: 'myApp',
23
+ linter: Linter.EsLint,
24
+ e2eTestRunner: 'none',
25
+ install: false,
26
+ projectNameAndRootFormat: 'as-provided',
27
+ unitTestRunner: 'none',
28
+ bundler: 'vite',
29
+ });
30
+ const projects = getProjects(appTree);
31
+
32
+ expect(projects.get('my-app').root).toEqual('my-app');
33
+ });
34
+
35
+ it('should update nx.json', async () => {
36
+ await reactNativeApplicationGenerator(appTree, {
37
+ name: 'my-app',
38
+ displayName: 'myApp',
39
+ tags: 'one,two',
40
+ linter: Linter.EsLint,
41
+ e2eTestRunner: 'none',
42
+ install: false,
43
+ projectNameAndRootFormat: 'as-provided',
44
+ unitTestRunner: 'none',
45
+ bundler: 'vite',
46
+ });
47
+
48
+ const projectConfiguration = readProjectConfiguration(appTree, 'my-app');
49
+ expect(projectConfiguration).toMatchObject({
50
+ tags: ['one', 'two'],
51
+ });
52
+ });
53
+
54
+ it('should generate files', async () => {
55
+ await reactNativeApplicationGenerator(appTree, {
56
+ name: 'my-app',
57
+ displayName: 'myApp',
58
+ linter: Linter.EsLint,
59
+ e2eTestRunner: 'none',
60
+ install: false,
61
+ projectNameAndRootFormat: 'as-provided',
62
+ unitTestRunner: 'jest',
63
+ bundler: 'vite',
64
+ });
65
+ expect(appTree.exists('my-app/src/app/App.tsx')).toBeTruthy();
66
+ expect(appTree.exists('my-app/src/main.tsx')).toBeTruthy();
67
+
68
+ const tsconfig = readJson(appTree, 'my-app/tsconfig.json');
69
+ expect(tsconfig.extends).toEqual('../tsconfig.base.json');
70
+
71
+ expect(appTree.exists('my-app/.eslintrc.json')).toBe(true);
72
+ expect(appTree.read('my-app/jest.config.ts', 'utf-8'))
73
+ .toMatchInlineSnapshot(`
74
+ "module.exports = {
75
+ displayName: 'my-app',
76
+ preset: 'react-native',
77
+ resolver: '@nx/jest/plugins/resolver',
78
+ moduleFileExtensions: ['ts', 'js', 'html', 'tsx', 'jsx'],
79
+ setupFilesAfterEnv: ['<rootDir>/test-setup.ts'],
80
+ moduleNameMapper: {
81
+ '\\\\.svg$': '@nx/react-native/plugins/jest/svg-mock',
82
+ },
83
+ transform: {
84
+ '^.+.(js|ts|tsx)$': [
85
+ 'babel-jest',
86
+ {
87
+ configFile: __dirname + '/.babelrc.js',
88
+ },
89
+ ],
90
+ '^.+.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$': require.resolve(
91
+ 'react-native/jest/assetFileTransformer.js'
92
+ ),
93
+ },
94
+ coverageDirectory: '../coverage/my-app',
95
+ };
96
+ "
97
+ `);
98
+ });
99
+
100
+ it('should generate targets', async () => {
101
+ await reactNativeApplicationGenerator(appTree, {
102
+ name: 'my-app',
103
+ displayName: 'myApp',
104
+ linter: Linter.EsLint,
105
+ e2eTestRunner: 'none',
106
+ install: false,
107
+ projectNameAndRootFormat: 'as-provided',
108
+ unitTestRunner: 'jest',
109
+ bundler: 'vite',
110
+ });
111
+
112
+ expect(appTree.exists('my-app/jest.config.ts')).toBeTruthy();
113
+ });
114
+
115
+ it('should extend from root tsconfig.json when no tsconfig.base.json', async () => {
116
+ appTree.rename('tsconfig.base.json', 'tsconfig.json');
117
+
118
+ await reactNativeApplicationGenerator(appTree, {
119
+ name: 'my-app',
120
+ displayName: 'myApp',
121
+ linter: Linter.EsLint,
122
+ e2eTestRunner: 'none',
123
+ install: false,
124
+ projectNameAndRootFormat: 'as-provided',
125
+ unitTestRunner: 'none',
126
+ bundler: 'vite',
127
+ });
128
+
129
+ const tsconfig = readJson(appTree, 'my-app/tsconfig.json');
130
+ expect(tsconfig.extends).toEqual('../tsconfig.json');
131
+ });
132
+
133
+ describe('detox', () => {
134
+ it('should create e2e app with directory', async () => {
135
+ await reactNativeApplicationGenerator(appTree, {
136
+ name: 'my-app',
137
+ directory: 'my-dir',
138
+ linter: Linter.EsLint,
139
+ e2eTestRunner: 'detox',
140
+ install: false,
141
+ projectNameAndRootFormat: 'as-provided',
142
+ bundler: 'vite',
143
+ unitTestRunner: 'none',
144
+ });
145
+
146
+ const projects = getProjects(appTree);
147
+ expect(projects.get('my-app').root).toEqual('my-dir');
148
+
149
+ expect(appTree.exists('my-dir-e2e/.detoxrc.json')).toBeTruthy();
150
+ const detoxrc = appTree.read('my-dir-e2e/.detoxrc.json', 'utf-8');
151
+ // Strip trailing commas
152
+ const detoxrcJson = JSON.parse(
153
+ detoxrc.replace(/(?<=(true|false|null|["\d}\]])\s*),(?=\s*[}\]])/g, '')
154
+ );
155
+ expect(detoxrcJson.apps).toEqual({
156
+ 'android.debug': {
157
+ binaryPath:
158
+ '../my-dir/android/app/build/outputs/apk/debug/app-debug.apk',
159
+ build:
160
+ 'cd ../my-dir/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
161
+ type: 'android.apk',
162
+ },
163
+ 'android.release': {
164
+ binaryPath:
165
+ '../my-dir/android/app/build/outputs/apk/release/app-release.apk',
166
+ build:
167
+ 'cd ../my-dir/android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release',
168
+ type: 'android.apk',
169
+ },
170
+ 'ios.debug': {
171
+ binaryPath:
172
+ '../my-dir/ios/build/Build/Products/Debug-iphonesimulator/MyApp.app',
173
+ build:
174
+ "cd ../my-dir/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
175
+ type: 'ios.app',
176
+ },
177
+ 'ios.release': {
178
+ binaryPath:
179
+ '../my-dir/ios/build/Build/Products/Release-iphonesimulator/MyApp.app',
180
+ build:
181
+ "cd ../my-dir/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
182
+ type: 'ios.app',
183
+ },
184
+ });
185
+ });
186
+
187
+ it('should create e2e app without directory', async () => {
188
+ await reactNativeApplicationGenerator(appTree, {
189
+ name: 'my-app',
190
+ linter: Linter.EsLint,
191
+ e2eTestRunner: 'detox',
192
+ install: false,
193
+ projectNameAndRootFormat: 'as-provided',
194
+ bundler: 'vite',
195
+ unitTestRunner: 'none',
196
+ });
197
+
198
+ const projects = getProjects(appTree);
199
+ expect(projects.get('my-app').root).toEqual('my-app');
200
+
201
+ const detoxrc = appTree.read('my-app-e2e/.detoxrc.json', 'utf-8');
202
+ // Strip trailing commas
203
+ const detoxrcJson = JSON.parse(
204
+ detoxrc.replace(/(?<=(true|false|null|["\d}\]])\s*),(?=\s*[}\]])/g, '')
205
+ );
206
+ expect(detoxrcJson.apps).toEqual({
207
+ 'android.debug': {
208
+ binaryPath:
209
+ '../my-app/android/app/build/outputs/apk/debug/app-debug.apk',
210
+ build:
211
+ 'cd ../my-app/android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
212
+ type: 'android.apk',
213
+ },
214
+ 'android.release': {
215
+ binaryPath:
216
+ '../my-app/android/app/build/outputs/apk/release/app-release.apk',
217
+ build:
218
+ 'cd ../my-app/android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release',
219
+ type: 'android.apk',
220
+ },
221
+ 'ios.debug': {
222
+ binaryPath:
223
+ '../my-app/ios/build/Build/Products/Debug-iphonesimulator/MyApp.app',
224
+ build:
225
+ "cd ../my-app/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
226
+ type: 'ios.app',
227
+ },
228
+ 'ios.release': {
229
+ binaryPath:
230
+ '../my-app/ios/build/Build/Products/Release-iphonesimulator/MyApp.app',
231
+ build:
232
+ "cd ../my-app/ios && xcodebuild -workspace MyApp.xcworkspace -scheme MyApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath ./build -quiet",
233
+ type: 'ios.app',
234
+ },
235
+ });
236
+ });
237
+ });
238
+
239
+ describe('--skipPackageJson', () => {
240
+ it('should not add or update dependencies when true', async () => {
241
+ const packageJsonBefore = readJson(appTree, 'package.json');
242
+
243
+ await reactNativeApplicationGenerator(appTree, {
244
+ name: 'my-app',
245
+ displayName: 'myApp',
246
+ linter: Linter.EsLint,
247
+ e2eTestRunner: 'none',
248
+ install: false,
249
+ skipPackageJson: true,
250
+ projectNameAndRootFormat: 'as-provided',
251
+ unitTestRunner: 'none',
252
+ bundler: 'webpack',
253
+ });
254
+
255
+ expect(readJson(appTree, 'package.json')).toEqual(packageJsonBefore);
256
+ });
257
+ });
258
+ });
@@ -0,0 +1,23 @@
1
+ module.exports = function (api) {
2
+ api.cache(true);
3
+
4
+ if (
5
+ process.env.NX_TASK_TARGET_TARGET === 'build' ||
6
+ process.env.NX_TASK_TARGET_TARGET.includes('storybook')
7
+ ) {
8
+ return {
9
+ presets: [
10
+ [
11
+ '@nx/react/babel',
12
+ {
13
+ runtime: 'automatic',
14
+ },
15
+ ],
16
+ ],
17
+ };
18
+ }
19
+
20
+ return {
21
+ presets: [['module:@react-native/babel-preset', { "useTransformReactJSX": true }]],
22
+ };
23
+ };
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4
+ ruby ">= 2.6.10"
5
+
6
+ gem 'cocoapods', '~> 1.13'
7
+ gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
@@ -0,0 +1,119 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ /* Folders */
11
+ // The root of your project, i.e. where "package.json" lives. Default is '..'
12
+ // root = file("../")
13
+ // The folder where the react-native NPM package is. Default is <%= offsetFromRoot %>../../node_modules/react-native
14
+ reactNativeDir = file("<%= offsetFromRoot %>../../node_modules/react-native")
15
+ // The folder where the react-native Codegen package is. Default is <%= offsetFromRoot %>../../node_modules/@react-native/codegen
16
+ codegenDir = file("<%= offsetFromRoot %>../../node_modules/@react-native/codegen")
17
+ // The cli.js file which is the React Native CLI entrypoint. Default is <%= offsetFromRoot %>../../node_modules/react-native/cli.js
18
+ cliFile = file("<%= offsetFromRoot %>../../node_modules/react-native/cli.js")
19
+
20
+ /* Variants */
21
+ // The list of variants to that are debuggable. For those we're going to
22
+ // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24
+ // debuggableVariants = ["liteDebug", "prodDebug"]
25
+
26
+ /* Bundling */
27
+ // A list containing the node command and its flags. Default is just 'node'.
28
+ // nodeExecutableAndArgs = ["node"]
29
+ //
30
+ // The command to run when bundling. By default is 'bundle'
31
+ // bundleCommand = "ram-bundle"
32
+ //
33
+ // The path to the CLI configuration file. Default is empty.
34
+ // bundleConfig = file(../rn-cli.config.js)
35
+ //
36
+ // The name of the generated asset file containing your JS bundle
37
+ // bundleAssetName = "MyApplication.android.bundle"
38
+ //
39
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40
+ entryFile = file("../../<%= entryFile %>")
41
+ //
42
+ // A list of extra flags to pass to the 'bundle' commands.
43
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44
+ // extraPackagerArgs = []
45
+
46
+ /* Hermes Commands */
47
+ // The hermes compiler command to run. By default it is 'hermesc'
48
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49
+ //
50
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51
+ // hermesFlags = ["-O", "-output-source-map"]
52
+ }
53
+
54
+ /**
55
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
56
+ */
57
+ def enableProguardInReleaseBuilds = false
58
+
59
+ /**
60
+ * The preferred build flavor of JavaScriptCore (JSC)
61
+ *
62
+ * For example, to use the international variant, you can use:
63
+ * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
64
+ *
65
+ * The international variant includes ICU i18n library and necessary data
66
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
67
+ * give correct results when using with locales other than en-US. Note that
68
+ * this variant is about 6MiB larger per architecture than default.
69
+ */
70
+ def jscFlavor = 'org.webkit:android-jsc:+'
71
+
72
+ android {
73
+ ndkVersion rootProject.ext.ndkVersion
74
+ buildToolsVersion rootProject.ext.buildToolsVersion
75
+ compileSdk rootProject.ext.compileSdkVersion
76
+
77
+ namespace "com.<%= lowerCaseName %>"
78
+ defaultConfig {
79
+ applicationId "com.<%= lowerCaseName %>"
80
+ minSdkVersion rootProject.ext.minSdkVersion
81
+ targetSdkVersion rootProject.ext.targetSdkVersion
82
+ versionCode 1
83
+ versionName "1.0"
84
+ }
85
+ signingConfigs {
86
+ debug {
87
+ storeFile file('debug.keystore')
88
+ storePassword 'android'
89
+ keyAlias 'androiddebugkey'
90
+ keyPassword 'android'
91
+ }
92
+ }
93
+ buildTypes {
94
+ debug {
95
+ signingConfig signingConfigs.debug
96
+ }
97
+ release {
98
+ // Caution! In production, you need to generate your own keystore file.
99
+ // see https://reactnative.dev/docs/signed-apk-android.
100
+ signingConfig signingConfigs.debug
101
+ minifyEnabled enableProguardInReleaseBuilds
102
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
103
+ }
104
+ }
105
+ }
106
+
107
+ dependencies {
108
+ // The version of react-native is set by the React Native Gradle Plugin
109
+ implementation("com.facebook.react:react-android")
110
+ implementation("com.facebook.react:flipper-integration")
111
+
112
+ if (hermesEnabled.toBoolean()) {
113
+ implementation("com.facebook.react:hermes-android")
114
+ } else {
115
+ implementation jscFlavor
116
+ }
117
+ }
118
+
119
+ apply from: file("<%= offsetFromRoot %>../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
@@ -0,0 +1,10 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
@@ -0,0 +1,30 @@
1
+ // Replace "com.<%= lowerCaseName %>" here and below with your app's package name from the top of MainActivity.java
2
+ package com.<%= lowerCaseName %>;
3
+
4
+ import com.wix.detox.Detox;
5
+ import com.wix.detox.config.DetoxConfig;
6
+
7
+ import org.junit.Rule;
8
+ import org.junit.Test;
9
+ import org.junit.runner.RunWith;
10
+
11
+ import androidx.test.ext.junit.runners.AndroidJUnit4;
12
+ import androidx.test.filters.LargeTest;
13
+ import androidx.test.rule.ActivityTestRule;
14
+
15
+ @RunWith(AndroidJUnit4.class)
16
+ @LargeTest
17
+ public class DetoxTest {
18
+ @Rule // (2)
19
+ public ActivityTestRule<MainActivity> mActivityRule = new ActivityTestRule<>(MainActivity.class, false, false);
20
+
21
+ @Test
22
+ public void runDetoxTests() {
23
+ DetoxConfig detoxConfig = new DetoxConfig();
24
+ detoxConfig.idlePolicyConfig.masterTimeoutSec = 90;
25
+ detoxConfig.idlePolicyConfig.idleResourceTimeoutSec = 60;
26
+ detoxConfig.rnContextLoadTimeoutSec = (BuildConfig.DEBUG ? 180 : 60);
27
+
28
+ Detox.runTests(mActivityRule, detoxConfig);
29
+ }
30
+ }
@@ -0,0 +1,10 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
+ xmlns:tools="http://schemas.android.com/tools">
4
+
5
+ <application
6
+ android:usesCleartextTraffic="true"
7
+ tools:targetApi="28"
8
+ android:networkSecurityConfig="@xml/network_security_config"
9
+ tools:ignore="GoogleAppIndexingWarning"/>
10
+ </manifest>