Skip to content

Conversation

@nickx720
Copy link
Contributor

@nickx720 nickx720 commented Sep 29, 2021

Summary:

Implemented changes as per the pr

  1. Created a separate directory under packages.
  2. Labelled it as cli-doctor
  3. Moved the contents from doctor to cli-doctor
  4. Updated import paths
  5. Set up package.json under cli-doctor and modelled it along other cli packages like cli-hermes
  6. Ran yarn-install to ensure success local build

From Mike:

  1. Refactored Ora updates and cleaned-up getLoader
  2. Extracted cli-config into a separate package, reorganised tools inside cli so that it contains cli-only code
  3. Checked all package.json's for extraneous dependencies and made sure everything corresponds to the files used

Test Plan:

  1. Yarn install to ensure the dependencies worked on local.
  2. Made all unit tests pass

Copy link
Member

@grabbou grabbou left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. It's a great thing to do such a cleanup. I did left some notes (not a big deal) that need to be applied before this one is good to be merged. Looking forward to it!

@@ -1,5 +1,5 @@
import androidHomeEnvVariables from '../androidHomeEnvVariable';
import {NoopLoader} from '../../../../tools/loader';
import {NoopLoader} from '@react-native-community/cli/src/tools/loader';
Copy link
Member

Choose a reason for hiding this comment

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

You should not require files directly from source, but rather expose them via public API. TL;DR always require from @react-native-community/cli.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. Makes sense

import * as androidWinHelpers from '../../../../tools/windows/androidWinHelpers';
import * as environmentVariables from '../../../../tools/windows/environmentVariables';
import * as androidWinHelpers from '@react-native-community/cli/src/tools/windows/androidWinHelpers';
import * as environmentVariables from '@react-native-community/cli/src/tools/windows/environmentVariables';
Copy link
Member

Choose a reason for hiding this comment

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

Are all these functions used outside of a Doctor command? If all these tools, such as androidWinHelpers or downloadAndUnzip are used in Doctor only, then you should move them to doctor tools directory as well (first you may need to create one).

Check the recent commit that moves Metro to a separate package, it's a good example of moving the tooling around as well.

0993f62

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure will do thanks.

@grabbou grabbou added the on hold label Oct 4, 2021
@grabbou
Copy link
Member

grabbou commented Jan 24, 2022

Thanks for the PR. I will continue the work (apply the changes + few tweaks and rebase) and merge it in order to move forward with this one today.

@grabbou
Copy link
Member

grabbou commented Jan 24, 2022

This PR is still work in progress. I will return to it tomorrow. There are a few tools that need to be moved around to clean this up.

@grabbou grabbou mentioned this pull request Jan 24, 2022
3 tasks
@grabbou
Copy link
Member

grabbou commented Jan 25, 2022

Created a new package: cli-config for things that are exclusive to config only.
Cleaned up dependencies - there were a lot of dependencies missing in package.json, I made sure everything is covered.
Fixed up dependency on Ora - all packages are using getLoader() from tools package and should refer to the type from that package, rather than relying on Ora directly.


export const commands = {info, doctor};

export {default as installPods} from './tools/installPods'; No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

Ideally, I would like to remove dependency on this file from the CLI package.

@grabbou
Copy link
Member

grabbou commented Jan 25, 2022

One issue with Ora is remaining and we can merge this. Ignore type error and this is ready for review.

@grabbou grabbou changed the title Changed doctor to cli-doctor feat: move doctor into cli-doctor package, extract config into cli-config, clean-up types Jan 26, 2022
@grabbou grabbou merged commit 5530cfc into react-native-community:master Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants