Skip to content

New NPM #665

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

Draft
wants to merge 62 commits into
base: master
Choose a base branch
from
Draft

New NPM #665

wants to merge 62 commits into from

Conversation

CedricGuillemet
Copy link
Contributor

@CedricGuillemet CedricGuillemet commented Jun 6, 2025

WIP

Goal

Deliver 1 single self contained package with sources (no fetch, no secondary download) for all platform, for all RN versions.
Deprecated existing (Playground, tests, build script) in favor of a single RNTA Playground and simpler tooling.

Building the new NPM

  • Gather all sources (BabylonNative and dependencies) needed by Android/iOS/Windows builds
  • Remove unncessary dependencies (bgfx examples) and generate glue CMake files
  • Bundle previous iosAndroid and Windows Packages into a single NPM along gathered sources

Testing

  • Build RNTA for iOS, Android and Windows
  • Publish an artifact so it can be tested locally

PR Changes

  • Removed old system
  • Renamed BRNPlayground -> Playground
  • Moved react-native-iosandroid and react-native-windows content into Modules/@babylonjs/react-native folder
  • Added buildBabylonNativeSourceTree gulp export to gather BN sources
  • Update Android Gradle to use fetched content and build BabylonNative instead of using static libraries

TODO

  • Android Build
  • Windows Build
  • iOS Build
  • NPM Test publish job
  • Build .ts
  • Publish testable artifacts
  • Remove bgfx example/3rdparty folders
  • Permissions

Pros/Cons of sources in package

Pros

  • smaller disk footprint. no need to clear up space : https://github.com/BabylonJS/BabylonReactNative/tree/master/.github/workflows/macos_freespace
  • 1 single NPM package for all platforms and RN versions instead of 21
  • smaller NPMs (Windows is 700Mb per RN version)
  • put breakpoints anywhere
  • simpler builds (Android is handled by CMake, no need for Windows build scripts)
  • support for ABI breaking changes
  • unity build not needed anymore (windows binary size issue not relevant)
  • gulp script is reduced in scope
  • more precise control on components used (no more BASE_KIT package)
  • same podspec for dev and NPM
  • faster PR build/publish: ~15min Vs 1h

Cons

  • need to build BN source with same toolchain flags as BRN (but same for prebuilt static libraries)
  • slower build for users (?). need testing for that

Sizes

Binary packages

TS : 23Kb
Windows: 102Mb (700Mb Unzipped)
iOS-Android: 21Mb (65Mb Unzipped)

Source package (estimation)

21Mb (105Mb Unzipped)

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.

1 participant