Let a globally installed package use a locally installed version of itself if available
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
fixtures Init May 4, 2017
.editorconfig Meta tweaks Dec 15, 2017
.gitattributes Require Node.js 6 Aug 26, 2018
.gitignore Meta tweaks Dec 15, 2017
.npmrc Meta tweaks Dec 15, 2017
.travis.yml Require Node.js 6 Aug 26, 2018
index.js Init May 4, 2017
license Meta tweaks Dec 15, 2017
package-lock.json 2.0.0 Aug 31, 2018
package.json 2.0.0 Aug 31, 2018
readme.md Update URL to XO Feb 14, 2018
test.js Init May 4, 2017

readme.md

import-local Build Status

Let a globally installed package use a locally installed version of itself if available

Useful for CLI tools that want to defer to the user's locally installed version when available, but still work if it's not installed locally. For example, AVA and XO uses this method.

Install

$ npm install import-local

Usage

const importLocal = require('import-local');

if (importLocal(__filename)) {
	console.log('Using local version of this package');
} else {
	// Code for both global and local version here…
}

License

MIT © Sindre Sorhus