You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
451 B
21 lines
451 B
'use strict'; |
|
const path = require('path'); |
|
const globalDirs = require('global-dirs'); |
|
|
|
const resolveGlobal = moduleId => { |
|
try { |
|
return require.resolve(path.join(globalDirs.yarn.packages, moduleId)); |
|
} catch (_) { |
|
return require.resolve(path.join(globalDirs.npm.packages, moduleId)); |
|
} |
|
}; |
|
|
|
module.exports = resolveGlobal; |
|
|
|
module.exports.silent = moduleId => { |
|
try { |
|
return resolveGlobal(moduleId); |
|
} catch (_) { |
|
return undefined; |
|
} |
|
};
|
|
|