npm-cli-dir
Advanced tools
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; | ||
}; |
{ | ||
"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": { |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
1
3351
2
7
1
+ Addedfind-pkg-dir@^1.0.0
+ Addedexecuting-npm-path@1.0.0(transitive)
+ Addedfind-pkg-dir@1.0.1(transitive)
+ Addednpm-cli-path@3.1.2(transitive)
+ Addedwin-user-installed-npm-cli-path@3.0.1(transitive)
- Removedexecuting-npm-path@0.1.0(transitive)
- Removedis-plain-obj@1.1.0(transitive)
- Removednpm-cli-path@2.0.5(transitive)
- Removedreal-executable-path@2.0.2(transitive)
- Removedreal-executable-path-callback@2.1.2(transitive)
- Removedwin-user-installed-npm-cli-path@2.0.4(transitive)
Updatednpm-cli-path@^3.0.0