install-module-linked
Version:
Installs and symlinks a module into node_modules
19 lines (18 loc) • 894 B
JavaScript
import worker from './workers/async.js';
import workerSync from './workers/sync.cjs';
export { default as clear } from './lib/clear.js';
export { default as parseInstallString } from './lib/parseInstallString.js';
export default function installModule(installString, nodeModulesPath, options, callback) {
if (typeof options === 'function') {
callback = options;
options = {};
}
options = options || {};
if (typeof callback === 'function') return worker(installString, nodeModulesPath, options, callback);
return new Promise((resolve, reject)=>worker(installString, nodeModulesPath, options, (err, dest)=>err ? reject(err) : resolve(dest)));
}
export function sync(installString, nodeModulesPath, options) {
options = options || {};
return workerSync(installString, nodeModulesPath, options);
}
export { default as install } from './lib/install.cjs';