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

fix: warn only in init command when CLI uses cached npx version #44644

Conversation

szymonrybczak
Copy link
Contributor

Summary:

In #37510, a check was introduced to check if user is using @latest version of npx, but right now it checks for every command executed, but it should only ensure that @latest is included when creating a new project.

In this Pull Request I've added a condition to only warn if init was fired.

Changelog:

[GENERAL] [FIXED] - Warn only in init command when CLI uses cached npx version

Test Plan:

Warning about using @latest version CLI should only be presented when running init command.

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels May 21, 2024
@szymonrybczak
Copy link
Contributor Author

Also this wasn't visible to anyone because of react-native-community/cli#2389.

@blakef I'd appreciate if you can take a look at this PR 🙏

Copy link
Contributor

@cipolleschi cipolleschi 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 contribution, @szymonrybczak!

@cipolleschi
Copy link
Contributor

For some reasons, prettier is failing. Could you have a look at that, please?

@blakef
Copy link
Contributor

blakef commented May 22, 2024

Do we want to pin the version of the @react-native-community/cli to a react-native project? For example if I run npx react-native <some command> in an older React Native project I get this:

CleanShot 2024-05-22 at 10 57 42@2x

@szymonrybczak
Copy link
Contributor Author

szymonrybczak commented May 22, 2024

@blakef I think that is a right approach,npx uses cached version from node_modules and we're sure that we're using right CLI version for React Native, because when we'd suggest using @latest for every project it'd provide a lot of confusion e.g. in a scenario where we'd introduce breaking change in CLI then by using @latest it would break things in older projects.

@szymonrybczak
Copy link
Contributor Author

By the way I think it should be also backported to 0.74 along with react-native-community/cli#2389 once released.

@blakef blakef self-assigned this May 22, 2024
@facebook-github-bot
Copy link
Contributor

@blakef has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label May 23, 2024
@facebook-github-bot
Copy link
Contributor

@blakef merged this pull request in b98c5b9.

Copy link

This pull request was successfully merged by @szymonrybczak in b98c5b9.

When will my fix make it into a release? | How to file a pick request?

@szymonrybczak szymonrybczak deleted the fix/warn-only-about-latest-npx-in-init-command branch May 26, 2024 12:49
cipolleschi pushed a commit that referenced this pull request Jun 3, 2024
…44644)

Summary:
In #37510, a check was introduced to check if user is using `latest` version of `npx`, but right now it checks for every command executed, but it should only ensure that `latest` is included when creating a new project.

In this Pull Request I've added a condition to only warn if `init` was fired.

[GENERAL] [FIXED] - Warn only in `init` command when CLI uses cached `npx` version

Pull Request resolved: #44644

Test Plan: Warning about using `latest` version CLI should only be presented when running `init` command.

Reviewed By: arushikesarwani94

Differential Revision: D57681864

Pulled By: blakef

fbshipit-source-id: 5c81b9a08141396efcd24539b2560cea16028dd9
kosmydel pushed a commit to kosmydel/react-native that referenced this pull request Jun 11, 2024
…acebook#44644)

Summary:
In facebook#37510, a check was introduced to check if user is using `latest` version of `npx`, but right now it checks for every command executed, but it should only ensure that `latest` is included when creating a new project.

In this Pull Request I've added a condition to only warn if `init` was fired.

## Changelog:

[GENERAL] [FIXED] - Warn only in `init` command when CLI uses cached `npx` version

Pull Request resolved: facebook#44644

Test Plan: Warning about using `latest` version CLI should only be presented when running `init` command.

Reviewed By: arushikesarwani94

Differential Revision: D57681864

Pulled By: blakef

fbshipit-source-id: 5c81b9a08141396efcd24539b2560cea16028dd9
This was referenced Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Callstack Partner: Callstack Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants