Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

[doctor] check for @types/react-native on 48+ (and other things you shouldn't install directly) #4731

Merged
merged 3 commits into from
Jul 20, 2023

Conversation

keith-kurak
Copy link
Contributor

@keith-kurak keith-kurak commented Jul 7, 2023

Why

@types/react-native is now included with react-native. Including the wrong/ old version of types could lead to... issues with types.

How

This looks more complicated than it sounds. That's because I'm starting a refactor with bigger goals in mind :D. I could have wedged this check as a conditional into the existing PackageJsonCheck, but the SDK filter happens for each check file, so I'd either duplicate that, or....

...introduce a DoctorMultiCheck that can filter by SDK by each individual item in a check, but, at least for now, without breaking the DoctorCheck interface. Combined with extracting the precise message for each package, this makes it easier to define additional checks of the same type as configuration. This use case is very simplistic, but the pattern would really sing once we have, say, a single DeepDependencyCheck with all those defined as configuration, running 100% in parallel, etc.

Bonus

Added the check for yarn/ npm direct installs because onto this because it's just another item in the list (and noticed some issues in the wild with it again).

Test Plan

types/react-native
image

npm:
image


Tagging @byCedric to at least confirm that the test for @types/react-native itself is accurate (I couldn't find much info about this change after you mentioned it).

@keith-kurak keith-kurak requested a review from byCedric July 7, 2023 20:32
@keith-kurak keith-kurak marked this pull request as ready for review July 7, 2023 20:32
@keith-kurak keith-kurak requested a review from brentvatne July 14, 2023 20:10
@keith-kurak keith-kurak changed the title [doctor] check for @types/react-native on 48+ [doctor] check for @types/react-native on 48+ (and other things you shouldn't install directly) Jul 14, 2023
Comment on lines +37 to +44
{
packageName: 'npm',
...shouldBeInstalledGloballyItem,
},
{
packageName: 'yarn',
...shouldBeInstalledGloballyItem,
},
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why these are on this list, but if there are issues adding a local version of the package manager, we might also need to add pnpm.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was based on this conversation here: https://exponent-internal.slack.com/archives/CP8BDK9F1/p1682665047400689

At this point, it's probably 97% of a Doctor-meta-check. I did see another case recently where npm was in package.json pinned to an old version that broke npm why, so a bunch of Doctor checks bailed.

The best I can tell, it's mostly harmless, but also entirely unnecessary, and very occasionally not harmless. I'll add pnpm for now, but, based on the above, I could also see restricting it to just npm, since that's the only one I've ever seen break anything.

@keith-kurak keith-kurak requested a review from byCedric July 17, 2023 16:11
Copy link
Member

@byCedric byCedric left a comment

Choose a reason for hiding this comment

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

LGTM

@keith-kurak keith-kurak merged commit 4cd9960 into main Jul 20, 2023
@keith-kurak keith-kurak deleted the keith/expo-48-types-react-native-check branch July 20, 2023 13:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy