4
0
Fork 0
mirror of https://github.com/Azure/setup-helm.git synced 2025-11-07 21:16:57 +00:00
setup-helm/node_modules/import-local
github-actions[bot] a517f2ff65
Add node modules and new code for release (#57)
Co-authored-by: taakleton <taakleton@users.noreply.github.com>
2022-01-26 17:16:26 -05:00
..
fixtures Add node modules and new code for release (#57) 2022-01-26 17:16:26 -05:00
index.js Add node modules and new code for release (#57) 2022-01-26 17:16:26 -05:00
license Add node modules and new code for release (#57) 2022-01-26 17:16:26 -05:00
package.json Add node modules and new code for release (#57) 2022-01-26 17:16:26 -05:00
readme.md Add node modules and new code for release (#57) 2022-01-26 17:16:26 -05:00

import-local

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

import importLocal from 'import-local';

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

You can also pass in __filename when used in a CommonJS context.


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.