Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

all-module-paths

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

all-module-paths - npm Package Compare versions

Comparing version 0.7.1 to 0.8.0

CHANGELOG.md

110

package.json
{
"name": "all-module-paths",
"description": "sasas",
"license": "Apache-2.0",
"licenseStart": "2018",
"scripts": {
"start": "tunnckocore-scripts",
"docs": "yarn start docks --outfile .verb.md && verb",
"lint": "yarn start eslint '**/*.js' --cache --fix --quiet --format codeframe",
"test-only": "node -r esm test",
"test": "nyc node test",
"precommit": "yarn run lint && yarn run test-only",
"commit": "yarn dry",
"dry": "git add -A && git status --porcelain && yarn start gitcommit"
"version": "0.8.0",
"description": "Get all possible javascript (npm/yarn/pnpm) global or local, binaries or packages paths, e.g. node_modules and node_modules/.bin. Also works for those using NVM or such",
"repository": {
"type": "git",
"url": "https://github.com/tunnckoCore/opensource.git",
"directory": "packages/all-module-paths"
},
"homepage": "https://tunnckocore.com/opensource",
"author": "Charlike Mike Reagent <opensource@tunnckocore.com> (https://tunnckocore.com)",
"license": "MPL-2.0",
"engines": {
"node": "^8.10.0 || >=10.13.0"
"node": ">=10.13"
},
"dependencies": {
"esm": "^3.0.84",
"global-dirs": "^0.1.1"
},
"devDependencies": {
"@tunnckocore/scripts": "^1.1.0",
"asia": "^1.0.0-rc.6",
"docks": "^0.6.1"
},
"main": "src/main.js",
"module": "src/index.js",
"typings": "index.d.ts",
"files": [
"src",
"index.js"
"index.d.ts"
],
"main": "index.js",
"module": "src/index.js",
"typings": "src/index.d.ts",
"version": "0.7.1",
"repository": "tunnckoCoreLabs/all-module-paths",
"homepage": "https://github.com/tunnckoCoreLabs/all-module-paths",
"author": "Charlike Mike Reagent (https://tunnckocore.com)",
"keywords": [
"tunnckocorehq",
"tunnckocore-oss",
"hela",
"development",
"developer-experience",
"dx",
"utils",
"module",
"module-paths",
"paths",
"global-modules",
"local-modules",
"bin",
"bin-paths",
"binaries",
"packages",
"package-paths",
"npm",
"pnpm",
"yarn",
"javascript",
"local",
"global"
],
"scripts": {},
"dependencies": {
"esm": "^3.2.25",
"global-dirs": "^2.0.0"
},
"publishConfig": {

@@ -43,6 +57,15 @@ "access": "public",

},
"renovate": {
"extends": "tunnckocore"
"jest": {
"coverageThreshold": {
"src/**/*.js": {
"statements": 100,
"branches": 100,
"functions": 100,
"lines": 100
}
}
},
"licenseStart": 2018,
"verb": {
"readme": "../../readme-template.md",
"run": true,

@@ -58,22 +81,11 @@ "toc": {

],
"related": {
"list": [
"asia",
"charlike",
"docks",
"gitcommit",
"git-commits-since",
"recommended-bump",
"@tunnckocore/create-project",
"@tunnckocore/config"
]
},
"lint": {
"reflinks": true
},
"reflinks": [
"new-release",
"semantic-release"
]
}
"reflinks": [],
"related": {
"list": []
}
},
"gitHead": "dbf1b1c6891d5e7e9859cbc425b977d3790ae43c"
}

@@ -0,4 +1,6 @@

import fs from 'fs';
import os from 'os';
import path from 'path';
import mod from 'module';
import path from 'path';
import assert from 'assert';
import dirs from 'global-dirs';

@@ -8,3 +10,11 @@

export default function allModulePaths(m) {
export default function allModulePaths(options = {}) {
const { paths } = { paths: [], ...options };
assert(Array.isArray(paths), 'expect options.paths to be string[]');
const pnpmStoreVersions = ['3', '2', '1'].map((x) =>
path.join('pnpm-global', String(x), 'node_modules'),
);
/**

@@ -15,9 +25,12 @@ * GLOBAL

// Maximum up to the home directory
// eslint-disable-next-line prefer-destructuring
const globalPaths = mod.globalPaths
.filter((x) => x.startsWith(HOMEDIR))
// ?? removing pnpm stuff from globalPaths, we later adding it again
.filter((x) => {
const fp = path.join('pnpm-global', '1', 'node_modules');
const condition = pnpmStoreVersions.find(
(fp) => (x.includes(fp) && x.endsWith(fp)) || !x.includes(fp),
);
return (x.includes(fp) && x.endsWith(fp)) || !x.includes(fp);
return condition;
})

@@ -45,7 +58,9 @@ .filter((x) => !x.includes(path.join('pnpm-global', 'node_modules')));

// Only the pnpm-store path can be changed.
const pnpmGlobal = path.join(nvmCurrent, 'pnpm-global', '1', 'node_modules');
const pnpmGlobal = pnpmStoreVersions.find((pnpmGlobalStore) =>
fs.existsSync(pnpmGlobalStore),
);
// Always first all the "official" global paths,
// it's mostly always a short array of few items paths.
// That ensures that the nvm's global dir is always last item.
// That ensures that the nvm's global dir is always last item
// We also filtering out the `vX.X.X/node_modules`, because such never exist.

@@ -103,3 +118,3 @@ const globalPackages = globalPaths

const localPackages = m.paths.filter((x) => x.startsWith(HOMEDIR));
const localPackages = paths.filter((x) => x.startsWith(HOMEDIR));
const localBinaries = localPackages.map((x) => path.join(x, '.bin'));

@@ -106,0 +121,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc