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

Prefer local install #572

Merged
merged 5 commits into from Oct 29, 2020

Conversation

jamestalmage
Copy link
Contributor

@jamestalmage jamestalmage commented Oct 19, 2020

Fixes #571

@sindresorhus
Copy link
Owner

Can you mention the behavior in the readme? That the globally installed CLI uses the local version if any.

@jamestalmage
Copy link
Contributor Author

jamestalmage commented Oct 19, 2020

I am wondering about our choice here. np is a bit different than AVA or XO. If I run an old local version of XO a few times, I'll get the warning to upgrade, and can make my choice.

If the local project has an outdated version of np - by the time I notice, it may have done things I wasn't expecting. Especially if I am used to a newer version of np.

With AVA and XO, it's not a big deal. np does things that aren't as easy to undo.

source/cli.js Outdated
// Prefer the local installation
if (!importLocal(__filename)) {
if (isInstalledGlobally) {
console.log('Using global install of np.');
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think this should be logged each time. You can use util.debuglog.

@sindresorhus sindresorhus changed the title Prefer local install. Fixes #571 Prefer local install Oct 19, 2020
@sindresorhus
Copy link
Owner

by the time I notice, it may have done things I wasn't expecting

For example?

@jamestalmage
Copy link
Contributor Author

For example?

You keep adding new features / checks all the time (like waiting for GitHub Actions to complete, etc). If I have come to rely on some new feature, and open up some old project - np is going to silently revert and not run those extra checks.

I am just wondering if we need the added auto-magic convenience on a module I use 10x-20x less than xo or AVA.

@sindresorhus
Copy link
Owner

If I have come to rely on some new feature, and open up some old project - np is going to silently revert and not run those extra checks.

I think it's more important to use the correct np than to miss out on some checks. This is especially important in case np does breaking changes to any of the config.

@sindresorhus sindresorhus merged commit 0cff2b4 into sindresorhus:master Oct 29, 2020
@jamestalmage jamestalmage deleted the pass-to-local-install branch October 30, 2020 21:00
@jamestalmage
Copy link
Contributor Author

I think it's more important to use the correct np than to miss out on some checks. This is especially important in case np does breaking changes to any of the config.

Oh, totally agree. My point was that maybe we could just enforce it with a failure of the global CLI, instead of automatically running the local one. That way the user is making the conscious choice to use the older local np, or upgrading the local np before releasing.

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

Successfully merging this pull request may close these issues.

If run as global script, local config is ignored.
2 participants