npm-cli-dir
Advanced tools
Comparing version 3.0.1 to 4.0.0
18
index.js
@@ -6,11 +6,19 @@ 'use strict'; | ||
let result = null; | ||
let path; | ||
const firstTry = (async () => { | ||
try { | ||
path = findPkgDir(await npmCliPath()); | ||
} catch { | ||
return false; | ||
} | ||
return true; | ||
})(); | ||
module.exports = async function npmCliDir() { | ||
if (result !== null) { | ||
return result; | ||
if (!path && !await firstTry) { | ||
path = findPkgDir(await npmCliPath()); | ||
} | ||
result = findPkgDir(await npmCliPath()); | ||
return result; | ||
return path; | ||
}; |
{ | ||
"name": "npm-cli-dir", | ||
"version": "3.0.1", | ||
"version": "4.0.0", | ||
"description": "Resolve the directory path where npm CLI is installed", | ||
"repository": "shinnn/npm-cli-dir", | ||
"author": "Shinnosuke Watanabe (https://github.com/shinnn)", | ||
"author": "Watanabe Shinnosuke (https://github.com/shinnn)", | ||
"license": "ISC", | ||
"scripts": { | ||
"pretest": "eslint .", | ||
"test": "nyc --reporter=html --reporter=text node test.js" | ||
"test": "coverage test.js" | ||
}, | ||
"license": "ISC", | ||
"files": [ | ||
@@ -34,16 +34,16 @@ "index.js" | ||
"dependencies": { | ||
"find-pkg-dir": "^1.0.1", | ||
"npm-cli-path": "^3.1.0" | ||
"find-pkg-dir": "^2.0.0", | ||
"npm-cli-path": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@shinnn/eslint-config-node": "^6.0.0", | ||
"clear-module": "^3.0.0", | ||
"eslint": "^5.3.0", | ||
"nyc": "^13.0.1", | ||
"path-key": "^2.0.1", | ||
"tape": "^4.9.1" | ||
"@shinnn/eslint-config": "^6.10.4", | ||
"clear-module": "^3.2.0", | ||
"coverage": "^0.3.3", | ||
"eslint": "^5.16.0", | ||
"path-key": "^3.1.0", | ||
"testit": "^3.1.0" | ||
}, | ||
"eslintConfig": { | ||
"extends": "@shinnn/node" | ||
"extends": "@shinnn" | ||
} | ||
} |
# npm-cli-dir | ||
[![npm version](https://img.shields.io/npm/v/npm-cli-dir.svg)](https://www.npmjs.com/package/npm-cli-dir) | ||
[![Build Status](https://travis-ci.org/shinnn/npm-cli-dir.svg?branch=master)](https://travis-ci.org/shinnn/npm-cli-dir) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/e83hdqrnieckmm5c/branch/master?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/npm-cli-dir/branch/master) | ||
[![Coverage Status](https://img.shields.io/coveralls/shinnn/npm-cli-dir.svg)](https://coveralls.io/github/shinnn/npm-cli-dir) | ||
[![Build Status](https://travis-ci.com/shinnn/npm-cli-dir.svg?branch=master)](https://travis-ci.com/shinnn/npm-cli-dir) | ||
[![codecov](https://codecov.io/gh/shinnn/npm-cli-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/npm-cli-dir) | ||
@@ -20,3 +19,3 @@ A [Node.js](https://nodejs.org/) module to resolve a path of the directory where [npm CLI](https://github.com/npm/cli) is installed | ||
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm). | ||
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/). | ||
@@ -49,2 +48,2 @@ ``` | ||
[ISC License](./LICENSE) © 2017 - 2018 Shinnosuke Watanabe | ||
[ISC License](./LICENSE) © 2017 - 2019 Watanabe Shinnosuke |
Sorry, the diff of this file is not supported yet
18
3231
48
+ Addedfind-pkg-dir@2.0.0(transitive)
+ Addednpm-cli-path@4.0.0(transitive)
+ Addedwin-user-installed-npm-cli-path@4.0.0(transitive)
- Removedfind-pkg-dir@1.0.1(transitive)
- Removednpm-cli-path@3.1.2(transitive)
- Removedwin-user-installed-npm-cli-path@3.0.1(transitive)
Updatedfind-pkg-dir@^2.0.0
Updatednpm-cli-path@^4.0.0