Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move to monorepo with bun #4255

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

KrzysztofMoch
Copy link
Member

Summary

I have replaced yarn with bun as it is much faster.
Also changed our repo structure to mono repo so we have now:
-> docs
-> examples
| -> bare
| -> expo
-> packages
| -> react-native-video (library code)
| -> react-native-video-plugin-sample

Motivation

Speed up "node_modules" installation and allow for installing react-native-video as dependency in examples with simplify configuration.

Changes

  • Expo example now does not have included android & ios folder - they should be created each time via prebuild
  • replaced yarn with bun

Test plan

  • CI should work

@KrzysztofMoch
Copy link
Member Author

@freeboub this PR will create conflicts in all PRs, so I would like to merge as many PRs as possible before this one

@KrzysztofMoch
Copy link
Member Author

Also builds are faster by 1.5 minute and node_modules for all projects are installing in ~8 sec

@freeboub
Copy link
Collaborator

finally a clean repo 🙏 Thank you !

@freeboub
Copy link
Collaborator

freeboub commented Nov 5, 2024

@KrzysztofMoch I would be happy if this PR is merged soon!
I don't want to start any dev or fixes to avoid conflict :)
Thank you

@KrzysztofMoch
Copy link
Member Author

@freeboub I fine to merge it - other PRs will need to rebase but I guess this is probably inevitable

@freeboub
Copy link
Collaborator

freeboub commented Nov 9, 2024

@KrzysztofMoch I am not able to build samples with this PR ...

on bare sample:
olivier@OrdinateOlivier bare % bun run android
$ react-native run-android
(node:17082) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
info Installing the app...

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor

FAILURE: Build failed with an exception.

  • Where:
    Script '/Users/olivier/openSource/react-native-video/examples/bare/node_modules/react-native-test-app/android/config-plugins.gradle' line: 17

  • What went wrong:
    A problem occurred evaluating script.

Failed to apply config plugins:
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^

SyntaxError: Unexpected token 'typeof'
at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:310:18)
at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)
at Module._compile (node:internal/modules/cjs/loader:1503:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
at Module.load (node:internal/modules/cjs/loader:1317:32)
at Module._load (node:internal/modules/cjs/loader:1127:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Module.require (node:internal/modules/cjs/loader:1339:12) {
name: 'PluginError',
isPluginError: true,
code: 'INVALID_PLUGIN_IMPORT',
cause: undefined
}

Node.js v22.9.0

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org.

BUILD FAILED in 466ms
error Failed to install the app. Command failed with exit code 1: ./gradlew app:installDebug -PreactNativeDevServerPort=8081 FAILURE: Build failed with an exception. * Where:
Script '/Users/olivier/openSource/react-native-video/examples/bare/node_modules/react-native-test-app/android/config-plugins.gradle' line: 17 * What went wrong:
A problem occurred evaluating script.

Failed to apply config plugins: node:internal/process/promises:394 triggerUncaughtException(err, true /* fromPromise */); ^ SyntaxError: Unexpected token 'typeof' at compileSourceTextModule (node:internal/modules/esm/utils:337:16) at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:310:18) at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24) at Module._compile (node:internal/modules/cjs/loader:1503:5) at Module._extensions..js (node:internal/modules/cjs/loader:1691:10) at Module.load (node:internal/modules/cjs/loader:1317:32) at Module._load (node:internal/modules/cjs/loader:1127:12) at TracingChannel.traceSync (node:diagnostics_channel:315:14) at wrapModuleLoad (node:internal/modules/cjs/loader:217:24) at Module.require (node:internal/modules/cjs/loader:1339:12) { name: 'PluginError', isPluginError: true, code: 'INVALID_PLUGIN_IMPORT', cause: undefined } Node.js v22.9.0 * Try:
Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
Get more help at https://help.gradle.org. BUILD FAILED in 466ms.
info Run CLI with --verbose flag for more details.
error: script "android" exited with code 1

I also think you should move react-native-video-plugin-sample to exemple folder as it is not made to be released.

Thank you

@freeboub
Copy link
Collaborator

freeboub commented Nov 9, 2024

pod install is also failing on ios:
olivier@OrdinateOlivier bare % pod install --project-directory=ios
Framework build type is static library
[Codegen] Generating ios/build/generated/ios/React-Codegen.podspec.json
(node:19807) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
Auto-linking React Native modules for target ReactTestApp: RNCPicker and ReactTestApp-DevSupport
Analyzing dependencies
Fetching podspec for DoubleConversion from ../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
[Codegen] Found FBReactNativeSpec
Fetching podspec for RCT-Folly from ../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
[Codegen] Found rncore
Fetching podspec for boost from ../node_modules/react-native/third-party-podspecs/boost.podspec
Fetching podspec for glog from ../node_modules/react-native/third-party-podspecs/glog.podspec
Downloading dependencies
Removing react-native-video
Generating Pods project
Setting USE_HERMES build settings
Setting REACT_NATIVE build settings
Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /Users/olivier/openSource/react-native-video/examples/bare/node_modules/.generated/ios/ReactTestApp.xcodeproj
Pod install took 9 [s] to run
node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^

SyntaxError: Unexpected token 'typeof'
at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.importSyncForRequire (node:internal/modules/esm/loader:310:18)
at loadESMFromCJS (node:internal/modules/cjs/loader:1381:24)
at Module._compile (node:internal/modules/cjs/loader:1503:5)
at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
at Module.load (node:internal/modules/cjs/loader:1317:32)
at Module._load (node:internal/modules/cjs/loader:1127:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
at Module.require (node:internal/modules/cjs/loader:1339:12) {
name: 'PluginError',
isPluginError: true,
code: 'INVALID_PLUGIN_IMPORT',
cause: undefined
}

Node.js v22.9.0
[!] An error occurred while processing the post-install hook of the Podfile.

Failed to apply config plugins

/Users/olivier/openSource/react-native-video/examples/bare/node_modules/react-native-test-app/ios/test_app.rb:29:in apply_config_plugins' /Users/olivier/openSource/react-native-video/examples/bare/node_modules/react-native-test-app/ios/test_app.rb:447:in block in use_test_app_internal!'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.15.2/lib/cocoapods-core/podfile.rb:196:in post_install!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1013:in run_podfile_post_install_hook'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1001:in block in run_podfile_post_install_hooks' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:149:in message'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:1000:in run_podfile_post_install_hooks' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:337:in block (2 levels) in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in write!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:336:in block in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/user_interface.rb:64:in section' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:315:in create_and_save_projects'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:307:in generate_pods_project' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:183:in integrate'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/installer.rb:170:in install!' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/command/install.rb:52:in run'
/Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in run' /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/lib/cocoapods/command.rb:52:in run'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.15.2/bin/pod:55:in <top (required)>' /usr/local/bin/pod:23:in load'
/usr/local/bin/pod:23:in `

'

[!] CocoaPods will not include resources it cannot find:
dist/assets
dist/main.ios.jsbundle

The app will still build and run if they are served by the dev server. To include missing resources, make sure they exist, then run pod install again to update the workspace.

@KrzysztofMoch
Copy link
Member Author

I have bumped react-native version in bare example, I have tested it and now I am able to build and run android

my versions

  • node: 18.20.0
  • bun: 1.1.33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants