summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/find-npm-prefix
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/find-npm-prefix')
-rw-r--r--deps/npm/node_modules/find-npm-prefix/find-prefix.js50
-rw-r--r--deps/npm/node_modules/find-npm-prefix/package.json33
2 files changed, 44 insertions, 39 deletions
diff --git a/deps/npm/node_modules/find-npm-prefix/find-prefix.js b/deps/npm/node_modules/find-npm-prefix/find-prefix.js
index 089572ec11..d5e271322b 100644
--- a/deps/npm/node_modules/find-npm-prefix/find-prefix.js
+++ b/deps/npm/node_modules/find-npm-prefix/find-prefix.js
@@ -5,11 +5,9 @@ module.exports = findPrefix
const fs = require('fs')
const path = require('path')
-const Bluebird = require('bluebird')
-const readdir = Bluebird.promisify(fs.readdir)
function findPrefix (dir) {
- return Bluebird.try(() => {
+ return new Promise((resolve, reject) => {
dir = path.resolve(dir)
// this is a weird special case where an infinite recurse of
@@ -20,9 +18,11 @@ function findPrefix (dir) {
dir = path.dirname(dir)
walkedUp = true
}
- if (walkedUp) return dir
-
- return findPrefix_(dir)
+ if (walkedUp) {
+ resolve(dir)
+ } else {
+ resolve(findPrefix_(dir))
+ }
})
}
@@ -32,23 +32,25 @@ function findPrefix_ (dir, original) {
const parent = path.dirname(dir)
// this is a platform independent way of checking if we're in the root
// directory
- if (parent === dir) return original
-
- return readdir(dir).then(files => {
- if (files.indexOf('node_modules') !== -1 ||
- files.indexOf('package.json') !== -1) {
- return dir
- }
-
- return findPrefix_(parent, original)
- }, er => {
- // an error right away is a bad sign.
- // unless the prefix was simply a non
- // existent directory.
- if (er && dir === original && er.code !== 'ENOENT') {
- throw er
- } else {
- return original
- }
+ if (parent === dir) return Promise.resolve(original)
+
+ return new Promise((resolve, reject) => {
+ fs.readdir(dir, (err, files) => {
+ if (err) {
+ // an error right away is a bad sign.
+ // unless the prefix was simply a non
+ // existent directory.
+ if (err && dir === original && err.code !== 'ENOENT') {
+ reject(err)
+ } else {
+ resolve(original)
+ }
+ } else if (files.indexOf('node_modules') !== -1 ||
+ files.indexOf('package.json') !== -1) {
+ resolve(dir)
+ } else {
+ resolve(findPrefix_(parent, original))
+ }
+ })
})
}
diff --git a/deps/npm/node_modules/find-npm-prefix/package.json b/deps/npm/node_modules/find-npm-prefix/package.json
index 4007b90c3c..e9344afe54 100644
--- a/deps/npm/node_modules/find-npm-prefix/package.json
+++ b/deps/npm/node_modules/find-npm-prefix/package.json
@@ -1,27 +1,32 @@
{
- "_from": "find-npm-prefix@latest",
- "_id": "find-npm-prefix@1.0.1",
+ "_args": [
+ [
+ "find-npm-prefix@1.0.2",
+ "/Users/rebecca/code/npm"
+ ]
+ ],
+ "_from": "find-npm-prefix@1.0.2",
+ "_id": "find-npm-prefix@1.0.2",
"_inBundle": false,
- "_integrity": "sha512-I9R7ZnsjlKRvXBJjA1PE4wAkSc24YChoomWdEPTZgeB4DHxf87OutNGV5McFj6WwPghH97nZRejH58XvY6ga6Q==",
+ "_integrity": "sha512-KEftzJ+H90x6pcKtdXZEPsQse8/y/UnvzRKrOSQFprnrGaFuJ62fVkP34Iu2IYuMvyauCyoLTNkJZgrrGA2wkA==",
"_location": "/find-npm-prefix",
"_phantomChildren": {},
"_requested": {
- "type": "tag",
+ "type": "version",
"registry": true,
- "raw": "find-npm-prefix@latest",
+ "raw": "find-npm-prefix@1.0.2",
"name": "find-npm-prefix",
"escapedName": "find-npm-prefix",
- "rawSpec": "latest",
+ "rawSpec": "1.0.2",
"saveSpec": null,
- "fetchSpec": "latest"
+ "fetchSpec": "1.0.2"
},
"_requiredBy": [
- "#USER",
- "/"
+ "/",
+ "/libcipm"
],
- "_resolved": "https://registry.npmjs.org/find-npm-prefix/-/find-npm-prefix-1.0.1.tgz",
- "_shasum": "af0faa74e19294b3c8634bae0e91017bb5adfac2",
- "_spec": "find-npm-prefix@latest",
+ "_resolved": "https://registry.npmjs.org/find-npm-prefix/-/find-npm-prefix-1.0.2.tgz",
+ "_spec": "1.0.2",
"_where": "/Users/rebecca/code/npm",
"author": {
"name": "Rebecca Turner",
@@ -31,9 +36,7 @@
"bugs": {
"url": "https://github.com/npm/find-npm-prefix/issues"
},
- "bundleDependencies": false,
"dependencies": {},
- "deprecated": false,
"description": "Find the npm project directory associated with for a given directory",
"devDependencies": {
"require-inject": "^1.4.2",
@@ -55,5 +58,5 @@
"scripts": {
"test": "standard && tap --100 test"
},
- "version": "1.0.1"
+ "version": "1.0.2"
}