@nx/react-native 16.6.0-beta.3 → 16.6.0-beta.5

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 (69) hide show
  1. package/.eslintrc.json +23 -0
  2. package/migrations.json +78 -0
  3. package/package.json +15 -13
  4. package/plugins/with-nx-metro.d.ts +5 -1
  5. package/plugins/with-nx-metro.js +27 -22
  6. package/src/executors/build-android/build-android.impl.js +18 -32
  7. package/src/executors/build-android/build-android.impl.ts +21 -50
  8. package/src/executors/build-android/schema.d.ts +5 -3
  9. package/src/executors/build-android/schema.json +14 -8
  10. package/src/executors/build-ios/build-ios.impl.d.ts +1 -1
  11. package/src/executors/build-ios/build-ios.impl.js +23 -42
  12. package/src/executors/build-ios/build-ios.impl.ts +26 -64
  13. package/src/executors/build-ios/schema.d.ts +3 -0
  14. package/src/executors/build-ios/schema.json +8 -6
  15. package/src/executors/bundle/bundle.impl.js +19 -17
  16. package/src/executors/bundle/bundle.impl.ts +24 -23
  17. package/src/executors/pod-install/pod-install.impl.js +1 -1
  18. package/src/executors/pod-install/pod-install.impl.ts +1 -1
  19. package/src/executors/pod-install/schema.d.ts +3 -1
  20. package/src/executors/pod-install/schema.json +11 -1
  21. package/src/executors/run-android/run-android.impl.js +47 -26
  22. package/src/executors/run-android/run-android.impl.ts +40 -45
  23. package/src/executors/run-android/schema.d.ts +2 -2
  24. package/src/executors/run-android/schema.json +9 -5
  25. package/src/executors/run-ios/run-ios.impl.js +47 -31
  26. package/src/executors/run-ios/run-ios.impl.ts +42 -56
  27. package/src/executors/run-ios/schema.d.ts +1 -1
  28. package/src/executors/run-ios/schema.json +7 -6
  29. package/src/executors/start/start.impl.d.ts +4 -2
  30. package/src/executors/start/start.impl.js +35 -24
  31. package/src/executors/start/start.impl.ts +42 -35
  32. package/src/executors/storybook/schema.d.ts +1 -1
  33. package/src/generators/application/application.js +1 -3
  34. package/src/generators/application/files/app/Gemfile.template +2 -2
  35. package/src/generators/application/files/app/android/app/build.gradle.template +2 -49
  36. package/src/generators/application/files/app/android/app/src/main/java/com/__lowerCaseName__/MainActivity.java.template +1 -4
  37. package/src/generators/application/files/app/android/app/src/main/res/drawable/rn_edit_text_material.xml +1 -1
  38. package/src/generators/application/files/app/android/build.gradle.template +1 -1
  39. package/src/generators/application/files/app/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  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 +1 -1
  42. package/src/generators/application/files/app/android/gradlew.bat +9 -6
  43. package/src/generators/application/files/app/android/gradlew.template +14 -4
  44. package/src/generators/application/files/app/android/settings.gradle.template +1 -2
  45. package/src/generators/application/files/app/ios/Podfile.template +8 -6
  46. package/src/generators/application/files/app/ios/__className__/AppDelegate.mm.template +0 -10
  47. package/src/generators/application/files/app/ios/__className__.xcodeproj/project.pbxproj.template +6 -2
  48. package/src/generators/application/files/app/metro.config.js.template +32 -35
  49. package/src/generators/application/files/app/package.json.template +1 -0
  50. package/src/generators/application/files/app/src/app/App.tsx.template +1 -1
  51. package/src/generators/application/files/app/tsconfig.app.json.template +1 -0
  52. package/src/generators/application/files/app/tsconfig.json.template +1 -7
  53. package/src/generators/application/lib/add-project.js +7 -0
  54. package/src/generators/init/init.js +1 -2
  55. package/src/generators/library/library.js +5 -1
  56. package/src/migrations/update-16-6-0/add-depends-on.d.ts +6 -0
  57. package/src/migrations/update-16-6-0/add-depends-on.js +43 -0
  58. package/src/migrations/update-16-6-0/update-metro-config.d.ts +6 -0
  59. package/src/migrations/update-16-6-0/update-metro-config.js +71 -0
  60. package/src/utils/get-cli-options.js +4 -1
  61. package/src/utils/pod-install-task.d.ts +10 -2
  62. package/src/utils/pod-install-task.js +12 -4
  63. package/src/utils/versions.d.ts +10 -9
  64. package/src/utils/versions.js +11 -10
  65. package/src/generators/application/files/app/.ruby-version +0 -1
  66. /package/src/generators/library/files/lib/{package.json__tmpl__ → package.json.template} +0 -0
  67. /package/src/generators/library/files/lib/src/{index.ts__tmpl__ → index.ts.template} +0 -0
  68. /package/src/generators/library/files/lib/{tsconfig.json__tmpl__ → tsconfig.json.template} +0 -0
  69. /package/src/generators/library/files/lib/{tsconfig.lib.json__tmpl__ → tsconfig.lib.json.template} +0 -0
@@ -1,8 +1,6 @@
1
1
  apply plugin: "com.android.application"
2
2
  apply plugin: "com.facebook.react"
3
3
 
4
- import com.android.build.OutputFile
5
-
6
4
  /**
7
5
  * This is the configuration block to customize your React Native Android app.
8
6
  * By default you don't need to apply any configuration, just uncomment the lines you need.
@@ -13,8 +11,8 @@ react {
13
11
  // root = file("../")
14
12
  // The folder where the react-native NPM package is. Default is ../node_modules/react-native
15
13
  // reactNativeDir = file("../node_modules/react-native")
16
- // The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
17
- // codegenDir = file("../node_modules/react-native-codegen")
14
+ // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
15
+ // codegenDir = file("../node_modules/@react-native/codegen")
18
16
  // The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
19
17
  // cliFile = file("../node_modules/react-native/cli.js")
20
18
 
@@ -53,14 +51,6 @@ react {
53
51
  entryFile = file("../../<%= entryFile %>")
54
52
  }
55
53
 
56
- /**
57
- * Set this to true to create four separate APKs instead of one,
58
- * one for each native architecture. This is useful if you don't
59
- * use App Bundles (https://developer.android.com/guide/app-bundle/)
60
- * and want to have separate APKs to upload to the Play Store.
61
- */
62
- def enableSeparateBuildPerCPUArchitecture = false
63
-
64
54
  /**
65
55
  * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
66
56
  */
@@ -79,16 +69,6 @@ def enableProguardInReleaseBuilds = false
79
69
  */
80
70
  def jscFlavor = 'org.webkit:android-jsc:+'
81
71
 
82
- /**
83
- * Private function to get the list of Native Architectures you want to build.
84
- * This reads the value from reactNativeArchitectures in your gradle.properties
85
- * file and works together with the --active-arch-only flag of react-native run-android.
86
- */
87
- def reactNativeArchitectures() {
88
- def value = project.getProperties().get("reactNativeArchitectures")
89
- return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
90
- }
91
-
92
72
  android {
93
73
  ndkVersion rootProject.ext.ndkVersion
94
74
 
@@ -106,15 +86,6 @@ android {
106
86
  testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
107
87
  <% } %>
108
88
  }
109
-
110
- splits {
111
- abi {
112
- reset()
113
- enable enableSeparateBuildPerCPUArchitecture
114
- universalApk false // If true, also generate a universal APK
115
- include (*reactNativeArchitectures())
116
- }
117
- }
118
89
  signingConfigs {
119
90
  debug {
120
91
  storeFile file('debug.keystore')
@@ -138,22 +109,6 @@ android {
138
109
  <% } %>
139
110
  }
140
111
  }
141
-
142
- // applicationVariants are e.g. debug, release
143
- applicationVariants.all { variant ->
144
- variant.outputs.each { output ->
145
- // For each separate APK per architecture, set a unique version code as described here:
146
- // https://developer.android.com/studio/build/configure-apk-splits.html
147
- // Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
148
- def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
149
- def abi = output.getFilter(OutputFile.ABI)
150
- if (abi != null) { // null for the universal-debug, universal-release variants
151
- output.versionCodeOverride =
152
- defaultConfig.versionCode * 1000 + versionCodes.get(abi)
153
- }
154
-
155
- }
156
- }
157
112
  }
158
113
 
159
114
  dependencies {
@@ -164,8 +119,6 @@ dependencies {
164
119
  // The version of react-native is set by the React Native Gradle Plugin
165
120
  implementation("com.facebook.react:react-android")
166
121
 
167
- implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")
168
-
169
122
  debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
170
123
  debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
171
124
  exclude group:'com.squareup.okhttp3', module:'okhttp'
@@ -27,9 +27,6 @@ public class MainActivity extends ReactActivity {
27
27
  this,
28
28
  getMainComponentName(),
29
29
  // If you opted-in for the New Architecture, we enable the Fabric Renderer.
30
- DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
31
- // If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
32
- DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
33
- );
30
+ DefaultNewArchitectureEntryPoint.getFabricEnabled());
34
31
  }
35
32
  }
@@ -20,7 +20,7 @@
20
20
  android:insetBottom="@dimen/abc_edit_text_inset_bottom_material">
21
21
 
22
22
  <selector>
23
- <!--
23
+ <!--
24
24
  This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
25
25
  The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
26
26
  NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
@@ -16,7 +16,7 @@ buildscript {
16
16
  mavenCentral()
17
17
  }
18
18
  dependencies {
19
- classpath("com.android.tools.build:gradle:7.3.1")
19
+ classpath("com.android.tools.build:gradle")
20
20
  classpath("com.facebook.react:react-native-gradle-plugin")
21
21
  classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
22
22
  }
@@ -1,5 +1,6 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4
+ networkTimeout=10000
4
5
  zipStoreBase=GRADLE_USER_HOME
5
6
  zipStorePath=wrapper/dists
@@ -25,7 +25,7 @@ android.useAndroidX=true
25
25
  android.enableJetifier=true
26
26
 
27
27
  # Version of flipper SDK to use with React Native
28
- FLIPPER_VERSION=0.125.0
28
+ FLIPPER_VERSION=0.182.0
29
29
 
30
30
  # Use this property to specify which architecture you want to build.
31
31
  # You can also override it from the CLI using
@@ -14,7 +14,7 @@
14
14
  @rem limitations under the License.
15
15
  @rem
16
16
 
17
- @if "%DEBUG%" == "" @echo off
17
+ @if "%DEBUG%"=="" @echo off
18
18
  @rem ##########################################################################
19
19
  @rem
20
20
  @rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
25
25
  if "%OS%"=="Windows_NT" setlocal
26
26
 
27
27
  set DIRNAME=%~dp0
28
- if "%DIRNAME%" == "" set DIRNAME=.
28
+ if "%DIRNAME%"=="" set DIRNAME=.
29
+ @rem This is normally unused
29
30
  set APP_BASE_NAME=%~n0
30
31
  set APP_HOME=%DIRNAME%
31
32
 
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
40
41
 
41
42
  set JAVA_EXE=java.exe
42
43
  %JAVA_EXE% -version >NUL 2>&1
43
- if "%ERRORLEVEL%" == "0" goto execute
44
+ if %ERRORLEVEL% equ 0 goto execute
44
45
 
45
46
  echo.
46
47
  echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
75
76
 
76
77
  :end
77
78
  @rem End local scope for the variables with windows NT shell
78
- if "%ERRORLEVEL%"=="0" goto mainEnd
79
+ if %ERRORLEVEL% equ 0 goto mainEnd
79
80
 
80
81
  :fail
81
82
  rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
83
  rem the _cmd.exe /c_ return code!
83
- if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
- exit /b 1
84
+ set EXIT_CODE=%ERRORLEVEL%
85
+ if %EXIT_CODE% equ 0 set EXIT_CODE=1
86
+ if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87
+ exit /b %EXIT_CODE%
85
88
 
86
89
  :mainEnd
87
90
  if "%OS%"=="Windows_NT" endlocal
@@ -55,7 +55,7 @@
55
55
  # Darwin, MinGW, and NonStop.
56
56
  #
57
57
  # (3) This script is generated from the Groovy template
58
- # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58
+ # https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
59
59
  # within the Gradle project.
60
60
  #
61
61
  # You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
80
80
  esac
81
81
  done
82
82
 
83
- APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84
-
85
- APP_NAME="Gradle"
83
+ # This is normally unused
84
+ # shellcheck disable=SC2034
86
85
  APP_BASE_NAME=${0##*/}
86
+ APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
87
87
 
88
88
  # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
89
89
  DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143
143
  if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144
144
  case $MAX_FD in #(
145
145
  max*)
146
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147
+ # shellcheck disable=SC3045
146
148
  MAX_FD=$( ulimit -H -n ) ||
147
149
  warn "Could not query maximum file descriptor limit"
148
150
  esac
149
151
  case $MAX_FD in #(
150
152
  '' | soft) :;; #(
151
153
  *)
154
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155
+ # shellcheck disable=SC3045
152
156
  ulimit -n "$MAX_FD" ||
153
157
  warn "Could not set maximum file descriptor limit to $MAX_FD"
154
158
  esac
@@ -205,6 +209,12 @@ set -- \
205
209
  org.gradle.wrapper.GradleWrapperMain \
206
210
  "$@"
207
211
 
212
+ # Stop when "xargs" is not available.
213
+ if ! command -v xargs >/dev/null 2>&1
214
+ then
215
+ die "xargs is not available"
216
+ fi
217
+
208
218
  # Use "xargs" to parse quoted args.
209
219
  #
210
220
  # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
@@ -1,5 +1,4 @@
1
1
  rootProject.name = '<%= className %>'
2
-
3
2
  apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
4
3
  include ':app'
5
- includeBuild('../node_modules/react-native-gradle-plugin')
4
+ includeBuild('../node_modules/@react-native/gradle-plugin')
@@ -1,5 +1,9 @@
1
- require_relative '<%= offsetFromRoot %>../node_modules/react-native/scripts/react_native_pods'
2
- require_relative '<%= offsetFromRoot %>../node_modules/@react-native-community/cli-platform-ios/native_modules'
1
+ # Resolve react_native_pods.rb with node to allow for hoisting
2
+ require Pod::Executable.execute_command('node', ['-p',
3
+ 'require.resolve(
4
+ "react-native/scripts/react_native_pods.rb",
5
+ {paths: [process.argv[1]]},
6
+ )', __dir__]).strip
3
7
 
4
8
  platform :ios, min_ios_version_supported
5
9
  prepare_react_native_project!
@@ -30,8 +34,6 @@ target '<%= className %>' do
30
34
  use_react_native!(
31
35
  :path => config[:reactNativePath],
32
36
  # Hermes is now enabled by default. Disable by setting this flag to false.
33
- # Upcoming versions of React Native may rely on get_default_flags(), but
34
- # we make it explicit here to aid in the React Native upgrade process.
35
37
  :hermes_enabled => flags[:hermes_enabled],
36
38
  :fabric_enabled => flags[:fabric_enabled],
37
39
  # Enables Flipper.
@@ -49,10 +51,10 @@ target '<%= className %>' do
49
51
  end
50
52
 
51
53
  post_install do |installer|
54
+ # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
52
55
  react_native_post_install(
53
56
  installer,
54
- # Set `mac_catalyst_enabled` to `true` in order to apply patches
55
- # necessary for Mac Catalyst builds
57
+ config[:reactNativePath],
56
58
  :mac_catalyst_enabled => false
57
59
  )
58
60
  __apply_Xcode_12_5_M1_post_install_workaround(installer)
@@ -23,14 +23,4 @@
23
23
  #endif
24
24
  }
25
25
 
26
- /// This method controls whether the `concurrentRoot`feature of React18 is turned on or off.
27
- ///
28
- /// @see: https://reactjs.org/blog/2022/03/29/react-v18.html
29
- /// @note: This requires to be rendering on Fabric (i.e. on the New Architecture).
30
- /// @return: `true` if the `concurrentRoot` feature is enabled. Otherwise, it returns `false`.
31
- - (BOOL)concurrentRootEnabled
32
- {
33
- return true;
34
- }
35
-
36
26
  @end
@@ -564,7 +564,7 @@
564
564
  COPY_PHASE_STRIP = NO;
565
565
  ENABLE_STRICT_OBJC_MSGSEND = YES;
566
566
  ENABLE_TESTABILITY = YES;
567
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
567
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
568
568
  GCC_C_LANGUAGE_STANDARD = gnu99;
569
569
  GCC_DYNAMIC_NO_PIC = NO;
570
570
  GCC_NO_COMMON_BLOCKS = YES;
@@ -592,12 +592,14 @@
592
592
  );
593
593
  MTL_ENABLE_DEBUG_INFO = YES;
594
594
  ONLY_ACTIVE_ARCH = YES;
595
+ OTHER_CFLAGS = "$(inherited)";
595
596
  OTHER_CPLUSPLUSFLAGS = (
596
597
  "$(OTHER_CFLAGS)",
597
598
  "-DFOLLY_NO_CONFIG",
598
599
  "-DFOLLY_MOBILE=1",
599
600
  "-DFOLLY_USE_LIBCPP=1",
600
601
  );
602
+ REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
601
603
  SDKROOT = iphoneos;
602
604
  };
603
605
  name = Debug;
@@ -635,7 +637,7 @@
635
637
  COPY_PHASE_STRIP = YES;
636
638
  ENABLE_NS_ASSERTIONS = NO;
637
639
  ENABLE_STRICT_OBJC_MSGSEND = YES;
638
- "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
640
+ "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = i386;
639
641
  GCC_C_LANGUAGE_STANDARD = gnu99;
640
642
  GCC_NO_COMMON_BLOCKS = YES;
641
643
  GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -655,12 +657,14 @@
655
657
  "\"$(inherited)\"",
656
658
  );
657
659
  MTL_ENABLE_DEBUG_INFO = NO;
660
+ OTHER_CFLAGS = "$(inherited)";
658
661
  OTHER_CPLUSPLUSFLAGS = (
659
662
  "$(OTHER_CFLAGS)",
660
663
  "-DFOLLY_NO_CONFIG",
661
664
  "-DFOLLY_MOBILE=1",
662
665
  "-DFOLLY_USE_LIBCPP=1",
663
666
  );
667
+ REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
664
668
  SDKROOT = iphoneos;
665
669
  VALIDATE_PRODUCT = YES;
666
670
  };
@@ -1,38 +1,35 @@
1
1
  const { withNxMetro } = require('@nx/react-native');
2
- const { getDefaultConfig } = require('metro-config');
2
+ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
3
3
  const exclusionList = require('metro-config/src/defaults/exclusionList');
4
4
 
5
- module.exports = (async () => {
6
- const {
7
- resolver: { sourceExts, assetExts },
8
- } = await getDefaultConfig();
9
- return withNxMetro(
10
- {
11
- transformer: {
12
- getTransformOptions: async () => ({
13
- transform: {
14
- experimentalImportSupport: false,
15
- inlineRequires: true,
16
- },
17
- }),
18
- babelTransformerPath: require.resolve('react-native-svg-transformer'),
19
- },
20
- resolver: {
21
- assetExts: assetExts.filter((ext) => ext !== 'svg'),
22
- sourceExts: [...sourceExts, 'svg'],
23
- blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
24
- },
25
- },
26
- {
27
- // Change this to true to see debugging info.
28
- // Useful if you have issues resolving modules
29
- debug: false,
30
- // all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
31
- extensions: [],
32
- // the project root to start the metro server
33
- projectRoot: __dirname,
34
- // Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
35
- watchFolders: []
36
- }
37
- );
38
- })();
5
+ const defaultConfig = getDefaultConfig(__dirname);
6
+ const { assetExts, sourceExts } = defaultConfig.resolver;
7
+
8
+ /**
9
+ * Metro configuration
10
+ * https://facebook.github.io/metro/docs/configuration
11
+ *
12
+ * @type {import('metro-config').MetroConfig}
13
+ */
14
+ const customConfig = {
15
+ transformer: {
16
+ babelTransformerPath: require.resolve('react-native-svg-transformer'),
17
+ },
18
+ resolver: {
19
+ assetExts: assetExts.filter((ext) => ext !== 'svg'),
20
+ sourceExts: [...sourceExts, 'svg'],
21
+ blockList: exclusionList([/^(?!.*node_modules).*\/dist\/.*/]),
22
+ unstable_enableSymlinks: true,
23
+ unstable_enablePackageExports: true,
24
+ },
25
+ };
26
+
27
+ module.exports = withNxMetro(mergeConfig(defaultConfig, customConfig), {
28
+ // Change this to true to see debugging info.
29
+ // Useful if you have issues resolving modules
30
+ debug: false,
31
+ // all the file extensions used for imports other than 'ts', 'tsx', 'js', 'jsx', 'json'
32
+ extensions: [],
33
+ // Specify folders to watch, in addition to Nx defaults (workspace libraries and node_modules)
34
+ watchFolders: [],
35
+ });
@@ -3,6 +3,7 @@
3
3
  "version": "0.0.1",
4
4
  "private": true,
5
5
  "dependencies": {
6
+ "@react-native/metro-config": "*",
6
7
  "@testing-library/jest-native": "*",
7
8
  "@testing-library/react-native": "*",
8
9
  "react": "*",
@@ -356,7 +356,7 @@ export const App = () => {
356
356
  <View style={[styles.listItem, styles.marginBottomMd]}>
357
357
  <Svg width={48} height={48} viewBox="0 0 120 120" stroke="currentColor" fill="transparent">
358
358
  <Path strokeWidth="2" d="M23 3.75V6.5c-3.036 0-5.5 2.464-5.5 5.5s-2.464 5.5-5.5 5.5-5.5 2.464-5.5 5.5H3.75C2.232 23 1 21.768 1 20.25V3.75C1 2.232 2.232 1 3.75 1h16.5C21.768 1 23 2.232 23 3.75Z" />
359
- <Path strokewidth="2" d="M23 6v14.1667C23 21.7307 21.7307 23 20.1667 23H6c0-3.128 2.53867-5.6667 5.6667-5.6667 3.128 0 5.6666-2.5386 5.6666-5.6666C17.3333 8.53867 19.872 6 23 6Z" />
359
+ <Path strokeWidth="2" d="M23 6v14.1667C23 21.7307 21.7307 23 20.1667 23H6c0-3.128 2.53867-5.6667 5.6667-5.6667 3.128 0 5.6666-2.5386 5.6666-5.6666C17.3333 8.53867 19.872 6 23 6Z" />
360
360
  </Svg>
361
361
  <View style={styles.listItemTextContainer}>
362
362
  <Text
@@ -4,6 +4,7 @@
4
4
  "outDir": "<%= offsetFromRoot %>dist/out-tsc",
5
5
  "types": ["node"]
6
6
  },
7
+ "files": ["<%= offsetFromRoot %>node_modules/@nx/react-native/typings/svg.d.ts"],
7
8
  "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.spec.tsx", "test-setup.ts"],
8
9
  "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"]
9
10
  }
@@ -7,19 +7,13 @@
7
7
  "moduleResolution": "node",
8
8
  "skipLibCheck": true,
9
9
  "resolveJsonModule": true,
10
- "composite": true,
11
10
  "declaration": true
12
11
  },
13
- "files": [
14
- "../../node_modules/@nx/react-native/typings/svg.d.ts"
15
- ],
12
+ "files": [],
16
13
  "include": [],
17
14
  "references": [
18
15
  {
19
16
  "path": "./tsconfig.app.json"
20
17
  }
21
- ],
22
- "exclude": [
23
- "node_modules"
24
18
  ]
25
19
  }
@@ -17,6 +17,7 @@ function getTargets(options) {
17
17
  const architect = {};
18
18
  architect.start = {
19
19
  executor: '@nx/react-native:start',
20
+ dependsOn: ['ensure-symlink', 'sync-deps', 'pod-install'],
20
21
  options: {
21
22
  port: 8081,
22
23
  },
@@ -29,10 +30,12 @@ function getTargets(options) {
29
30
  };
30
31
  architect['run-ios'] = {
31
32
  executor: '@nx/react-native:run-ios',
33
+ dependsOn: ['ensure-symlink', 'sync-deps', 'pod-install'],
32
34
  options: {},
33
35
  };
34
36
  architect['bundle-ios'] = {
35
37
  executor: '@nx/react-native:bundle',
38
+ dependsOn: ['ensure-symlink'],
36
39
  outputs: ['{options.bundleOutput}'],
37
40
  options: {
38
41
  entryFile: options.entryFile,
@@ -42,6 +45,7 @@ function getTargets(options) {
42
45
  };
43
46
  architect['run-android'] = {
44
47
  executor: '@nx/react-native:run-android',
48
+ dependsOn: ['ensure-symlink', 'sync-deps'],
45
49
  options: {},
46
50
  };
47
51
  architect['build-android'] = {
@@ -50,11 +54,13 @@ function getTargets(options) {
50
54
  `{projectRoot}/android/app/build/outputs/bundle`,
51
55
  `{projectRoot}/android/app/build/outputs/apk`,
52
56
  ],
57
+ dependsOn: ['ensure-symlink', 'sync-deps'],
53
58
  options: {},
54
59
  };
55
60
  architect['build-ios'] = {
56
61
  executor: '@nx/react-native:build-ios',
57
62
  outputs: ['{projectRoot}/ios/build/Build'],
63
+ dependsOn: ['ensure-symlink', 'sync-deps', 'pod-install'],
58
64
  options: {},
59
65
  };
60
66
  architect['pod-install'] = {
@@ -63,6 +69,7 @@ function getTargets(options) {
63
69
  };
64
70
  architect['bundle-android'] = {
65
71
  executor: '@nx/react-native:bundle',
72
+ dependsOn: ['ensure-symlink'],
66
73
  outputs: ['{options.bundleOutput}'],
67
74
  options: {
68
75
  entryFile: options.entryFile,
@@ -40,9 +40,8 @@ function updateDependencies(host) {
40
40
  react: versions_2.reactVersion,
41
41
  'react-dom': versions_2.reactDomVersion,
42
42
  'react-native': versions_2.reactNativeVersion,
43
- }, Object.assign({ '@nx/react-native': versions_2.nxVersion, '@types/node': versions_2.typesNodeVersion, '@types/react': versions_2.typesReactVersion, '@types/react-native': versions_2.typesReactNativeVersion, '@react-native-community/cli': versions_2.reactNativeCommunityCli, '@react-native-community/cli-platform-android': versions_2.reactNativeCommunityCliAndroid, '@react-native-community/cli-platform-ios': versions_2.reactNativeCommunityCliIos, '@testing-library/react-native': versions_2.testingLibraryReactNativeVersion, '@testing-library/jest-native': versions_2.testingLibraryJestNativeVersion, 'jest-react-native': versions_2.jestReactNativeVersion, metro: versions_2.metroVersion, 'metro-resolver': versions_2.metroVersion, 'metro-babel-register': versions_2.metroVersion, 'metro-react-native-babel-preset': versions_2.metroVersion, 'metro-react-native-babel-transformer': versions_2.metroVersion, 'react-test-renderer': versions_2.reactTestRendererVersion, 'react-native-svg-transformer': versions_2.reactNativeSvgTransformerVersion, 'react-native-svg': versions_2.reactNativeSvgVersion, '@babel/preset-react': versions_1.babelPresetReactVersion }, (isPnpm
43
+ }, Object.assign({ '@nx/react-native': versions_2.nxVersion, '@types/node': versions_2.typesNodeVersion, '@types/react': versions_2.typesReactVersion, '@types/react-native': versions_2.typesReactNativeVersion, '@react-native/metro-config': versions_2.reactNativeMetroConfigVersion, '@react-native-community/cli': versions_2.reactNativeCommunityCli, '@react-native-community/cli-platform-android': versions_2.reactNativeCommunityCliAndroid, '@react-native-community/cli-platform-ios': versions_2.reactNativeCommunityCliIos, '@testing-library/react-native': versions_2.testingLibraryReactNativeVersion, '@testing-library/jest-native': versions_2.testingLibraryJestNativeVersion, 'jest-react-native': versions_2.jestReactNativeVersion, metro: versions_2.metroVersion, 'metro-config': versions_2.metroVersion, 'metro-resolver': versions_2.metroVersion, 'metro-babel-register': versions_2.metroVersion, 'metro-react-native-babel-preset': versions_2.metroVersion, 'metro-react-native-babel-transformer': versions_2.metroVersion, 'react-test-renderer': versions_2.reactTestRendererVersion, 'react-native-svg-transformer': versions_2.reactNativeSvgTransformerVersion, 'react-native-svg': versions_2.reactNativeSvgVersion, '@babel/preset-react': versions_1.babelPresetReactVersion }, (isPnpm
44
44
  ? {
45
- 'metro-config': versions_2.metroVersion,
46
45
  '@babel/runtime': versions_2.babelRuntimeVersion, // @babel/runtime is used by react-native-svg
47
46
  }
48
47
  : {})));
@@ -97,7 +97,7 @@ function updateTsConfig(tree, options) {
97
97
  });
98
98
  }
99
99
  function createFiles(host, options) {
100
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot) }));
100
+ (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, './files/lib'), options.projectRoot, Object.assign(Object.assign(Object.assign({}, options), (0, devkit_1.names)(options.name)), { offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot) }));
101
101
  if (!options.publishable && !options.buildable) {
102
102
  host.delete(`${options.projectRoot}/package.json`);
103
103
  }
@@ -109,6 +109,10 @@ function createFiles(host, options) {
109
109
  function updateLibPackageNpmScope(host, options) {
110
110
  return (0, devkit_1.updateJson)(host, `${options.projectRoot}/package.json`, (json) => {
111
111
  json.name = options.importPath;
112
+ json.peerDependencies = {
113
+ react: versions_1.reactVersion,
114
+ 'react-native': versions_1.reactNativeVersion,
115
+ };
112
116
  return json;
113
117
  });
114
118
  }
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * This migration adds dependsOn to project.json.
4
+ *
5
+ */
6
+ export default function update(tree: Tree): Promise<void>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ /**
6
+ * This migration adds dependsOn to project.json.
7
+ *
8
+ */
9
+ function update(tree) {
10
+ var _a, _b;
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ const projects = (0, devkit_1.getProjects)(tree);
13
+ for (const [name, config] of projects.entries()) {
14
+ if (((_b = (_a = config.targets) === null || _a === void 0 ? void 0 : _a['start']) === null || _b === void 0 ? void 0 : _b.executor) === '@nx/react-native:start') {
15
+ config.targets['start'].dependsOn = [
16
+ 'ensure-symlink',
17
+ 'sync-deps',
18
+ 'pod-install',
19
+ ];
20
+ config.targets['run-ios'].dependsOn = [
21
+ 'ensure-symlink',
22
+ 'sync-deps',
23
+ 'pod-install',
24
+ ];
25
+ config.targets['bundle-ios'].dependsOn = ['ensure-symlink'];
26
+ config.targets['run-android'].dependsOn = ['ensure-symlink', 'sync-deps'];
27
+ config.targets['build-android'].dependsOn = [
28
+ 'ensure-symlink',
29
+ 'sync-deps',
30
+ ];
31
+ config.targets['build-ios'].dependsOn = [
32
+ 'ensure-symlink',
33
+ 'sync-deps',
34
+ 'pod-install',
35
+ ];
36
+ config.targets['pod-install'].dependsOn = ['ensure-symlink', 'sync-deps'];
37
+ config.targets['bundle-android'].dependsOn = ['ensure-symlink'];
38
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
39
+ }
40
+ }
41
+ });
42
+ }
43
+ exports.default = update;
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nx/devkit';
2
+ /**
3
+ * This migration updates metro.config.js to export config as a default.
4
+ *
5
+ */
6
+ export default function update(tree: Tree): Promise<void>;