Skip to content
This repository was archived by the owner on Dec 4, 2022. It is now read-only.

Commit 1252049

Browse files
author
David First
committed
expose resolveModulePath method
1 parent aa1771c commit 1252049

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

src/dependency-builder/build-tree.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,15 @@ function resolvePackageNameByPath(packagePath) {
168168
}
169169

170170
/**
171-
* Recursivly search for node module inside node_modules dir
171+
* Recursively search for node module inside node_modules dir
172172
* This function propegate up until it get's to the root provided then stops
173173
*
174174
* @param {string} nmPath - package name
175175
* @param {string} workingDir - dir to start searching of
176176
* @param {string} root - path to dir to stop the search
177177
* @returns The resolved path for the package directory
178178
*/
179-
function resolveModulePath(nmPath, workingDir, root) {
179+
export function resolveModulePath(nmPath: string, workingDir: string, root: string) {
180180
const pathToCheck = path.resolve(workingDir, 'node_modules', nmPath);
181181

182182
if (fs.existsSync(pathToCheck)) {

src/dependency-builder/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { getDependencyTree, resolveNodePackage } from './build-tree';
1+
import { getDependencyTree, resolveNodePackage, resolveModulePath } from './build-tree';
22

33
export {
44
resolveNodePackage,
5+
resolveModulePath,
56
getDependencyTree
67
};

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'regenerator-runtime/runtime';
22
// import { bindAction, bindSpecificComponentsAction } from './actions';
3-
import { getDependencyTree, resolveNodePackage } from './dependency-builder';
3+
import { getDependencyTree, resolveNodePackage, resolveModulePath } from './dependency-builder';
44
import PackageJson from './package-json/package-json';
55

66
// const lifecycleHooks = {
@@ -18,6 +18,7 @@ module.exports = {
1818
// bindSpecificComponents: bindSpecificComponentsAction,
1919
getDependencyTree,
2020
resolveNodePackage,
21+
resolveModulePath,
2122
PackageJson
2223
};
2324

0 commit comments

Comments
 (0)