[FEAT] Separate Tabs for npm run and yarn commands#3732
Conversation
✅ Deploy Preview for react-native ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
@kelset, I assume, this won't need to be backported to prev 1 or 2 (or even all) majors (versioned docs)? |
|
Sure.
@cortinico I can open a PR for those changes (switching to |
|
Are there any known issues related to command switch or any migration tips that we could include? |
As I mentioned in the PR description; specifically the table, we're only changing commands (the way we call |
nothing changes, we are just pointing people to the better and safer approach. Everything stays the same for the end user. |
There was a problem hiding this comment.
The documentation shows separate examples for Yarn and NPM, and has tabs for when instructions are different between them.
See as an example, the usage of constants.packageManagers in getting-started.md.
This change moves instructions which currently work for any package manager, and makes them only work on yarn, outside of a yarn-specific tab.
I would be interested to know more about this. Is this maybe looking at |
Not just that, also about the fact that npx means that the behaviour you get changes over time potentially, and there's the extra complication of what version of the command npx picks up based on caching and stuff... it's a minefield, so if we can avoid setting up users for useless pain it'd be much better for everyone. |
@kelset and @cortinico can better explain this. P.S.: Everyone can follow the "context"; link provided in PR description, for the prior relevant discussion which requested this PR. |
This is not applicable to using npx to run local scripts. |
|
Care to expand and put links to back what you are trying to say? I am not sure I understand. My point is that npx is complicated and unreliable, and I'd rather not set people approaching react-native for the first time to having to deal with something like that. |
|
I'll be taking a break, since finished with exams and haven't taken one in a while 😅. |
I think "Let's not recommend Apart from imo being more a CLI bug, this scenario is specific to using I'm also not sure switching out a confined part to yarn helps at all with the goal of "discourage npx", since right before this we tell people to use |
|
With all that said, if we want to encourage running the package.json steps instead, I think recommending “yarn” and “npm run” is fine. Intersecting with the README, IIRC it is a documented flow to initialize a project using npm, so we’d want to double check those users get the right commands in their new project README. |
|
@NickGerleman let me try to recap what I think we might have reached as an agreement for what we want to document to the users (both here and in the other PR facebook/react-native#37521):
This sounds good to me, let us know so that we have ✅ and we can let @Pranav-yadav complete this work (sorry it's taking so long Pranav 🙇♂️) |
|
We can do that. See the examples in #3732 (review) for how to provide different tabs for npm vs yarn on the website. Then see https://github.com/react-native-community/cli/blob/cd981848a50565cf416fbf60d0b66720f6ddd511/packages/cli/src/commands/init/init.ts#L29 for the entrypoint to CLI code for building a new project which uses npm instead of yarn. In that case, the README in the newly generated project would need to tell users to use |
|
Sure. Will take a look at it day-after-tomorrow. P.S.: Busy with an interview tomorrow :) |
c9bdbd4 to
9bd2233
Compare
|
@NickGerleman @kelset added separate tabs for Also, added markdown touchups wherever necessary, such as adding ``` blocks for codes that were formatted using TABs and language formatting such as ```xml |
yarn commandsnpm run and yarn commands
9bd2233 to
798f424
Compare
|
Everything else here LGTM |
Reminder; so we don't forget to merge this before the Also, since this PR ended up being a generic sitewide change, this should not be blocked by the other RN PR :) |
|
@Simek now that Nick gave his ✅ we can go ahead and merge this |
798f424 to
f93553f
Compare
|
🎉🎉🎉 |
|
Thank you very much @kelset, @NickGerleman & @Simek ❤️ for your feedback and reviews. |
…it <AppName>` (#37521) Summary: [skip-ci] I noticed that; when a _new_ RN App is created using RN CLI there is ***NO*** *README* file added to the project. Having a simple README file explaining what type of project it is, for example how other web projects do it, such as long lived `create-react-app`, now widely used `create-next-app`, etc. Why not for React Native App then? This PR; Adds README file to RN Template App ⚡, which should be added to the project when a new project is created using RN CLI. ### Website PR: facebook/react-native-website#3732 🚀😇 bypass-github-export-checks ## Changelog: [INTERNAL] [ADDED] - Add README to RN Template App ⚡ Pull Request resolved: #37521 Test Plan: - The README file should be included in the newly created RN App using RN CLI Reviewed By: NickGerleman Differential Revision: D46075719 Pulled By: cipolleschi fbshipit-source-id: efcccc09d72c57a065b36de6e787594082000e15
…it <AppName>` (#37521) Summary: [skip-ci] I noticed that; when a _new_ RN App is created using RN CLI there is ***NO*** *README* file added to the project. Having a simple README file explaining what type of project it is, for example how other web projects do it, such as long lived `create-react-app`, now widely used `create-next-app`, etc. Why not for React Native App then? This PR; Adds README file to RN Template App ⚡, which should be added to the project when a new project is created using RN CLI. ### Website PR: facebook/react-native-website#3732 🚀😇 bypass-github-export-checks ## Changelog: [INTERNAL] [ADDED] - Add README to RN Template App ⚡ Pull Request resolved: #37521 Test Plan: - The README file should be included in the newly created RN App using RN CLI Reviewed By: NickGerleman Differential Revision: D46075719 Pulled By: cipolleschi fbshipit-source-id: efcccc09d72c57a065b36de6e787594082000e15
…it <AppName>` (#37521) Summary: [skip-ci] I noticed that; when a _new_ RN App is created using RN CLI there is ***NO*** *README* file added to the project. Having a simple README file explaining what type of project it is, for example how other web projects do it, such as long lived `create-react-app`, now widely used `create-next-app`, etc. Why not for React Native App then? This PR; Adds README file to RN Template App ⚡, which should be added to the project when a new project is created using RN CLI. ### Website PR: facebook/react-native-website#3732 🚀😇 bypass-github-export-checks ## Changelog: [INTERNAL] [ADDED] - Add README to RN Template App ⚡ Pull Request resolved: facebook/react-native#37521 Test Plan: - The README file should be included in the newly created RN App using RN CLI Reviewed By: NickGerleman Differential Revision: D46075719 Pulled By: cipolleschi fbshipit-source-id: efcccc09d72c57a065b36de6e787594082000e15 Original: facebook/react-native@377a8b7
…it <AppName>` (#37521) Summary: [skip-ci] I noticed that; when a _new_ RN App is created using RN CLI there is ***NO*** *README* file added to the project. Having a simple README file explaining what type of project it is, for example how other web projects do it, such as long lived `create-react-app`, now widely used `create-next-app`, etc. Why not for React Native App then? This PR; Adds README file to RN Template App ⚡, which should be added to the project when a new project is created using RN CLI. ### Website PR: facebook/react-native-website#3732 🚀😇 bypass-github-export-checks ## Changelog: [INTERNAL] [ADDED] - Add README to RN Template App ⚡ Pull Request resolved: facebook/react-native#37521 Test Plan: - The README file should be included in the newly created RN App using RN CLI Reviewed By: NickGerleman Differential Revision: D46075719 Pulled By: cipolleschi fbshipit-source-id: efcccc09d72c57a065b36de6e787594082000e15 Original-Commit: facebook/react-native@377a8b7
…it <AppName>` (#37521) Summary: [skip-ci] I noticed that; when a _new_ RN App is created using RN CLI there is ***NO*** *README* file added to the project. Having a simple README file explaining what type of project it is, for example how other web projects do it, such as long lived `create-react-app`, now widely used `create-next-app`, etc. Why not for React Native App then? This PR; Adds README file to RN Template App ⚡, which should be added to the project when a new project is created using RN CLI. ### Website PR: facebook/react-native-website#3732 🚀😇 bypass-github-export-checks ## Changelog: [INTERNAL] [ADDED] - Add README to RN Template App ⚡ Pull Request resolved: facebook/react-native#37521 Test Plan: - The README file should be included in the newly created RN App using RN CLI Reviewed By: NickGerleman Differential Revision: D46075719 Pulled By: cipolleschi fbshipit-source-id: efcccc09d72c57a065b36de6e787594082000e15 Original-Commit: facebook/react-native@377a8b7
Summary
We're steering away from
npxdue to its unreliability and switching tonpm runandyarninstead, forpackage.jsonscripts.e.g.:
npmTabyarnTabRN Main PR: facebook/react-native#37521
Context
This was discussed here: facebook/react-native#37521 (comment)
P.S.: What this PR does not changes is; other
npx react-nativecommands such asinit,upgrade,bundle, etc. Since, those commands will need proper testing before such change.