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

feat: add add-platform command #2298

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

feat: add add-platform command #2298

wants to merge 4 commits into from

Conversation

szymonrybczak
Copy link
Collaborator

@szymonrybczak szymonrybczak commented Feb 14, 2024

Summary:

In this Pull Request I've added new command add-platform which re-uses code from init command to add a new OOT platform to existing React Native app. It gets React Native version from package.json and it tries to find a matching platform's version from NPM registry. Then, if successful it reuses editTemplate functions to replace placeholders.

demo.mp4

For OOT platforms to add a compatibility with the new command:

  1. Add platforms inside template.config.js, which is an array in which OOT platform should provide names of folders containing native code. e.g. platforms: ["macos"]
  2. Add postInitScript (also under template.config.js) with e.g. installing Pods and printing run instructions.
  3. Add platform's specific native code under packages/react-native/template${platformName}.

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

@szymonrybczak
Copy link
Collaborator Author

cc @kelset @tido64 @Saadnajmi would love to hear your thoughts about it 🙏

@kelset
Copy link
Member

kelset commented Feb 16, 2024

looping in also @acoates-ms and @chrisglein who might be interested in this

Copy link
Collaborator

@TMisiukiewicz TMisiukiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a few minor comments, overall lgtm 👍

packages/cli/src/commands/addPlatform/addPlatform.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/addPlatform/addPlatform.ts Outdated Show resolved Hide resolved
packages/cli/src/commands/init/editTemplate.ts Outdated Show resolved Hide resolved
@Saadnajmi
Copy link

At its current point, this doesn't work with React Native Windows or macOS, correct? Has this been tested maybe with some local changes to a clone of RNM/RNW to see how well it works? I think it's harder for me to give any feedback (at least macOS specific) without seeing an end to end use case (other than visionOS :P )

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

Successfully merging this pull request may close these issues.

None yet

5 participants