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 global deprecate warning on create-react-app package #7452

Conversation

sagarnasit
Copy link

fixes #7422

Add global installation deprecate warning when create-react-app runs.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@sagarnasit
Copy link
Author

@mrmckeb I have created basic PR here. Tried this solution you provided but it seems it is not working well. Let me know how to proceed next.

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@@ -124,6 +125,10 @@ const program = new commander.Command(packageJson.name)
})
.parse(process.argv);

if (isInstalledGlobally) {
console.log(`global installation for create-react-app is deprecated.`);
Copy link

Choose a reason for hiding this comment

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

I think is good if you use console.warn with chalk.yellow to give a better warning message:

console.warn(`${chalk.yellow('global installation for create-react-app is deprecated.')}`); 

Copy link
Contributor

@mrmckeb mrmckeb Aug 5, 2019

Choose a reason for hiding this comment

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

I don't agree @Taym95, as this is Node, not the browser.

But I do agree that we should use colouring! :)

A few other thoughts:

  • Perhaps this should be the first thing emitted from the script? Above program?
  • Could the copy be more descriptive? Something like:

Global installations of create-react-app are now deprecated.

To remove the globally installed package, run npm uninstall -g create-react-app.

Updated installation instructions can be found here: https://facebook.github.io/create-react-app/docs/getting-started#quick-start

Edit: Actually @Taym95, I've noted that we do use console.warn in other places in our Node scripts - so that's a great suggestion ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

We may need a short URL for that - @ianschmitz, do you know if we have one?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not to my knowledge @mrmckeb.

Copy link
Contributor

@mrmckeb mrmckeb left a comment

Choose a reason for hiding this comment

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

A few changes and questions, but looking great :)

@@ -40,6 +40,7 @@ const dns = require('dns');
const envinfo = require('envinfo');
const execSync = require('child_process').execSync;
const fs = require('fs-extra');
const isInstalledGlobally = require('is-installed-globally');
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a simple way to achieve this without an extra dependency?

Copy link
Author

Choose a reason for hiding this comment

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

We need to get a current global path for npm or yarn and check it against the current executing path for npm or yarn.

Not sure if it possible internally without dependency in create-react-app script.

@@ -124,6 +125,10 @@ const program = new commander.Command(packageJson.name)
})
.parse(process.argv);

if (isInstalledGlobally) {
console.log(`global installation for create-react-app is deprecated.`);
Copy link
Contributor

@mrmckeb mrmckeb Aug 5, 2019

Choose a reason for hiding this comment

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

I don't agree @Taym95, as this is Node, not the browser.

But I do agree that we should use colouring! :)

A few other thoughts:

  • Perhaps this should be the first thing emitted from the script? Above program?
  • Could the copy be more descriptive? Something like:

Global installations of create-react-app are now deprecated.

To remove the globally installed package, run npm uninstall -g create-react-app.

Updated installation instructions can be found here: https://facebook.github.io/create-react-app/docs/getting-started#quick-start

Edit: Actually @Taym95, I've noted that we do use console.warn in other places in our Node scripts - so that's a great suggestion ;)

@@ -124,6 +125,10 @@ const program = new commander.Command(packageJson.name)
})
.parse(process.argv);

if (isInstalledGlobally) {
console.log(`global installation for create-react-app is deprecated.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

We may need a short URL for that - @ianschmitz, do you know if we have one?

@mrmckeb mrmckeb self-assigned this Aug 5, 2019
@mrmckeb mrmckeb added this to the 3.2 milestone Aug 5, 2019
@ianschmitz ianschmitz modified the milestones: 3.3, 3.4 Dec 5, 2019
@iansu iansu modified the milestones: 3.4, 3.5 Feb 14, 2020
@ianschmitz ianschmitz modified the milestones: 4.1, 4.0 May 4, 2020
@eddiemonge
Copy link
Contributor

Based on maintainers feedback, this needs to check for yarn create and running npx in nvm.

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

Successfully merging this pull request may close these issues.

Add deprecation for global installs
7 participants