-
Notifications
You must be signed in to change notification settings - Fork 63
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
feat: SDK #67
Conversation
After many attempts, I've arrived at conclusion that this approach will not work properly in the long run - this is mostly because this pattern was never supported and creating an umbrella dependency is simply not possible, unless you are willing to handle the resolutions to that nested Instead of removing the direct dependencies and keeping them in the SDK, the SDK will serve a purpose as a control package that will enforce the version of dependencies using a tool called One thing that remains to be determined is whether this solution will work in a polyrepo scenario - or perhaps we need to find another tool to handle dependencies outside of the monorepo. But for monorepo this solution seems very promising and does not deviate from common practices when working with |
Reworked the PR description to reflect the newest changes |
published to npm: https://www.npmjs.com/package/super-app-showcase-sdk |
Summary
This PR introduces new package to the project:
super-app-showcase-sdk
.It's purpose is three-fold:
news-mini-app
)shared
dependencies in-sync manually by automating the processWith super-apps, managing dependencies quickly gets out of hand and this package is a prototype of a solution that will greatly reduce the overhead caused by the super-app setup and allow for an easier way of maintaining such projects going forward.
Having an SDK in the app allows for easier upgrades and determining compatibility with the host-app based on single variable - SDK version.
We use
@rnx-kit/align-deps
to align the dependencies. Beforesyncpack
was considered an option but it's only suitable for monorepos, and@rnx-kit/align-deps
is more universal in that matter. With a little bit of config, in each package using@rnx-kit/align-deps
, we can ensure that requirements are met and the mini-apps will be compatible with the host-app. It can also be used to do a dry-run and perform the check before building for release. This is useful for CI job that might be added to the showcase in the future.The SDK can be published as an
npm
package and versioned.it is It also removed the need to keep
dependencies
&devDependencies
inpackage.json
of the SDK.SDK contents
The SDK contains the following items:
resolveNodePackage.gradle
- moved fromshared
directory in the root - dynamic resolution ofreact-native
&RN-CLI
location for android (needed forpnpm
compatbility)react_native_setup.gradle
- moved fromshared
directory in the root - dynamic resolution ofreact-native
&RN-CLI
location for iOS (needed forpnpm
compatbility)shared-dependencies
- based ondeps.json
from the SDK, creates ashared
entry forModuleFederationPlugin
and removes the necessity for keeping it up-to-date manually.deps.json
- list of production dependencies - needs to be maintained manuallydev-deps.json
- list of development dependencies - needs to be maintained manuallyrnx-preset
- combinesdeps.json
&dev-deps.json
to create a@rnx-kit/align-deps
preset used to align the dependencies within the apps.All relevant packages in the super-app-showcase monorepo were updated to use the SDK.
Checklist
dependencies
devDependencies
shared
filed in ModuleFederation plugins@rnx-kit/align-deps
commandsnews-mini-app
)Future
The solution created here is quite generic, so it can possibly be extracted into a public npm module that will allow for setup of such
SDK
repo/package in other projects easily. The only thing that needs to be configurable is thedeps.json
&dev-deps.json
.When it comes to android and iOS specific scripts - the iOS part is already included in
react-native@0.72
, while android will most likely be available inreact-native@0.74
.Test plan