Socket
Socket
Sign inDemoInstall

npm-cli-dir

Package Overview
Dependencies
8
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0-0 to 3.0.0

20

index.js
'use strict';
const {dirname, join, parse} = require('path');
const findPkgDir = require('find-pkg-dir');
const npmCliPath = require('npm-cli-path');
const getNpmCliDir = (async () => {
const path = parse(await npmCliPath());
const {root} = path;
let result = path.dir;
const getNpmCliDir = (async () => findPkgDir(await npmCliPath()))();
do {
try {
require.resolve(join(result, 'package.json'));
break;
} catch (_) {
result = dirname(result);
}
} while (result !== root);
return result;
})();
module.exports = async function npmCliDir() {
return getNpmCliDir;
};

9

package.json
{
"name": "npm-cli-dir",
"version": "3.0.0-0",
"version": "3.0.0",
"description": "Resolve the directory path where npm CLI is installed",

@@ -34,3 +34,4 @@ "repository": "shinnn/npm-cli-dir",

"dependencies": {
"npm-cli-path": "^2.0.3"
"find-pkg-dir": "^1.0.0",
"npm-cli-path": "^3.0.0"
},

@@ -41,4 +42,4 @@ "devDependencies": {

"execa": "^0.10.0",
"nyc": "^11.8.0",
"tape": "^4.9.0"
"nyc": "^12.0.2",
"tape": "^4.9.1"
},

@@ -45,0 +46,0 @@ "eslintConfig": {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc