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 platform-cli-apple with reusable utilities for OOT platforms #2208

Merged
merged 15 commits into from
Dec 20, 2023

Conversation

okwasniewski
Copy link
Contributor

@okwasniewski okwasniewski commented Dec 14, 2023

Summary:

The goal of this PR is to refactor most of cli-platform-ios to cli-platform-apple which provides reusable utilities allowing OOT platforms to build their commands. Example:

const {
  buildOptions,
  getProjectConfig,
  createBuild,
} = require('@react-native-community/cli-platform-apple');

const buildVisionOS = {
  name: 'build-visionos',
  description: 'builds your app for visionOS platform',
  func: createBuild({platformName: 'visionos'}),
  examples: [
    {
      desc: 'Build the app for visionOS in Release mode',
      cmd: 'npx react-native build-visionos --mode "Release"',
    },
  ],
  options: buildOptions,
};

module.exports = {
  commands: [buildVisionOS], // <- Add command here
  platforms: {
     visionos: {
      npmPackageName: '@callstack/react-native-visionos',
      projectConfig: getProjectConfig({platformName: 'visionos'}), 
      dependencyConfig: ios.dependencyConfig,
    },
  }
};

Test Plan:

CI Green

Checklist

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

@github-actions github-actions bot added the docs Documentation change label Dec 18, 2023
@okwasniewski okwasniewski changed the title feat: refactor run-ios to separate files, export more utilities feat: add platform-cli-apple with reusable utilities Dec 18, 2023
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.

left some comments

@okwasniewski okwasniewski marked this pull request as ready for review December 19, 2023 11:12
@okwasniewski okwasniewski changed the title feat: add platform-cli-apple with reusable utilities feat: add platform-cli-apple with reusable utilities for OOT platforms Dec 19, 2023
Comment on lines +6 to +13
export function getFallbackSimulator(args: FlagsT): Device {
/**
* If provided simulator does not exist, try simulators in following order
* - iPhone 14
* - iPhone 13
* - iPhone 12
* - iPhone 11
*/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not really applicable for all apple platforms

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it's used only on iOS - I don't want to remove it to introduce breaking changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's create a new issue to remove this

@@ -7,7 +7,8 @@
*/

import execa from 'execa';
import listIOSDevices from '../listIOSDevices';
import listDevices from '../listDevices';
import {getPlatformInfo} from '../../commands/runCommand/getPlatformInfo';
Copy link
Member

Choose a reason for hiding this comment

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

Looks like this method is here by accident. Can we create a dedicated commands/runCommand/__tests__/getPlatformInfo.test.ts?

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Left a few small things to address, overall LGTM and nice refactor

Copy link
Collaborator

@szymonrybczak szymonrybczak left a comment

Choose a reason for hiding this comment

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

good work! 🎉

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.

please check failing unit tests 👀

@thymikee thymikee merged commit a4417a1 into react-native-community:main Dec 20, 2023
9 of 10 checks passed
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.

4 participants