import-local-file
Let a globally installed package use a locally installed version of itself if available
Last updated 3 years ago by rem .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install import-local-file 
SYNC missed versions from official npm registry.

import-local-file

NPM version NPM downloads CircleCI donate

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, Poi uses this method.

Install

$ npm install --save import-local-file

Usage

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

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

License

MIT © EGOIST forked from Sindre Sorhus

Current Tags

  • 0.2.0                                ...           latest (3 years ago)

1 Versions

  • 0.2.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 7
This Week 101
This Month 102
Last Day 8
Last Week 73
Last Month 383
Dependencies (2)
Dev Dependencies (6)

Copyright 2014 - 2016 © taobao.org |