From 06ebe5fc8fedfd2e6842b6b189fd99dee25ab6e0 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 27 Jul 2017 06:24:56 +0100 Subject: [PATCH] Use pkg-dir --- package.json | 4 ++-- src/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 7489a95..c7267dd 100644 --- a/package.json +++ b/package.json @@ -30,8 +30,8 @@ }, "homepage": "https://github.com/lukechilds/requireable", "dependencies": { - "find-root": "^1.1.0", - "mock-require": "^2.0.2" + "mock-require": "^2.0.2", + "pkg-dir": "^2.0.0" }, "devDependencies": { "ava": "^0.19.1", diff --git a/src/index.js b/src/index.js index 8542f64..02398b1 100644 --- a/src/index.js +++ b/src/index.js @@ -1,12 +1,12 @@ 'use strict'; -const findRoot = require('find-root'); +const pkgDir = require('pkg-dir'); const mock = require('mock-require'); const pkg = { success: false }; try { - pkg.path = findRoot(process.cwd()); + pkg.path = pkgDir.sync(); pkg.name = require(pkg.path + '/package.json').name; mock(pkg.name, require(pkg.path)); pkg.success = true;