import-local
    Overview
    Documentation
    Tutorials
    Chat
    Insights
    Code
    Dependencies
    Contributors
    Jobs

import-local

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

3.0.2  •  Updated 8 months ago  •  by Sindre Sorhus  •  MIT License

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…
}

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Popularity

Maintenance

Development

Last ver 8 months ago
Created 3 years ago
Last commit 8 months ago
1 month between commits

Technology

Node version: 10.16.0
4.2K unpacked

Compliance

MIT License
OSI Approved
0 vulnerabilities

Contributors

4 contributors
Sindre Sorhus
Maintainer, 16 commits, 4 merges
Matt Mulder
2 commits, 2 PRs
Works at Yelp
Corey Farrell
1 commits, 1 PRs
Works at CFWare, LLC
Kei Ito
1 commits, 1 PRs
Kevin Mårtensson
Maintainer
Works at imagemin yeoman
Sam Verschueren
Maintainer

Tags

import
local
require
resolve
global
version
prefer
cli
Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.