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

Add deprecation for global installs #7422

Closed
mrmckeb opened this issue Jul 24, 2019 · 4 comments · Fixed by #9359
Closed

Add deprecation for global installs #7422

mrmckeb opened this issue Jul 24, 2019 · 4 comments · Fixed by #9359

Comments

@mrmckeb
Copy link
Contributor

mrmckeb commented Jul 24, 2019

Is your proposal related to a problem?

When rolling out new features that require changes to the create-react-app package, we regularly see issues related to users with older, global installs of that package.

Describe the solution you'd like

Ideally, we should add a deprecation warning in react-scripts so that when it a user attempts to install it with a globally installed create-react-app, they're asked to remove it and use npx or yarn create instead.

Describe alternatives you've considered

Alternatively, or additionally, we could add this to create-react-app itself, but that won't fix the issue for those with older installs.

Additional context

This came out of a discussion with @iansu.

@miraage
Copy link

miraage commented Jul 25, 2019

Could you please clarify what console commands should raise errors?

@mrmckeb
Copy link
Contributor Author

mrmckeb commented Jul 25, 2019

@miraage, something like:

Global installs of create-react-app are now deprecated. Please remove this package with [command], and instead use npx or yarn.

We'd either include the updated commend(s), or provide a link.

@sagarnasit
Copy link

Hey @mrmckeb, I would like to contribute with this good first issue. Can you guide me on how to start with this?

@mrmckeb
Copy link
Contributor Author

mrmckeb commented Jul 28, 2019

Hi @sagarnasit, of course.

Let's ignore the exact messaging now and get a basic PR up, and then we can tune it.

First, we need to detect if the package was installed globally:

  • We can do this via a script
  • We can do this by looking at the package path and seeing if it is in the global path - npm config get prefix
  • There's an implementation to reference here too - but I'm not sure if it's the right solution.

The files we'll be doing this in are:

So, whenever either of those scripts is run and create-react-app is globally installed, we need to give a warning that global installs are deprecated.

Let me know if that helps (or doesn't) :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment