@nx/react-native 17.0.4 → 17.0.6

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 (181) hide show
  1. package/.eslintrc.json +1 -7
  2. package/LICENSE +1 -1
  3. package/README.md +4 -9
  4. package/executors.json +0 -5
  5. package/generators.json +11 -12
  6. package/migrations.json +0 -126
  7. package/package.json +15 -11
  8. package/plugins/metro-resolver.js +1 -4
  9. package/plugins/with-nx-metro.js +2 -6
  10. package/src/executors/build-android/build-android.impl.js +6 -2
  11. package/src/executors/build-android/build-android.impl.ts +6 -2
  12. package/src/executors/build-android/schema.json +1 -1
  13. package/src/executors/build-ios/schema.json +1 -1
  14. package/src/executors/bundle/schema.d.ts +1 -1
  15. package/src/executors/bundle/schema.json +1 -1
  16. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +0 -4
  17. package/src/executors/ensure-symlink/ensure-symlink.impl.js +0 -4
  18. package/src/executors/ensure-symlink/ensure-symlink.impl.ts +0 -4
  19. package/src/executors/ensure-symlink/schema.json +1 -1
  20. package/src/executors/pod-install/schema.json +1 -1
  21. package/src/executors/run-android/run-android.impl.js +17 -5
  22. package/src/executors/run-android/run-android.impl.ts +18 -9
  23. package/src/executors/run-android/schema.json +1 -1
  24. package/src/executors/run-ios/run-ios.impl.js +16 -4
  25. package/src/executors/run-ios/run-ios.impl.ts +18 -9
  26. package/src/executors/run-ios/schema.json +1 -1
  27. package/src/executors/start/schema.d.ts +1 -1
  28. package/src/executors/start/schema.json +1 -1
  29. package/src/executors/start/start.impl.js +26 -11
  30. package/src/executors/start/start.impl.ts +28 -14
  31. package/src/executors/storybook/storybook.impl.d.ts +0 -4
  32. package/src/executors/storybook/storybook.impl.js +2 -15
  33. package/src/executors/storybook/storybook.impl.ts +7 -26
  34. package/src/executors/sync-deps/schema.d.ts +0 -1
  35. package/src/executors/sync-deps/schema.json +1 -6
  36. package/src/executors/sync-deps/sync-deps.impl.d.ts +1 -2
  37. package/src/executors/sync-deps/sync-deps.impl.js +11 -33
  38. package/src/executors/sync-deps/sync-deps.impl.ts +18 -57
  39. package/src/generators/application/application.js +8 -52
  40. package/src/generators/application/application.spec.ts +2 -29
  41. package/src/generators/application/files/app/Gemfile.template +1 -2
  42. package/src/generators/application/files/app/android/app/build.gradle.template +28 -12
  43. package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +6 -2
  44. package/src/generators/application/files/app/android/app/src/debug/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +75 -0
  45. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +32 -0
  46. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +62 -0
  47. package/src/generators/application/files/app/android/app/src/release/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +20 -0
  48. package/src/generators/application/files/app/android/build.gradle.template +20 -7
  49. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +1 -2
  50. package/src/generators/application/files/app/android/gradle.properties +3 -0
  51. package/src/generators/application/files/app/android/gradlew.template +7 -12
  52. package/src/generators/application/files/app/android/settings.gradle.template +2 -2
  53. package/src/generators/application/files/app/babel.config.json.template +3 -0
  54. package/src/generators/application/files/app/ios/Podfile.template +7 -0
  55. package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +0 -5
  56. package/src/generators/application/files/app/ios/__className__/Info.plist.template +8 -5
  57. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +33 -11
  58. package/src/generators/application/files/app/metro.config.js.template +5 -1
  59. package/src/generators/application/files/app/src/app/App.tsx.template +13 -50
  60. package/src/generators/application/lib/add-detox.d.ts +3 -0
  61. package/src/generators/application/lib/add-detox.js +23 -0
  62. package/src/generators/application/lib/add-project.js +18 -18
  63. package/src/generators/application/lib/normalize-options.d.ts +0 -7
  64. package/src/generators/application/lib/normalize-options.js +3 -35
  65. package/src/generators/application/lib/normalize-options.spec.ts +7 -70
  66. package/src/generators/application/schema.d.ts +3 -5
  67. package/src/generators/application/schema.json +6 -14
  68. package/src/generators/component/files/__fileName__.tsx__tmpl__ +1 -1
  69. package/src/generators/component/schema.d.ts +3 -3
  70. package/src/generators/component/schema.json +4 -4
  71. package/src/generators/component-story/component-story.d.ts +8 -5
  72. package/src/generators/component-story/component-story.js +69 -8
  73. package/src/generators/component-story/component-story.spec.ts +428 -0
  74. package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +32 -0
  75. package/src/generators/component-story/schema.d.ts +0 -1
  76. package/src/generators/component-story/schema.json +3 -11
  77. package/src/generators/init/init.d.ts +1 -2
  78. package/src/generators/init/init.js +56 -55
  79. package/src/generators/init/init.spec.ts +6 -7
  80. package/src/generators/init/schema.d.ts +3 -3
  81. package/src/generators/init/schema.json +18 -13
  82. package/src/generators/library/files/lib/babel.config.json.template +17 -0
  83. package/src/generators/library/lib/normalize-options.js +0 -5
  84. package/src/generators/library/library.js +38 -48
  85. package/src/generators/library/library.spec.ts +60 -12
  86. package/src/generators/library/schema.d.ts +0 -1
  87. package/src/generators/library/schema.json +2 -2
  88. package/src/generators/stories/schema.d.ts +0 -2
  89. package/src/generators/stories/schema.json +2 -15
  90. package/src/generators/stories/stories-app.spec.ts +128 -0
  91. package/src/generators/stories/stories-lib.spec.ts +105 -0
  92. package/src/generators/stories/stories.d.ts +2 -5
  93. package/src/generators/stories/stories.js +50 -7
  94. package/src/generators/storybook-configuration/configuration.d.ts +2 -7
  95. package/src/generators/storybook-configuration/configuration.js +48 -18
  96. package/src/generators/storybook-configuration/configuration.spec.ts +135 -0
  97. package/src/generators/storybook-configuration/files/app/storybook.ts.template +9 -0
  98. package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +74 -0
  99. package/src/generators/storybook-configuration/files/root/story-loader.ts.template +5 -0
  100. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.d.ts +6 -0
  101. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js +25 -0
  102. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +161 -0
  103. package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +6 -0
  104. package/src/generators/storybook-configuration/lib/create-storybook-files.js +42 -0
  105. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +7 -0
  106. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +29 -0
  107. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +65 -0
  108. package/src/generators/storybook-configuration/schema.d.ts +2 -4
  109. package/src/generators/storybook-configuration/schema.json +12 -22
  110. package/src/generators/upgrade-native/lib/normalize-options.d.ts +1 -1
  111. package/src/generators/upgrade-native/schema.d.ts +1 -1
  112. package/src/generators/upgrade-native/schema.json +3 -3
  113. package/src/generators/upgrade-native/upgrade-native.d.ts +0 -2
  114. package/src/generators/upgrade-native/upgrade-native.js +0 -3
  115. package/src/migrations/update-16-6-0/update-metro-config.js +5 -1
  116. package/src/migrations/update-16-9-0/remove-types-react-native.js +9 -2
  117. package/src/utils/add-jest.d.ts +1 -1
  118. package/src/utils/add-jest.js +1 -13
  119. package/src/utils/add-linting.d.ts +0 -1
  120. package/src/utils/add-linting.js +1 -1
  121. package/src/utils/add-linting.spec.ts +6 -4
  122. package/src/utils/chmod-android-gradle-files.js +2 -6
  123. package/src/utils/find-all-npm-dependencies.js +3 -5
  124. package/src/utils/find-all-npm-dependencies.spec.ts +9 -17
  125. package/src/utils/symlink-task.d.ts +2 -0
  126. package/src/utils/symlink-task.js +18 -0
  127. package/src/utils/testing-generators.js +0 -1
  128. package/src/utils/versions.d.ts +13 -10
  129. package/src/utils/versions.js +14 -11
  130. package/plugin.d.ts +0 -1
  131. package/plugin.js +0 -6
  132. package/plugins/plugin.d.ts +0 -14
  133. package/plugins/plugin.js +0 -162
  134. package/src/executors/upgrade/schema.d.ts +0 -1
  135. package/src/executors/upgrade/schema.json +0 -11
  136. package/src/executors/upgrade/upgrade.impl.d.ts +0 -13
  137. package/src/executors/upgrade/upgrade.impl.js +0 -47
  138. package/src/executors/upgrade/upgrade.impl.ts +0 -64
  139. package/src/generators/application/files/app/.babelrc.js.template +0 -23
  140. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +0 -22
  141. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +0 -45
  142. package/src/generators/application/lib/add-e2e.d.ts +0 -3
  143. package/src/generators/application/lib/add-e2e.js +0 -46
  144. package/src/generators/library/files/lib/.babelrc.js.template +0 -21
  145. package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +0 -23
  146. package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +0 -15
  147. package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
  148. package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
  149. package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +0 -9
  150. package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +0 -82
  151. package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +0 -23
  152. package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
  153. package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
  154. package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +0 -14
  155. package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +0 -9
  156. package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +0 -77
  157. package/src/generators/web-configuration/lib/normalize-schema.d.ts +0 -17
  158. package/src/generators/web-configuration/lib/normalize-schema.js +0 -16
  159. package/src/generators/web-configuration/lib/webpack-targets.d.ts +0 -7
  160. package/src/generators/web-configuration/lib/webpack-targets.js +0 -75
  161. package/src/generators/web-configuration/schema.d.ts +0 -6
  162. package/src/generators/web-configuration/schema.json +0 -42
  163. package/src/generators/web-configuration/web-configuration.d.ts +0 -12
  164. package/src/generators/web-configuration/web-configuration.js +0 -87
  165. package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +0 -6
  166. package/src/migrations/update-18-0-0/add-upgrade-target.js +0 -33
  167. package/src/migrations/update-18-0-0/add-web-configuration.d.ts +0 -8
  168. package/src/migrations/update-18-0-0/add-web-configuration.js +0 -33
  169. package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +0 -39
  170. package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +0 -5
  171. package/src/migrations/update-18-0-0/change-storybook-targets.js +0 -57
  172. package/src/migrations/update-18-0-0/remove-block-list.d.ts +0 -6
  173. package/src/migrations/update-18-0-0/remove-block-list.js +0 -28
  174. package/src/migrations/update-18-0-0/remove-block-list.spec.ts +0 -68
  175. package/src/migrations/update-18-0-0/remove-metro.d.ts +0 -14
  176. package/src/migrations/update-18-0-0/remove-metro.js +0 -29
  177. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +0 -6
  178. package/src/migrations/update-18-0-0/remove-symlink-target.js +0 -30
  179. package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +0 -40
  180. package/src/utils/ensure-dependencies.d.ts +0 -2
  181. package/src/utils/ensure-dependencies.js +0 -30
package/.eslintrc.json CHANGED
@@ -32,13 +32,7 @@
32
32
  "react-native",
33
33
  // These are in ensurePackage
34
34
  "@nx/rollup",
35
- "@nx/storybook",
36
- "@nx/vite",
37
- "@nx/webpack",
38
- "@nx/detox",
39
- "@nx/cypress",
40
- "@nx/playwright",
41
- "ajv"
35
+ "@nx/storybook"
42
36
  ]
43
37
  }
44
38
  ]
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/README.md CHANGED
@@ -1,9 +1,4 @@
1
- <p style="text-align: center;">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
4
- <img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
5
- </picture>
6
- </p>
1
+ <p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
7
2
 
8
3
  <div style="text-align: center;">
9
4
 
@@ -20,9 +15,9 @@
20
15
 
21
16
  <hr>
22
17
 
23
- # Nx: Smart Monorepos · Fast CI
18
+ # Nx: Smart, Fast and Extensible Build System
24
19
 
25
- Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
20
+ Nx is a next generation build system with first class monorepo support and powerful integrations.
26
21
 
27
22
  This package is a [React Native plugin for Nx](https://nx.dev/packages/react-native).
28
23
 
@@ -64,5 +59,5 @@ npx nx@latest init
64
59
  - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
65
60
 
66
61
  <p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
67
- width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
62
+ width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
68
63
 
package/executors.json CHANGED
@@ -49,11 +49,6 @@
49
49
  "implementation": "./src/executors/pod-install/pod-install.impl",
50
50
  "schema": "./src/executors/pod-install/schema.json",
51
51
  "description": "Run `pod install` in the `ios` directory."
52
- },
53
- "upgrade": {
54
- "implementation": "./src/executors/upgrade/upgrade.impl",
55
- "schema": "./src/executors/upgrade/schema.json",
56
- "description": "upgrade executor"
57
52
  }
58
53
  }
59
54
  }
package/generators.json CHANGED
@@ -4,9 +4,9 @@
4
4
  "extends": ["@nx/workspace"],
5
5
  "generators": {
6
6
  "init": {
7
- "factory": "./src/generators/init/init#reactNativeInitGeneratorInternal",
7
+ "factory": "./src/generators/init/init#reactNativeInitGenerator",
8
8
  "schema": "./src/generators/init/schema.json",
9
- "description": "Initialize the `@nx/react-native` plugin.",
9
+ "description": "Initialize the `@nrwl/react-native` plugin.",
10
10
  "hidden": true
11
11
  },
12
12
  "application": {
@@ -30,29 +30,28 @@
30
30
  "aliases": ["c"]
31
31
  },
32
32
  "storybook-configuration": {
33
- "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationGeneratorInternal",
33
+ "factory": "./src/generators/storybook-configuration/configuration#storybookConfigurationGenerator",
34
34
  "schema": "./src/generators/storybook-configuration/schema.json",
35
- "description": "Set up Storybook for a React Native application or library."
35
+ "description": "Set up Storybook for a React-native application or library.",
36
+ "hidden": false
36
37
  },
37
38
  "component-story": {
38
39
  "factory": "./src/generators/component-story/component-story#componentStoryGenerator",
39
40
  "schema": "./src/generators/component-story/schema.json",
40
- "description": "Generate Storybook story for a React Native component."
41
+ "description": "Generate Storybook story for a React-native component.",
42
+ "hidden": false
41
43
  },
42
44
  "stories": {
43
45
  "factory": "./src/generators/stories/stories#storiesGenerator",
44
46
  "schema": "./src/generators/stories/schema.json",
45
- "description": "Create stories for all components declared in an application or library."
47
+ "description": "Create stories/specs for all components declared in an application or library.",
48
+ "hidden": false
46
49
  },
47
50
  "upgrade-native": {
48
51
  "factory": "./src/generators/upgrade-native/upgrade-native#reactNativeUpgradeNativeGenerator",
49
52
  "schema": "./src/generators/upgrade-native/schema.json",
50
- "description": "Destructive command to upgrade native iOS and Android code to latest."
51
- },
52
- "web-configuration": {
53
- "factory": "./src/generators/web-configuration/web-configuration#webConfigurationGenerator",
54
- "schema": "./src/generators/web-configuration/schema.json",
55
- "description": "Set up web configuration for a React Native app"
53
+ "description": "Destructive command to upgrade native iOS and Android code to latest.",
54
+ "hidden": false
56
55
  }
57
56
  }
58
57
  }
package/migrations.json CHANGED
@@ -41,42 +41,6 @@
41
41
  "version": "16.9.0-beta.1",
42
42
  "description": "Remove @types/react-native from package.json",
43
43
  "implementation": "./src/migrations/update-16-9-0/remove-types-react-native"
44
- },
45
- "update-18-0-0-add-web-configuration": {
46
- "cli": "nx",
47
- "version": "18.0.0-beta.0",
48
- "description": "Add web configuration to react native projects",
49
- "implementation": "./src/migrations/update-18-0-0/add-web-configuration"
50
- },
51
- "update-18-0-0-change-storybook-targets": {
52
- "cli": "nx",
53
- "version": "18.0.0-beta.0",
54
- "description": "Upgrade react native storybook target to use web",
55
- "implementation": "./src/migrations/update-18-0-0/change-storybook-targets"
56
- },
57
- "update-18-0-0-remove-block-list": {
58
- "cli": "nx",
59
- "version": "18.0.0-beta.0",
60
- "description": "Remove blockList in metro.config.js.",
61
- "implementation": "./src/migrations/update-18-0-0/remove-block-list"
62
- },
63
- "update-18-0-0-remove-metro": {
64
- "cli": "nx",
65
- "version": "18.0.0-beta.0",
66
- "description": "Remove metro-* and @react-native-community/cli-* from package.json devDependencies",
67
- "implementation": "./src/migrations/update-18-0-0/remove-metro"
68
- },
69
- "update-18-0-0-remove-symlink-target": {
70
- "cli": "nx",
71
- "version": "18.0.0-beta.0",
72
- "description": "Remove ensure-symlink target",
73
- "implementation": "./src/migrations/update-18-0-0/remove-symlink-target"
74
- },
75
- "update-18-0-0-add-upgrade-target": {
76
- "cli": "nx",
77
- "version": "18.0.0-beta.0",
78
- "description": "Add upgrade target to react native projects",
79
- "implementation": "./src/migrations/update-18-0-0/add-upgrade-target"
80
44
  }
81
45
  },
82
46
  "packageJsonUpdates": {
@@ -537,96 +501,6 @@
537
501
  "alwaysAddToPackageJson": false
538
502
  }
539
503
  }
540
- },
541
- "17.1.0": {
542
- "version": "17.1.0-beta.1",
543
- "packages": {
544
- "react-native": {
545
- "version": "0.72.6",
546
- "alwaysAddToPackageJson": false
547
- },
548
- "metro": {
549
- "version": "0.76.8",
550
- "alwaysAddToPackageJson": false
551
- },
552
- "metro-resolver": {
553
- "version": "0.76.8",
554
- "alwaysAddToPackageJson": false
555
- },
556
- "metro-config": {
557
- "version": "0.76.8",
558
- "alwaysAddToPackageJson": false
559
- },
560
- "metro-react-native-babel-preset": {
561
- "version": "0.76.8",
562
- "alwaysAddToPackageJson": false
563
- },
564
- "metro-babel-register": {
565
- "version": "0.76.8",
566
- "alwaysAddToPackageJson": false
567
- },
568
- "metro-react-native-babel-transformer": {
569
- "version": "0.76.7",
570
- "alwaysAddToPackageJson": false
571
- },
572
- "@react-native-community/cli": {
573
- "version": "11.3.7",
574
- "alwaysAddToPackageJson": false
575
- },
576
- "@react-native-community/cli-platform-android": {
577
- "version": "11.3.7",
578
- "alwaysAddToPackageJson": false
579
- },
580
- "@react-native-community/cli-platform-ios": {
581
- "version": "11.3.7",
582
- "alwaysAddToPackageJson": false
583
- }
584
- }
585
- },
586
- "17.3.0": {
587
- "version": "17.3.0-beta.3",
588
- "packages": {
589
- "@types/node": {
590
- "version": "18.16.9"
591
- }
592
- }
593
- },
594
- "18.0.0": {
595
- "version": "18.0.0-beta.0",
596
- "packages": {
597
- "react-native": {
598
- "version": "0.73.2",
599
- "alwaysAddToPackageJson": false
600
- },
601
- "@react-native/babel-preset": {
602
- "version": "^0.73.18",
603
- "addToPackageJson": "devDependencies"
604
- },
605
- "@react-native/metro-config": {
606
- "version": "^0.73.2",
607
- "addToPackageJson": "devDependencies"
608
- },
609
- "@types/react": {
610
- "version": "~18.2.45",
611
- "alwaysAddToPackageJson": false
612
- },
613
- "@testing-library/react-native": {
614
- "version": "~12.4.2",
615
- "alwaysAddToPackageJson": false
616
- },
617
- "react-native-svg-transformer": {
618
- "version": "1.2.0",
619
- "alwaysAddToPackageJson": false
620
- },
621
- "react-native-svg": {
622
- "version": "14.1.0",
623
- "alwaysAddToPackageJson": false
624
- },
625
- "@react-native-community/cli-platform-android": {
626
- "version": "12.3.0",
627
- "alwaysAddToPackageJson": false
628
- }
629
- }
630
504
  }
631
505
  }
632
506
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react-native",
3
- "version": "17.0.4",
3
+ "version": "v17.0.6",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: \n\n-Integration with libraries such as Jest, Detox, and Storybook.\n-Scaffolding for creating buildable libraries that can be published to npm.\n-Utilities for automatic workspace refactoring.",
6
6
  "keywords": [
@@ -25,24 +25,28 @@
25
25
  "main": "./index.js",
26
26
  "types": "index.d.ts",
27
27
  "dependencies": {
28
- "ajv": "^8.12.0",
29
28
  "chalk": "^4.1.0",
30
29
  "enhanced-resolve": "^5.8.3",
31
30
  "fs-extra": "^11.1.0",
32
31
  "glob": "7.1.4",
33
32
  "ignore": "^5.0.4",
34
- "metro-config": "~0.80.4",
35
- "metro-resolver": "~0.80.4",
33
+ "metro-config": "0.76.7",
34
+ "metro-resolver": "0.76.7",
35
+ "minimatch": "3.0.5",
36
36
  "node-fetch": "^2.6.7",
37
37
  "tsconfig-paths": "^4.1.2",
38
38
  "tslib": "^2.3.0",
39
- "@nx/devkit": "17.0.4",
40
- "@nx/jest": "17.0.4",
41
- "@nx/js": "17.0.4",
42
- "@nx/eslint": "17.0.4",
43
- "@nx/react": "17.0.4",
44
- "@nx/workspace": "17.0.4",
45
- "@nrwl/react-native": "17.0.4"
39
+ "@nx/detox": "v17.0.6",
40
+ "@nx/devkit": "v17.0.6",
41
+ "@nx/jest": "v17.0.6",
42
+ "@nx/js": "v17.0.6",
43
+ "@nx/eslint": "v17.0.6",
44
+ "@nx/react": "v17.0.6",
45
+ "@nx/workspace": "v17.0.6",
46
+ "@nrwl/react-native": "v17.0.6"
47
+ },
48
+ "peerDependencies": {
49
+ "react-native": ">= 0.72.0 < 0.73.0"
46
50
  },
47
51
  "executors": "./executors.json",
48
52
  "ng-update": {
@@ -27,9 +27,6 @@ function getResolveRequest(extensions) {
27
27
  if (resolvedPath) {
28
28
  return resolvedPath;
29
29
  }
30
- if (debug) {
31
- console.log(chalk.red(`[Nx] Unable to resolve with any resolver: ${realModuleName}`));
32
- }
33
30
  throw new Error(`Cannot resolve ${chalk.bold(realModuleName)}`);
34
31
  };
35
32
  }
@@ -87,7 +84,7 @@ function tsconfigPathsResolver(context, extensions, realModuleName, platform, de
87
84
  }
88
85
  catch {
89
86
  if (debug) {
90
- console.log(chalk.cyan(`[Nx] Failed to resolve ${chalk.bold(realModuleName)}`));
87
+ console.log(chalk.red(`[Nx] Failed to resolve ${chalk.bold(realModuleName)}`));
91
88
  console.log(chalk.cyan(`[Nx] The following tsconfig paths was used:\n:${chalk.bold(JSON.stringify(paths, null, 2))}`));
92
89
  }
93
90
  }
@@ -11,18 +11,14 @@ async function withNxMetro(userConfig, opts = {}) {
11
11
  process.env.NX_REACT_NATIVE_DEBUG = 'true';
12
12
  if (opts.extensions)
13
13
  extensions.push(...opts.extensions);
14
- let watchFolders = (0, fs_extra_1.readdirSync)(devkit_1.workspaceRoot)
15
- .filter((fileName) => !['dist', 'e2e'].includes(fileName) && !fileName.startsWith('.'))
16
- .map((fileName) => (0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, fileName))
17
- .filter((filePath) => (0, fs_extra_1.statSync)(filePath).isDirectory());
14
+ let watchFolders = [devkit_1.workspaceRoot];
18
15
  if (opts.watchFolders?.length) {
19
16
  watchFolders = watchFolders.concat(opts.watchFolders);
20
17
  }
21
- watchFolders = [...new Set(watchFolders)].filter((folder) => (0, fs_extra_1.existsSync)(folder));
18
+ watchFolders = watchFolders.filter((folder) => (0, fs_extra_1.existsSync)(folder));
22
19
  const nxConfig = {
23
20
  resolver: {
24
21
  resolveRequest: (0, metro_resolver_1.getResolveRequest)(extensions),
25
- nodeModulesPaths: [(0, devkit_1.joinPathFragments)(devkit_1.workspaceRoot, 'node_modules')],
26
22
  },
27
23
  watchFolders,
28
24
  };
@@ -6,14 +6,18 @@ const chmod_android_gradle_files_1 = require("../../utils/chmod-android-gradle-f
6
6
  const get_cli_options_1 = require("../../utils/get-cli-options");
7
7
  async function* buildAndroidExecutor(options, context) {
8
8
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
9
- (0, chmod_android_gradle_files_1.chmodAndroidGradlewFiles)((0, path_1.join)(context.root, projectRoot, 'android'));
9
+ (0, chmod_android_gradle_files_1.chmodAndroidGradlewFiles)((0, path_1.join)(projectRoot, 'android'));
10
10
  await runCliBuild(context.root, projectRoot, options);
11
11
  yield { success: true };
12
12
  }
13
13
  exports.default = buildAndroidExecutor;
14
14
  function runCliBuild(workspaceRoot, projectRoot, options) {
15
15
  return new Promise((res, reject) => {
16
- const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['build-android', ...createBuildAndroidOptions(options)], {
16
+ /**
17
+ * Call the react native cli with option `--no-packager`
18
+ * Not passing '--packager' due to cli will launch start command from the project root
19
+ */
20
+ const childProcess = (0, child_process_1.fork)(require.resolve('react-native/cli.js'), ['build-android', ...createBuildAndroidOptions(options), '--no-packager'], {
17
21
  stdio: 'inherit',
18
22
  cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
19
23
  env: { ...process.env, RCT_METRO_PORT: options.port.toString() },
@@ -15,7 +15,7 @@ export default async function* buildAndroidExecutor(
15
15
  ): AsyncGenerator<ReactNativeBuildOutput> {
16
16
  const projectRoot =
17
17
  context.projectsConfigurations.projects[context.projectName].root;
18
- chmodAndroidGradlewFiles(join(context.root, projectRoot, 'android'));
18
+ chmodAndroidGradlewFiles(join(projectRoot, 'android'));
19
19
 
20
20
  await runCliBuild(context.root, projectRoot, options);
21
21
  yield { success: true };
@@ -27,9 +27,13 @@ function runCliBuild(
27
27
  options: ReactNativeBuildAndroidOptions
28
28
  ) {
29
29
  return new Promise<ChildProcess>((res, reject) => {
30
+ /**
31
+ * Call the react native cli with option `--no-packager`
32
+ * Not passing '--packager' due to cli will launch start command from the project root
33
+ */
30
34
  const childProcess = fork(
31
35
  require.resolve('react-native/cli.js'),
32
- ['build-android', ...createBuildAndroidOptions(options)],
36
+ ['build-android', ...createBuildAndroidOptions(options), '--no-packager'],
33
37
  {
34
38
  stdio: 'inherit',
35
39
  cwd: pathResolve(workspaceRoot, projectRoot),
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxReactNativeBuildAndroid",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Release Build for Android",
8
8
  "description": "Build target options for Android.",
9
9
  "type": "object",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://json-schema.org/schema",
2
+ "$schema": "http://json-schema.org/schema",
3
3
  "version": 2,
4
4
  "cli": "nx",
5
5
  "title": "React Native Build iOS executor",
@@ -1,4 +1,4 @@
1
- // options form https://github.com/facebook/react-native/tree/main/packages/community-cli-plugin#bundle
1
+ // options form https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
2
2
  export interface ReactNativeBundleOptions {
3
3
  entryFile: string;
4
4
  platform: string;
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxReactNativeBundle",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Offline JS Bundle for React Native",
8
8
  "description": "JS Bundle target options.",
9
9
  "type": "object",
@@ -2,8 +2,4 @@ import { ExecutorContext } from '@nx/devkit';
2
2
  export interface ReactNativeEnsureSymlinkOutput {
3
3
  success: boolean;
4
4
  }
5
- /**
6
- * TODO (@xiongemi): remove this function in v19.
7
- * @deprecated It is no longer needed for react native 73.
8
- */
9
5
  export default function ensureSymlinkExecutor(_: any, context: ExecutorContext): AsyncGenerator<ReactNativeEnsureSymlinkOutput>;
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const ensure_node_modules_symlink_1 = require("../../utils/ensure-node-modules-symlink");
4
- /**
5
- * TODO (@xiongemi): remove this function in v19.
6
- * @deprecated It is no longer needed for react native 73.
7
- */
8
4
  async function* ensureSymlinkExecutor(_, context) {
9
5
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
10
6
  (0, ensure_node_modules_symlink_1.ensureNodeModulesSymlink)(context.root, projectRoot);
@@ -5,10 +5,6 @@ export interface ReactNativeEnsureSymlinkOutput {
5
5
  success: boolean;
6
6
  }
7
7
 
8
- /**
9
- * TODO (@xiongemi): remove this function in v19.
10
- * @deprecated It is no longer needed for react native 73.
11
- */
12
8
  export default async function* ensureSymlinkExecutor(
13
9
  _,
14
10
  context: ExecutorContext
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxReactNativeEnsureSymlink",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Ensure Symlink for React Native",
8
8
  "description": "Ensure workspace node_modules is symlink under app's node_modules folder.",
9
9
  "type": "object",
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxReactNativePodInstall",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Run Pod Install for React Native iOS Project",
8
8
  "description": "Run `pod install` for React Native iOS Project.",
9
9
  "type": "object",
@@ -8,16 +8,28 @@ const get_cli_options_1 = require("../../utils/get-cli-options");
8
8
  let childProcess;
9
9
  async function* runAndroidExecutor(options, context) {
10
10
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
11
- (0, chmod_android_gradle_files_1.chmodAndroidGradlewFiles)((0, path_1.join)(context.root, projectRoot, 'android'));
12
- const tasks = [runCliRunAndroid(context.root, projectRoot, options)];
11
+ (0, chmod_android_gradle_files_1.chmodAndroidGradlewFiles)((0, path_1.join)(projectRoot, 'android'));
13
12
  if (options.mode !== 'Release') {
14
- tasks.push((0, start_impl_1.runCliStart)(context.root, projectRoot, {
13
+ const startResults = (0, start_impl_1.default)({
15
14
  port: options.port,
16
15
  resetCache: options.resetCache,
17
16
  interactive: true,
18
- }));
17
+ }, context);
18
+ for await (const result of startResults) {
19
+ if (result.success) {
20
+ await runCliRunAndroid(context.root, projectRoot, options);
21
+ yield {
22
+ success: true,
23
+ };
24
+ }
25
+ else {
26
+ return result;
27
+ }
28
+ }
29
+ }
30
+ else {
31
+ await runCliRunAndroid(context.root, projectRoot, options);
19
32
  }
20
- await Promise.all(tasks);
21
33
  yield { success: true };
22
34
  }
23
35
  exports.default = runAndroidExecutor;
@@ -3,7 +3,7 @@ import { join, resolve as pathResolve } from 'path';
3
3
  import { ChildProcess, fork } from 'child_process';
4
4
 
5
5
  import { ReactNativeRunAndroidOptions } from './schema';
6
- import { runCliStart } from '../start/start.impl';
6
+ import startExecutor from '../start/start.impl';
7
7
  import { chmodAndroidGradlewFiles } from '../../utils/chmod-android-gradle-files';
8
8
  import { getCliOptions } from '../../utils/get-cli-options';
9
9
 
@@ -19,22 +19,31 @@ export default async function* runAndroidExecutor(
19
19
  ): AsyncGenerator<ReactNativeRunAndroidOutput> {
20
20
  const projectRoot =
21
21
  context.projectsConfigurations.projects[context.projectName].root;
22
- chmodAndroidGradlewFiles(join(context.root, projectRoot, 'android'));
23
-
24
- const tasks = [runCliRunAndroid(context.root, projectRoot, options)];
22
+ chmodAndroidGradlewFiles(join(projectRoot, 'android'));
25
23
 
26
24
  if (options.mode !== 'Release') {
27
- tasks.push(
28
- runCliStart(context.root, projectRoot, {
25
+ const startResults = startExecutor(
26
+ {
29
27
  port: options.port,
30
28
  resetCache: options.resetCache,
31
29
  interactive: true,
32
- })
30
+ },
31
+ context
33
32
  );
33
+ for await (const result of startResults) {
34
+ if (result.success) {
35
+ await runCliRunAndroid(context.root, projectRoot, options);
36
+ yield {
37
+ success: true,
38
+ };
39
+ } else {
40
+ return result;
41
+ }
42
+ }
43
+ } else {
44
+ await runCliRunAndroid(context.root, projectRoot, options);
34
45
  }
35
46
 
36
- await Promise.all(tasks);
37
-
38
47
  yield { success: true };
39
48
  }
40
49
 
@@ -3,7 +3,7 @@
3
3
  "outputCapture": "direct-nodejs",
4
4
  "cli": "nx",
5
5
  "$id": "NxReactNativeRunAndroid",
6
- "$schema": "https://json-schema.org/schema",
6
+ "$schema": "http://json-schema.org/schema",
7
7
  "title": "Run Android application",
8
8
  "description": "Run Android target options.",
9
9
  "type": "object",
@@ -10,15 +10,27 @@ async function* runIosExecutor(options, context) {
10
10
  throw new Error(`The run-ios build requires Mac to run`);
11
11
  }
12
12
  const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
13
- const tasks = [runCliRunIOS(context.root, projectRoot, options)];
14
13
  if (options.mode !== 'Release') {
15
- tasks.push((0, start_impl_1.runCliStart)(context.root, projectRoot, {
14
+ const startResults = (0, start_impl_1.default)({
16
15
  port: options.port,
17
16
  resetCache: options.resetCache,
18
17
  interactive: true,
19
- }));
18
+ }, context);
19
+ for await (const result of startResults) {
20
+ if (result.success) {
21
+ await runCliRunIOS(context.root, projectRoot, options);
22
+ yield {
23
+ success: true,
24
+ };
25
+ }
26
+ else {
27
+ return result;
28
+ }
29
+ }
30
+ }
31
+ else {
32
+ await runCliRunIOS(context.root, projectRoot, options);
20
33
  }
21
- await Promise.all(tasks);
22
34
  yield { success: true };
23
35
  }
24
36
  exports.default = runIosExecutor;