Skip to content

Commit

Permalink
chore: enable pnpm mode
Browse files Browse the repository at this point in the history
  • Loading branch information
tido64 committed Nov 9, 2023
1 parent 9ce04ee commit 3ae84da
Show file tree
Hide file tree
Showing 13 changed files with 350 additions and 198 deletions.
2 changes: 2 additions & 0 deletions .changeset/funny-ducks-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
25 changes: 25 additions & 0 deletions .yarn/patches/react-native-macos-npm-0.72.0-a4a20def58.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/scripts/cocoapods/codegen.rb b/scripts/cocoapods/codegen.rb
index 56d120fcceda051e8bdda6f0af63dcf2dd16d4a6..8be6c547581b44733d7771394622cdf7f35dcdd2 100644
--- a/scripts/cocoapods/codegen.rb
+++ b/scripts/cocoapods/codegen.rb
@@ -11,14 +11,18 @@
# - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes.
# @throws an error if it could not find the codegen folder.
def build_codegen!(react_native_path, relative_installation_root, dir_manager: Dir)
- codegen_repo_path = "#{relative_installation_root}/#{react_native_path}/../react-native-codegen";
- codegen_npm_path = "#{relative_installation_root}/#{react_native_path}/../@react-native/codegen";
+ react_native_relpath = "#{relative_installation_root}/#{react_native_path}"
+ codegen_repo_path = "#{react_native_relpath}/../react-native-codegen";
+ codegen_npm_path = "#{react_native_relpath}/../@react-native/codegen";
+ codegen_pnpm_path = "#{react_native_relpath}/node_modules/@react-native/codegen";
codegen_cli_path = ""

if dir_manager.exist?(codegen_repo_path)
codegen_cli_path = codegen_repo_path
elsif dir_manager.exist?(codegen_npm_path)
codegen_cli_path = codegen_npm_path
+ elsif dir_manager.exist?(codegen_pnpm_path)
+ codegen_cli_path = codegen_pnpm_path
else
raise "[codegen] Could not find react-native-codegen."
end
25 changes: 25 additions & 0 deletions .yarn/patches/react-native-npm-0.72.4-31c59a957a.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/scripts/cocoapods/codegen.rb b/scripts/cocoapods/codegen.rb
index 56d120fcceda051e8bdda6f0af63dcf2dd16d4a6..8be6c547581b44733d7771394622cdf7f35dcdd2 100644
--- a/scripts/cocoapods/codegen.rb
+++ b/scripts/cocoapods/codegen.rb
@@ -11,14 +11,18 @@
# - dir_manager: a class that implements the `Dir` interface. Defaults to `Dir`, the Dependency can be injected for testing purposes.
# @throws an error if it could not find the codegen folder.
def build_codegen!(react_native_path, relative_installation_root, dir_manager: Dir)
- codegen_repo_path = "#{relative_installation_root}/#{react_native_path}/../react-native-codegen";
- codegen_npm_path = "#{relative_installation_root}/#{react_native_path}/../@react-native/codegen";
+ react_native_relpath = "#{relative_installation_root}/#{react_native_path}"
+ codegen_repo_path = "#{react_native_relpath}/../react-native-codegen";
+ codegen_npm_path = "#{react_native_relpath}/../@react-native/codegen";
+ codegen_pnpm_path = "#{react_native_relpath}/node_modules/@react-native/codegen";
codegen_cli_path = ""

if dir_manager.exist?(codegen_repo_path)
codegen_cli_path = codegen_repo_path
elsif dir_manager.exist?(codegen_npm_path)
codegen_cli_path = codegen_npm_path
+ elsif dir_manager.exist?(codegen_pnpm_path)
+ codegen_cli_path = codegen_pnpm_path
else
raise "[codegen] Could not find react-native-codegen."
end
5 changes: 4 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ logFilters:
level: discard
- code: YN0013 # X can't be found in the cache and will be fetched from the remote registry
level: discard
nodeLinker: node-modules
nodeLinker: pnpm
npmRegistryServer: "https://registry.npmjs.org"
packageExtensions:
"@fluentui/utilities@*":
Expand All @@ -17,6 +17,9 @@ packageExtensions:
"@microsoft/[email protected]":
peerDependencies:
eslint: ">=5.16.0"
"@react-native-community/cli-debugger-ui@*":
dependencies:
"@babel/runtime": "^7.20.0"
babel-plugin-transform-flow-enums@*:
peerDependencies:
"@babel/core": ^7.20.0
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
"nx/glob": "^7.1.4",
"nx/minimatch": "^3.0.5",
"nx/semver": "^7.3.5",
"react-native-windows/metro-source-map": "^0.76.8"
"react-native-macos@^0.72.0": "patch:react-native-macos@npm%3A0.72.0#./.yarn/patches/react-native-macos-npm-0.72.0-a4a20def58.patch",
"react-native-windows/metro-source-map": "^0.76.8",
"react-native@^0.72.0": "patch:react-native@npm%3A0.72.4#./.yarn/patches/react-native-npm-0.72.4-31c59a957a.patch"
},
"workspaces": {
"packages": [
Expand Down
4 changes: 2 additions & 2 deletions packages/test-app/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
def androidTestAppDir = "../../../node_modules/react-native-test-app/android"
def androidTestAppDir = "../node_modules/react-native-test-app/android"
apply(from: "${androidTestAppDir}/dependencies.gradle")

repositories {
Expand All @@ -18,7 +18,7 @@ allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("${rootDir}/../../../node_modules/react-native/android")
url("${rootDir}/../node_modules/react-native/android")
}
mavenCentral()
google()
Expand Down
2 changes: 1 addition & 1 deletion packages/test-app/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ pluginManagement {

rootProject.name = "example"

apply(from: "../../../node_modules/react-native-test-app/test-app.gradle")
apply(from: "../node_modules/react-native-test-app/test-app.gradle")
applyTestAppSettings(settings)
2 changes: 1 addition & 1 deletion packages/test-app/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
platform :ios, '14.0'

require_relative '../../../node_modules/react-native-test-app/test_app'
require_relative '../node_modules/react-native-test-app/test_app'

workspace 'SampleCrossApp.xcworkspace'

Expand Down
Loading

0 comments on commit 3ae84da

Please sign in to comment.