@nx/react-native 18.0.0-beta.1 → 18.0.0-canary.20240201-8762c38

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 (149) hide show
  1. package/.eslintrc.json +6 -1
  2. package/executors.json +5 -0
  3. package/generators.json +10 -9
  4. package/migrations.json +73 -1
  5. package/package.json +10 -15
  6. package/plugins/metro-resolver.js +4 -1
  7. package/plugins/with-nx-metro.js +6 -2
  8. package/src/executors/build-android/build-android.impl.js +1 -5
  9. package/src/executors/build-android/build-android.impl.ts +1 -5
  10. package/src/executors/bundle/schema.d.ts +1 -1
  11. package/src/executors/ensure-symlink/ensure-symlink.impl.d.ts +4 -0
  12. package/src/executors/ensure-symlink/ensure-symlink.impl.js +4 -0
  13. package/src/executors/ensure-symlink/ensure-symlink.impl.ts +4 -0
  14. package/src/executors/run-android/run-android.impl.js +4 -16
  15. package/src/executors/run-android/run-android.impl.ts +8 -17
  16. package/src/executors/run-ios/run-ios.impl.js +4 -16
  17. package/src/executors/run-ios/run-ios.impl.ts +9 -18
  18. package/src/executors/start/schema.d.ts +1 -1
  19. package/src/executors/start/start.impl.js +11 -26
  20. package/src/executors/start/start.impl.ts +14 -28
  21. package/src/executors/storybook/storybook.impl.d.ts +4 -0
  22. package/src/executors/storybook/storybook.impl.js +5 -1
  23. package/src/executors/storybook/storybook.impl.ts +13 -15
  24. package/src/executors/sync-deps/sync-deps.impl.d.ts +2 -2
  25. package/src/executors/sync-deps/sync-deps.impl.js +20 -5
  26. package/src/executors/sync-deps/sync-deps.impl.ts +20 -9
  27. package/src/executors/upgrade/schema.d.ts +1 -0
  28. package/src/executors/upgrade/schema.json +11 -0
  29. package/src/executors/upgrade/upgrade.impl.d.ts +13 -0
  30. package/src/executors/upgrade/upgrade.impl.js +47 -0
  31. package/src/executors/upgrade/upgrade.impl.ts +64 -0
  32. package/src/generators/application/application.js +21 -7
  33. package/src/generators/application/application.spec.ts +27 -0
  34. package/src/generators/application/files/app/.babelrc.js.template +23 -0
  35. package/src/generators/application/files/app/android/app/build.gradle.template +12 -28
  36. package/src/generators/application/files/app/android/app/src/debug/AndroidManifest.xml.template +2 -6
  37. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.kt.template +22 -0
  38. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.kt.template +45 -0
  39. package/src/generators/application/files/app/android/build.gradle.template +7 -20
  40. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.properties +2 -1
  41. package/src/generators/application/files/app/android/gradle.properties +0 -3
  42. package/src/generators/application/files/app/android/gradlew.template +12 -7
  43. package/src/generators/application/files/app/android/settings.gradle.template +2 -2
  44. package/src/generators/application/files/app/ios/Podfile.template +0 -7
  45. package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +5 -0
  46. package/src/generators/application/files/app/ios/__className__/Info.plist.template +5 -8
  47. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +11 -33
  48. package/src/generators/application/files/app/metro.config.js.template +0 -4
  49. package/src/generators/application/files/app/src/app/App.tsx.template +5 -2
  50. package/src/generators/application/lib/add-e2e.d.ts +3 -0
  51. package/src/generators/application/lib/add-e2e.js +47 -0
  52. package/src/generators/application/lib/add-project.js +13 -17
  53. package/src/generators/application/lib/normalize-options.d.ts +4 -0
  54. package/src/generators/application/lib/normalize-options.js +8 -3
  55. package/src/generators/application/lib/normalize-options.spec.ts +48 -5
  56. package/src/generators/application/schema.d.ts +4 -3
  57. package/src/generators/application/schema.json +13 -5
  58. package/src/generators/component-story/component-story.d.ts +5 -8
  59. package/src/generators/component-story/component-story.js +8 -69
  60. package/src/generators/component-story/schema.d.ts +1 -0
  61. package/src/generators/component-story/schema.json +10 -2
  62. package/src/generators/init/init.js +0 -3
  63. package/src/generators/library/files/lib/.babelrc.js.template +21 -0
  64. package/src/generators/library/library.spec.ts +11 -0
  65. package/src/generators/library/schema.json +1 -1
  66. package/src/generators/stories/schema.d.ts +2 -0
  67. package/src/generators/stories/schema.json +14 -1
  68. package/src/generators/stories/stories.d.ts +5 -2
  69. package/src/generators/stories/stories.js +7 -50
  70. package/src/generators/storybook-configuration/configuration.d.ts +6 -2
  71. package/src/generators/storybook-configuration/configuration.js +7 -48
  72. package/src/generators/storybook-configuration/schema.d.ts +3 -2
  73. package/src/generators/storybook-configuration/schema.json +21 -11
  74. package/src/generators/upgrade-native/lib/normalize-options.d.ts +1 -1
  75. package/src/generators/upgrade-native/schema.d.ts +1 -1
  76. package/src/generators/upgrade-native/schema.json +2 -2
  77. package/src/generators/upgrade-native/upgrade-native.d.ts +2 -0
  78. package/src/generators/upgrade-native/upgrade-native.js +3 -0
  79. package/src/generators/web-configuration/files/base-vite/.babelrc.js.template +23 -0
  80. package/src/generators/web-configuration/files/base-vite/index.html__tmpl__ +15 -0
  81. package/src/generators/web-configuration/files/base-vite/public/favicon.ico +0 -0
  82. package/src/generators/web-configuration/files/base-vite/src/assets/.gitkeep +0 -0
  83. package/src/generators/web-configuration/files/base-vite/src/main-web.tsx__tmpl__ +9 -0
  84. package/src/generators/web-configuration/files/base-vite/vite.config.ts__tmpl__ +82 -0
  85. package/src/generators/web-configuration/files/base-webpack/.babelrc.js.template +23 -0
  86. package/src/generators/web-configuration/files/base-webpack/src/assets/.gitkeep +0 -0
  87. package/src/generators/web-configuration/files/base-webpack/src/favicon.ico +0 -0
  88. package/src/generators/web-configuration/files/base-webpack/src/index.html__tmpl__ +14 -0
  89. package/src/generators/web-configuration/files/base-webpack/src/main-web.tsx__tmpl__ +9 -0
  90. package/src/generators/web-configuration/files/base-webpack/webpack.config.js__tmpl__ +77 -0
  91. package/src/generators/web-configuration/lib/normalize-schema.d.ts +17 -0
  92. package/src/generators/web-configuration/lib/normalize-schema.js +16 -0
  93. package/src/generators/web-configuration/lib/webpack-targets.d.ts +7 -0
  94. package/src/generators/web-configuration/lib/webpack-targets.js +75 -0
  95. package/src/generators/web-configuration/schema.d.ts +6 -0
  96. package/src/generators/web-configuration/schema.json +42 -0
  97. package/src/generators/web-configuration/web-configuration.d.ts +12 -0
  98. package/src/generators/web-configuration/web-configuration.js +85 -0
  99. package/src/migrations/update-16-6-0/update-metro-config.js +0 -4
  100. package/src/migrations/update-16-9-0/remove-types-react-native.js +2 -9
  101. package/src/migrations/update-18-0-0/add-upgrade-target.d.ts +6 -0
  102. package/src/migrations/update-18-0-0/add-upgrade-target.js +33 -0
  103. package/src/migrations/update-18-0-0/add-web-configuration.d.ts +8 -0
  104. package/src/migrations/update-18-0-0/add-web-configuration.js +33 -0
  105. package/src/migrations/update-18-0-0/add-web-configuration.spec.ts +39 -0
  106. package/src/migrations/update-18-0-0/change-storybook-targets.d.ts +5 -0
  107. package/src/migrations/update-18-0-0/change-storybook-targets.js +57 -0
  108. package/src/migrations/update-18-0-0/remove-block-list.d.ts +6 -0
  109. package/src/migrations/update-18-0-0/remove-block-list.js +26 -0
  110. package/src/migrations/update-18-0-0/remove-block-list.spec.ts +68 -0
  111. package/src/migrations/update-18-0-0/remove-metro.d.ts +14 -0
  112. package/src/migrations/update-18-0-0/remove-metro.js +29 -0
  113. package/src/migrations/update-18-0-0/remove-symlink-target.d.ts +6 -0
  114. package/src/migrations/update-18-0-0/remove-symlink-target.js +30 -0
  115. package/src/migrations/update-18-0-0/remove-symlink-target.spec.ts +40 -0
  116. package/src/utils/add-jest.js +11 -0
  117. package/src/utils/ensure-dependencies.js +2 -6
  118. package/src/utils/testing-generators.js +1 -0
  119. package/src/utils/versions.d.ts +9 -12
  120. package/src/utils/versions.js +10 -13
  121. package/src/generators/application/files/app/android/app/src/debug/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +0 -75
  122. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +0 -32
  123. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainApplication.java.template +0 -62
  124. package/src/generators/application/files/app/android/app/src/release/java/com/__lowerCaseName__/ReactNativeFlipper.java.template +0 -20
  125. package/src/generators/application/files/app/babel.config.json.template +0 -10
  126. package/src/generators/application/lib/add-detox.d.ts +0 -3
  127. package/src/generators/application/lib/add-detox.js +0 -23
  128. package/src/generators/component-story/component-story.spec.ts +0 -427
  129. package/src/generators/component-story/files/__componentFileName__.stories.__fileExt__ +0 -32
  130. package/src/generators/library/files/lib/babel.config.json.template +0 -19
  131. package/src/generators/stories/stories-app.spec.ts +0 -128
  132. package/src/generators/stories/stories-lib.spec.ts +0 -105
  133. package/src/generators/storybook-configuration/configuration.spec.ts +0 -135
  134. package/src/generators/storybook-configuration/files/app/storybook.ts.template +0 -9
  135. package/src/generators/storybook-configuration/files/app/toggle-storybook.tsx.template +0 -74
  136. package/src/generators/storybook-configuration/files/root/story-loader.ts.template +0 -5
  137. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.d.ts +0 -6
  138. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.js +0 -25
  139. package/src/generators/storybook-configuration/lib/add-resolver-main-fields-to-metro-config.spec.ts +0 -161
  140. package/src/generators/storybook-configuration/lib/create-storybook-files.d.ts +0 -6
  141. package/src/generators/storybook-configuration/lib/create-storybook-files.js +0 -42
  142. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.d.ts +0 -7
  143. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.js +0 -29
  144. package/src/generators/storybook-configuration/lib/replace-app-import-with-storybook-toggle.spec.ts +0 -65
  145. package/src/utils/find-all-npm-dependencies.d.ts +0 -2
  146. package/src/utils/find-all-npm-dependencies.js +0 -25
  147. package/src/utils/find-all-npm-dependencies.spec.ts +0 -95
  148. package/src/utils/symlink-task.d.ts +0 -2
  149. package/src/utils/symlink-task.js +0 -18
@@ -0,0 +1,45 @@
1
+ package com.<%= lowerCaseName %>
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeHost
8
+ import com.facebook.react.ReactPackage
9
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11
+ import com.facebook.react.defaults.DefaultReactNativeHost
12
+ import com.facebook.react.flipper.ReactNativeFlipper
13
+ import com.facebook.soloader.SoLoader
14
+
15
+ class MainApplication : Application(), ReactApplication {
16
+
17
+ override val reactNativeHost: ReactNativeHost =
18
+ object : DefaultReactNativeHost(this) {
19
+ override fun getPackages(): List<ReactPackage> {
20
+ // Packages that cannot be autolinked yet can be added manually here, for example:
21
+ // packages.add(new MyReactNativePackage());
22
+ return PackageList(this).packages
23
+ }
24
+
25
+ override fun getJSMainModuleName(): String = "src/main"
26
+
27
+ override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28
+
29
+ override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30
+ override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31
+ }
32
+
33
+ override val reactHost: ReactHost
34
+ get() = getDefaultReactHost(this.applicationContext, reactNativeHost)
35
+
36
+ override fun onCreate() {
37
+ super.onCreate()
38
+ SoLoader.init(this, false)
39
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40
+ // If you opted-in for the New Architecture, we load the native entry point for this app.
41
+ load()
42
+ }
43
+ ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager)
44
+ }
45
+ }
@@ -1,15 +1,11 @@
1
- // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
-
3
1
  buildscript {
4
2
  ext {
5
- buildToolsVersion = "33.0.0"
3
+ buildToolsVersion = "34.0.0"
6
4
  minSdkVersion = 21
7
- compileSdkVersion = 33
8
- targetSdkVersion = 33
9
- kotlinVersion = "1.8.20"
10
-
11
- // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
12
- ndkVersion = "23.1.7779620"
5
+ compileSdkVersion = 34
6
+ targetSdkVersion = 34
7
+ ndkVersion = "25.1.8937393"
8
+ kotlinVersion = "1.8.0"
13
9
  }
14
10
  repositories {
15
11
  google()
@@ -18,17 +14,8 @@ buildscript {
18
14
  dependencies {
19
15
  classpath("com.android.tools.build:gradle")
20
16
  classpath("com.facebook.react:react-native-gradle-plugin")
21
- classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
22
18
  }
23
19
  }
24
20
 
25
- allprojects {
26
- repositories {
27
- <% if (e2eTestRunner === 'detox') { %>
28
- maven {
29
- // https://wix.github.io/Detox/docs/introduction/project-setup
30
- url("$rootDir/../node_modules/detox/Detox-android")
31
- }
32
- <% } %>
33
- }
34
- }
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -1,6 +1,7 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
4
4
  networkTimeout=10000
5
+ validateDistributionUrl=true
5
6
  zipStoreBase=GRADLE_USER_HOME
6
7
  zipStorePath=wrapper/dists
@@ -24,9 +24,6 @@ android.useAndroidX=true
24
24
  # Automatically convert third-party libraries to use AndroidX
25
25
  android.enableJetifier=true
26
26
 
27
- # Version of flipper SDK to use with React Native
28
- FLIPPER_VERSION=0.182.0
29
-
30
27
  # Use this property to specify which architecture you want to build.
31
28
  # You can also override it from the CLI using
32
29
  # ./gradlew <task> -PreactNativeArchitectures=x86_64
@@ -83,10 +83,8 @@ done
83
83
  # This is normally unused
84
84
  # shellcheck disable=SC2034
85
85
  APP_BASE_NAME=${0##*/}
86
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87
-
88
- # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
- DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
86
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87
+ APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
90
88
 
91
89
  # Use the maximum available, or set MAX_FD != -1 to use that value.
92
90
  MAX_FD=maximum
@@ -133,10 +131,13 @@ location of your Java installation."
133
131
  fi
134
132
  else
135
133
  JAVACMD=java
136
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
134
+ if ! command -v java >/dev/null 2>&1
135
+ then
136
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
137
137
 
138
138
  Please set the JAVA_HOME variable in your environment to match the
139
139
  location of your Java installation."
140
+ fi
140
141
  fi
141
142
 
142
143
  # Increase the maximum file descriptors if we can.
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
145
  case $MAX_FD in #(
145
146
  max*)
146
147
  # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147
- # shellcheck disable=SC3045
148
+ # shellcheck disable=SC3045
148
149
  MAX_FD=$( ulimit -H -n ) ||
149
150
  warn "Could not query maximum file descriptor limit"
150
151
  esac
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
152
153
  '' | soft) :;; #(
153
154
  *)
154
155
  # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155
- # shellcheck disable=SC3045
156
+ # shellcheck disable=SC3045
156
157
  ulimit -n "$MAX_FD" ||
157
158
  warn "Could not set maximum file descriptor limit to $MAX_FD"
158
159
  esac
@@ -197,6 +198,10 @@ if "$cygwin" || "$msys" ; then
197
198
  done
198
199
  fi
199
200
 
201
+
202
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
+
200
205
  # Collect all arguments for the java command;
201
206
  # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
202
207
  # shell script including quotes and variable substitutions, so put them in
@@ -1,4 +1,4 @@
1
1
  rootProject.name = '<%= className %>'
2
- apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
2
+ apply from: file("<%= offsetFromRoot %>../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
3
3
  include ':app'
4
- includeBuild('../node_modules/@react-native/gradle-plugin')
4
+ includeBuild('<%= offsetFromRoot %>../node_modules/@react-native/gradle-plugin')
@@ -28,14 +28,8 @@ end
28
28
  target '<%= className %>' do
29
29
  config = use_native_modules!
30
30
 
31
- # Flags change depending on the env values.
32
- flags = get_default_flags()
33
-
34
31
  use_react_native!(
35
32
  :path => config[:reactNativePath],
36
- # Hermes is now enabled by default. Disable by setting this flag to false.
37
- :hermes_enabled => flags[:hermes_enabled],
38
- :fabric_enabled => flags[:fabric_enabled],
39
33
  # Enables Flipper.
40
34
  #
41
35
  # Note that if you have use_frameworks! enabled, Flipper will not work and
@@ -57,6 +51,5 @@ target '<%= className %>' do
57
51
  config[:reactNativePath],
58
52
  :mac_catalyst_enabled => false
59
53
  )
60
- __apply_Xcode_12_5_M1_post_install_workaround(installer)
61
54
  end
62
55
  end
@@ -15,6 +15,11 @@
15
15
  }
16
16
 
17
17
  - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
18
+ {
19
+ return [self getBundleURL];
20
+ }
21
+
22
+ - (NSURL *)getBundleURL
18
23
  {
19
24
  #if DEBUG
20
25
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"<%= entryFileIos %>"];
@@ -26,14 +26,11 @@
26
26
  <true/>
27
27
  <key>NSAppTransportSecurity</key>
28
28
  <dict>
29
- <key>NSExceptionDomains</key>
30
- <dict>
31
- <key>localhost</key>
32
- <dict>
33
- <key>NSExceptionAllowsInsecureHTTPLoads</key>
34
- <true/>
35
- </dict>
36
- </dict>
29
+ <!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
30
+ <key>NSAllowsArbitraryLoads</key>
31
+ <false/>
32
+ <key>NSAllowsLocalNetworking</key>
33
+ <true/>
37
34
  </dict>
38
35
  <key>NSLocationWhenInUseUsageDescription</key>
39
36
  <string></string>
@@ -177,7 +177,6 @@
177
177
  buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "<%= className %>" */;
178
178
  buildPhases = (
179
179
  C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,
180
- FD10A7F022414F080027D42C /* Start Packager */,
181
180
  13B07F871A680F5B00A75B9A /* Sources */,
182
181
  13B07F8C1A680F5B00A75B9A /* Frameworks */,
183
182
  13B07F8E1A680F5B00A75B9A /* Resources */,
@@ -264,7 +263,7 @@
264
263
  );
265
264
  runOnlyForDeploymentPostprocessing = 0;
266
265
  shellPath = /bin/sh;
267
- shellScript = "set -e\n\nWITH_ENVIRONMENT=\"../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
266
+ shellScript = "set -e\n\nWITH_ENVIRONMENT=\"<%= offsetFromRoot %>../node_modules/react-native/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"<%= offsetFromRoot %>../node_modules/react-native/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
268
267
  };
269
268
  00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
270
269
  isa = PBXShellScriptBuildPhase;
@@ -378,25 +377,6 @@
378
377
  shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-<%= className %>-<%= className %>Tests/Pods-<%= className %>-<%= className %>Tests-resources.sh\"\n";
379
378
  showEnvVarsInLog = 0;
380
379
  };
381
- FD10A7F022414F080027D42C /* Start Packager */ = {
382
- isa = PBXShellScriptBuildPhase;
383
- buildActionMask = 2147483647;
384
- files = (
385
- );
386
- inputFileListPaths = (
387
- );
388
- inputPaths = (
389
- );
390
- name = "Start Packager";
391
- outputFileListPaths = (
392
- );
393
- outputPaths = (
394
- );
395
- runOnlyForDeploymentPostprocessing = 0;
396
- shellPath = /bin/sh;
397
- shellScript = "export RCT_METRO_PORT=\"${RCT_METRO_PORT:=8081}\"\necho \"export RCT_METRO_PORT=${RCT_METRO_PORT}\" > \"${SRCROOT}/../node_modules/react-native/scripts/.packager.env\"\nif [ -z \"${RCT_NO_LAUNCH_PACKAGER+xxx}\" ] ; then\n if nc -w 5 -z localhost ${RCT_METRO_PORT} ; then\n if ! curl -s \"http://localhost:${RCT_METRO_PORT}/status\" | grep -q \"packager-status:running\" ; then\n echo \"Port ${RCT_METRO_PORT} already in use, packager is either not running or not running correctly\"\n exit 2\n fi\n else\n open \"$SRCROOT/../node_modules/react-native/scripts/launchPackager.command\" || echo \"Can't start packager automatically\"\n fi\nfi\n";
398
- showEnvVarsInLog = 0;
399
- };
400
380
  /* End PBXShellScriptBuildPhase section */
401
381
 
402
382
  /* Begin PBXSourcesBuildPhase section */
@@ -438,7 +418,7 @@
438
418
  "$(inherited)",
439
419
  );
440
420
  INFOPLIST_FILE = <%= className %>Tests/Info.plist;
441
- IPHONEOS_DEPLOYMENT_TARGET = 12.4;
421
+ IPHONEOS_DEPLOYMENT_TARGET = 13.4;
442
422
  LD_RUNPATH_SEARCH_PATHS = (
443
423
  "$(inherited)",
444
424
  "@executable_path/Frameworks",
@@ -462,7 +442,7 @@
462
442
  BUNDLE_LOADER = "$(TEST_HOST)";
463
443
  COPY_PHASE_STRIP = NO;
464
444
  INFOPLIST_FILE = <%= className %>Tests/Info.plist;
465
- IPHONEOS_DEPLOYMENT_TARGET = 12.4;
445
+ IPHONEOS_DEPLOYMENT_TARGET = 13.4;
466
446
  LD_RUNPATH_SEARCH_PATHS = (
467
447
  "$(inherited)",
468
448
  "@executable_path/Frameworks",
@@ -536,7 +516,7 @@
536
516
  buildSettings = {
537
517
  ALWAYS_SEARCH_USER_PATHS = NO;
538
518
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
539
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
519
+ CLANG_CXX_LANGUAGE_STANDARD = "c++20";
540
520
  CLANG_CXX_LIBRARY = "libc++";
541
521
  CLANG_ENABLE_MODULES = YES;
542
522
  CLANG_ENABLE_OBJC_ARC = YES;
@@ -564,7 +544,7 @@
564
544
  COPY_PHASE_STRIP = NO;
565
545
  ENABLE_STRICT_OBJC_MSGSEND = YES;
566
546
  ENABLE_TESTABILITY = YES;
567
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
547
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
568
548
  GCC_C_LANGUAGE_STANDARD = gnu99;
569
549
  GCC_DYNAMIC_NO_PIC = NO;
570
550
  GCC_NO_COMMON_BLOCKS = YES;
@@ -580,7 +560,7 @@
580
560
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
581
561
  GCC_WARN_UNUSED_FUNCTION = YES;
582
562
  GCC_WARN_UNUSED_VARIABLE = YES;
583
- IPHONEOS_DEPLOYMENT_TARGET = 12.4;
563
+ IPHONEOS_DEPLOYMENT_TARGET = 13.4;
584
564
  LD_RUNPATH_SEARCH_PATHS = (
585
565
  /usr/lib/swift,
586
566
  "$(inherited)",
@@ -592,14 +572,13 @@
592
572
  );
593
573
  MTL_ENABLE_DEBUG_INFO = YES;
594
574
  ONLY_ACTIVE_ARCH = YES;
595
- OTHER_CFLAGS = "$(inherited)";
596
575
  OTHER_CPLUSPLUSFLAGS = (
597
576
  "$(OTHER_CFLAGS)",
598
577
  "-DFOLLY_NO_CONFIG",
599
578
  "-DFOLLY_MOBILE=1",
600
579
  "-DFOLLY_USE_LIBCPP=1",
580
+ "-DFOLLY_CFG_NO_COROUTINES=1",
601
581
  );
602
- REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
603
582
  SDKROOT = iphoneos;
604
583
  };
605
584
  name = Debug;
@@ -609,7 +588,7 @@
609
588
  buildSettings = {
610
589
  ALWAYS_SEARCH_USER_PATHS = NO;
611
590
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
612
- CLANG_CXX_LANGUAGE_STANDARD = "c++17";
591
+ CLANG_CXX_LANGUAGE_STANDARD = "c++20";
613
592
  CLANG_CXX_LIBRARY = "libc++";
614
593
  CLANG_ENABLE_MODULES = YES;
615
594
  CLANG_ENABLE_OBJC_ARC = YES;
@@ -637,7 +616,7 @@
637
616
  COPY_PHASE_STRIP = YES;
638
617
  ENABLE_NS_ASSERTIONS = NO;
639
618
  ENABLE_STRICT_OBJC_MSGSEND = YES;
640
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
619
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
641
620
  GCC_C_LANGUAGE_STANDARD = gnu99;
642
621
  GCC_NO_COMMON_BLOCKS = YES;
643
622
  GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -646,7 +625,7 @@
646
625
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
647
626
  GCC_WARN_UNUSED_FUNCTION = YES;
648
627
  GCC_WARN_UNUSED_VARIABLE = YES;
649
- IPHONEOS_DEPLOYMENT_TARGET = 12.4;
628
+ IPHONEOS_DEPLOYMENT_TARGET = 13.4;
650
629
  LD_RUNPATH_SEARCH_PATHS = (
651
630
  /usr/lib/swift,
652
631
  "$(inherited)",
@@ -657,14 +636,13 @@
657
636
  "\"$(inherited)\"",
658
637
  );
659
638
  MTL_ENABLE_DEBUG_INFO = NO;
660
- OTHER_CFLAGS = "$(inherited)";
661
639
  OTHER_CPLUSPLUSFLAGS = (
662
640
  "$(OTHER_CFLAGS)",
663
641
  "-DFOLLY_NO_CONFIG",
664
642
  "-DFOLLY_MOBILE=1",
665
643
  "-DFOLLY_USE_LIBCPP=1",
644
+ "-DFOLLY_CFG_NO_COROUTINES=1",
666
645
  );
667
- REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
668
646
  SDKROOT = iphoneos;
669
647
  VALIDATE_PRODUCT = YES;
670
648
  };
@@ -1,6 +1,5 @@
1
1
  const { withNxMetro } = require('@nx/react-native');
2
2
  const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
3
- const exclusionList = require('metro-config/src/defaults/exclusionList');
4
3
 
5
4
  const defaultConfig = getDefaultConfig(__dirname);
6
5
  const { assetExts, sourceExts } = defaultConfig.resolver;
@@ -18,9 +17,6 @@ const customConfig = {
18
17
  resolver: {
19
18
  assetExts: assetExts.filter((ext) => ext !== 'svg'),
20
19
  sourceExts: [...sourceExts, 'svg'],
21
- blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
22
- // unstable_enableSymlinks: true,
23
- // unstable_enablePackageExports: true,
24
20
  },
25
21
  };
26
22
 
@@ -19,7 +19,10 @@ export const App = () => {
19
19
  return (
20
20
  <>
21
21
  <StatusBar barStyle="dark-content" />
22
- <SafeAreaView>
22
+ <SafeAreaView
23
+ style={{
24
+ flex: 1,
25
+ }}>
23
26
  <ScrollView
24
27
  ref={(ref) => {
25
28
  scrollViewRef.current = ref;
@@ -29,7 +32,7 @@ export const App = () => {
29
32
  >
30
33
  <View style={styles.section}>
31
34
  <Text style={styles.textLg}>Hello there,</Text>
32
- <Text style={[styles.textXL, styles.appTitleText]} testID="heading">
35
+ <Text style={[styles.textXL, styles.appTitleText]} testID="heading" role="heading">
33
36
  Welcome <%= displayName %> 👋
34
37
  </Text>
35
38
  </View>
@@ -0,0 +1,3 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { NormalizedSchema } from './normalize-options';
3
+ export declare function addE2e(host: Tree, options: NormalizedSchema): Promise<GeneratorCallback>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addE2e = void 0;
4
+ const add_e2e_1 = require("@nx/react/src/generators/application/lib/add-e2e");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const versions_1 = require("../../../utils/versions");
7
+ async function addE2e(host, options) {
8
+ switch (options.e2eTestRunner) {
9
+ case 'cypress':
10
+ return (0, add_e2e_1.addE2e)(host, {
11
+ ...options,
12
+ e2eTestRunner: 'cypress',
13
+ style: 'none',
14
+ styledModule: null,
15
+ hasStyles: false,
16
+ unitTestRunner: 'none',
17
+ });
18
+ case 'playwright':
19
+ return (0, add_e2e_1.addE2e)(host, {
20
+ ...options,
21
+ e2eTestRunner: 'playwright',
22
+ style: 'none',
23
+ styledModule: null,
24
+ hasStyles: false,
25
+ unitTestRunner: 'none',
26
+ });
27
+ case 'detox':
28
+ case 'detox':
29
+ const { detoxApplicationGenerator } = (0, devkit_1.ensurePackage)('@nx/detox', versions_1.nxVersion);
30
+ return detoxApplicationGenerator(host, {
31
+ ...options,
32
+ e2eName: options.e2eProjectName,
33
+ e2eDirectory: options.e2eProjectRoot,
34
+ projectNameAndRootFormat: 'as-provided',
35
+ appProject: options.projectName,
36
+ appDisplayName: options.displayName,
37
+ appName: options.name,
38
+ framework: 'react-native',
39
+ setParserOptionsProject: options.setParserOptionsProject,
40
+ skipFormat: true,
41
+ });
42
+ case 'none':
43
+ default:
44
+ return () => { };
45
+ }
46
+ }
47
+ exports.addE2e = addE2e;
@@ -23,25 +23,19 @@ function getTargets(options) {
23
23
  const architect = {};
24
24
  architect.start = {
25
25
  executor: '@nx/react-native:start',
26
- dependsOn: ['ensure-symlink', 'sync-deps', 'pod-install'],
26
+ dependsOn: [],
27
27
  options: {
28
28
  port: 8081,
29
29
  },
30
30
  };
31
- architect.serve = {
32
- executor: 'nx:run-commands',
33
- options: {
34
- command: `nx start ${options.projectName}`,
35
- },
36
- };
37
31
  architect['run-ios'] = {
38
32
  executor: '@nx/react-native:run-ios',
39
- dependsOn: ['ensure-symlink', 'sync-deps', 'pod-install'],
33
+ dependsOn: [],
40
34
  options: {},
41
35
  };
42
36
  architect['bundle-ios'] = {
43
37
  executor: '@nx/react-native:bundle',
44
- dependsOn: ['ensure-symlink'],
38
+ dependsOn: [],
45
39
  outputs: ['{options.bundleOutput}'],
46
40
  options: {
47
41
  entryFile: options.entryFile,
@@ -51,7 +45,7 @@ function getTargets(options) {
51
45
  };
52
46
  architect['run-android'] = {
53
47
  executor: '@nx/react-native:run-android',
54
- dependsOn: ['ensure-symlink', 'sync-deps'],
48
+ dependsOn: [],
55
49
  options: {},
56
50
  };
57
51
  architect['build-android'] = {
@@ -60,22 +54,28 @@ function getTargets(options) {
60
54
  `{projectRoot}/android/app/build/outputs/bundle`,
61
55
  `{projectRoot}/android/app/build/outputs/apk`,
62
56
  ],
63
- dependsOn: ['ensure-symlink', 'sync-deps'],
57
+ dependsOn: [],
64
58
  options: {},
65
59
  };
66
60
  architect['build-ios'] = {
67
61
  executor: '@nx/react-native:build-ios',
68
62
  outputs: ['{projectRoot}/ios/build/Build'],
69
- dependsOn: ['ensure-symlink', 'sync-deps', 'pod-install'],
63
+ dependsOn: [],
70
64
  options: {},
71
65
  };
72
66
  architect['pod-install'] = {
73
67
  executor: '@nx/react-native:pod-install',
68
+ dependsOn: ['sync-deps'],
69
+ outputs: ['{projectRoot}/ios/Pods', '{projectRoot}/ios/Podfile.lock'],
70
+ options: {},
71
+ };
72
+ architect.upgrade = {
73
+ executor: '@nx/react-native:upgrade',
74
74
  options: {},
75
75
  };
76
76
  architect['bundle-android'] = {
77
77
  executor: '@nx/react-native:bundle',
78
- dependsOn: ['ensure-symlink'],
78
+ dependsOn: [],
79
79
  outputs: ['{options.bundleOutput}'],
80
80
  options: {
81
81
  entryFile: options.entryFile,
@@ -87,9 +87,5 @@ function getTargets(options) {
87
87
  executor: '@nx/react-native:sync-deps',
88
88
  options: {},
89
89
  };
90
- architect['ensure-symlink'] = {
91
- executor: '@nx/react-native:ensure-symlink',
92
- options: {},
93
- };
94
90
  return architect;
95
91
  }
@@ -2,6 +2,7 @@ import { Tree } from '@nx/devkit';
2
2
  import { Schema } from '../schema';
3
3
  export interface NormalizedSchema extends Schema {
4
4
  className: string;
5
+ fileName: string;
5
6
  projectName: string;
6
7
  appProjectRoot: string;
7
8
  lowerCaseName: string;
@@ -9,5 +10,8 @@ export interface NormalizedSchema extends Schema {
9
10
  androidProjectRoot: string;
10
11
  parsedTags: string[];
11
12
  entryFile: string;
13
+ rootProject: boolean;
14
+ e2eProjectName: string;
15
+ e2eProjectRoot: string;
12
16
  }
13
17
  export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
@@ -12,19 +12,21 @@ async function normalizeOptions(host, options) {
12
12
  callingGenerator: '@nx/react-native:application',
13
13
  });
14
14
  options.projectNameAndRootFormat = projectNameAndRootFormat;
15
- const { className } = (0, devkit_1.names)(options.name);
15
+ const { className, fileName } = (0, devkit_1.names)(options.name);
16
16
  const iosProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'ios');
17
17
  const androidProjectRoot = (0, devkit_1.joinPathFragments)(appProjectRoot, 'android');
18
+ const rootProject = appProjectRoot === '.';
19
+ const e2eProjectName = rootProject ? 'e2e' : `${fileName}-e2e`;
20
+ const e2eProjectRoot = rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
18
21
  const parsedTags = options.tags
19
22
  ? options.tags.split(',').map((s) => s.trim())
20
23
  : [];
21
24
  const entryFile = options.js ? 'src/main.js' : 'src/main.tsx';
22
25
  return {
23
26
  ...options,
24
- unitTestRunner: options.unitTestRunner || 'jest',
25
- e2eTestRunner: options.e2eTestRunner || 'detox',
26
27
  name: projectNames.projectSimpleName,
27
28
  className,
29
+ fileName,
28
30
  lowerCaseName: className.toLowerCase(),
29
31
  displayName: options.displayName || className,
30
32
  projectName: appProjectName,
@@ -33,6 +35,9 @@ async function normalizeOptions(host, options) {
33
35
  androidProjectRoot,
34
36
  parsedTags,
35
37
  entryFile,
38
+ rootProject,
39
+ e2eProjectName,
40
+ e2eProjectRoot,
36
41
  };
37
42
  }
38
43
  exports.normalizeOptions = normalizeOptions;