all-module-paths
Advanced tools
Comparing version 0.2.1 to 0.3.0
@@ -35,3 +35,3 @@ { | ||
"typings": "src/index.d.ts", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"repository": "tunnckoCoreLabs/all-module-paths", | ||
@@ -38,0 +38,0 @@ "homepage": "https://github.com/tunnckoCoreLabs/all-module-paths", |
@@ -6,11 +6,34 @@ import os from 'os'; | ||
const HOMEDIR = os.homedir(); | ||
export const globalModules = Object.keys(dirs) | ||
.reduce((acc, manager) => acc.concat(dirs[manager].packages), []) | ||
.map((x) => { | ||
const start = path.join(HOMEDIR, '.nvm', 'versions', 'node'); | ||
const end = path.join('lib', 'node_modules'); | ||
if (x.startsWith(start) && x.endsWith(end)) { | ||
return path.join(path.dirname(path.dirname(x))); | ||
} | ||
return x; | ||
}) | ||
.concat(mod.globalPaths.slice(0, -1)); | ||
export const localModules = module.paths.filter((x) => | ||
x.startsWith(os.homedir()), | ||
); | ||
export const localModules = module.paths.filter((x) => x.startsWith(HOMEDIR)); | ||
export const allPaths = localModules.concat(globalModules); | ||
export const allBins = allPaths.map((x) => path.join(x, '.bin')); | ||
export const allBins = allPaths | ||
.map((x) => { | ||
// tweak the NVM dirs, | ||
// We should not append `.bin` to the `./node/vX.X.X/lib/node_modules` | ||
// but instead the bins are in the `./node/vX.X.X/bin` | ||
const start = path.join(HOMEDIR, '.nvm', 'versions', 'node'); | ||
const end = path.join('lib', 'node_modules'); | ||
if (x.startsWith(start) && x.endsWith(end)) { | ||
// So we up until `./node/vX.X.X` and join bin | ||
return path.join(path.dirname(path.dirname(x)), 'bin'); | ||
} | ||
return path.join(x, '.bin'); | ||
}) | ||
.map((x) => path.join(x, '.bin')); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14807
45