facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.72k stars 26.85k forks source link

[Documentation] --use-npm & --scripts-version #7234

Open adeelibr opened 5 years ago

adeelibr commented 5 years ago

There should be mention of the following;

npx create-react-app --scripts-version CUSTOM_SCRIPT_PATH my-project-name --use-npm

I am more than happy to make a PR for this. (I would need some guideance though :))

adeelibr commented 5 years ago

Also the feature where having .template.dependencies.json file when init a new CRA adds dependencies while installing is also not documented.

https://github.com/facebook/create-react-app/blob/45197e67fd5ff4c0fa315ec7d91eead354e4bdd8/packages/react-scripts/scripts/init.js#L170

adeelibr commented 5 years ago

If anyone can guide me as to where these need to be documented, i'd love to help in in anyway I can :)

mrmckeb commented 5 years ago

Hello @adeelibr. We don't support .template.dependencies.json officially, but the other methods are supported - but not documented.

I think we need to document scripts-version at some point, but we need to do it carefully as that feature is not for beginners.

I'd be happy to accept a PR for the first two (excluding template dependencies for now) if you'd like to raise one. I can work on it with you :)

adeelibr commented 5 years ago

AWESOME! 😄 😄 I'll make a PR and share here @mrmckeb Small question, which section should I document --use-npm & --scripts-version in? 🤔 💭

mrmckeb commented 5 years ago

That's a very good question. I always have to think about this stuff a lot too.

I recommend we add it to this section, under this (at the same level): https://facebook.github.io/create-react-app/docs/getting-started#creating-a-typescript-app

"Selecting a package manager"

I would mention that by default, Yarn is used to install dependencies when available, and to skip this, you can use the --use-npm flag.

"Passing through a scripts package"

I would first highlight that by default the latest react-scripts is used, and that you shouldn't need to use this setting. Also, lean on the fact that this lets you install react-scripts at any version (--scripts-version react-scripts@#.#.#).

Then, as a last comment, you could mention that third-party scripts could also be installed using this method, but that the team can't offer support for unofficial scripts and you should reach out to the authors of those for support.


Be warned that this PR may have a bit of discussion around it, as it'll need to go through a few team members - but we'll get it in in some form ;)

Thanks!

adeelibr commented 5 years ago

Cool thank you. I will make a PR today and share it with you. Thank you again for reviewing my issue. @mrmckeb

adeelibr commented 5 years ago

@mrmckeb I made an initial poor draft on --use-scripts flag & wrote it here https://gist.github.com/adeelibr/304da37d0e22a687b1bf6f09c6f10ee6 Can you kindly give me some direction here =)

mrmckeb commented 5 years ago

Thanks @adeelibr. If you want to create a PR for this, we could start the discussion.

I can give more feedback there, but again, this is a PR that might be rejected due to the potential for people to misunderstand and misuse scripts.

adeelibr commented 5 years ago

I am so sorry for the very late response on this, 😭 😞 😥 I have made a PR for documenting --use-script. I know you are super busy but when ever you get a chance to have a look at it @mrmckeb