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
Merged

Conversation

@jamestalmage
Copy link
Contributor

@jamestalmage jamestalmage commented Oct 19, 2020

Fixes #571

@sindresorhus
Copy link
Owner

@sindresorhus sindresorhus commented Oct 19, 2020

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 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.

// Prefer the local installation
if (!importLocal(__filename)) {
if (isInstalledGlobally) {
console.log('Using global install of np.');

This comment has been minimized.

@sindresorhus

sindresorhus Oct 19, 2020
Owner

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

@sindresorhus sindresorhus commented Oct 19, 2020

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

For example?

@jamestalmage
Copy link
Contributor Author

@jamestalmage jamestalmage commented Oct 20, 2020

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

@sindresorhus sindresorhus commented Oct 29, 2020

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
1 check passed
1 check passed
Travis CI - Pull Request Build Passed
Details
@jamestalmage jamestalmage deleted the jamestalmage:pass-to-local-install branch Oct 30, 2020
@jamestalmage
Copy link
Contributor Author

@jamestalmage jamestalmage commented Oct 30, 2020

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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.