UNPKG

709 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = resolveNodeModuleDir;
7var _findPackageDependencyDir = require("./findPackageDependencyDir");
8var _errors = require("./errors");
9/**
10 * Finds a path inside `node_modules`
11 */
12function resolveNodeModuleDir(root, packageName) {
13 const packageDependencyDirectory = (0, _findPackageDependencyDir.findPackageDependencyDir)(packageName, {
14 startDir: root
15 });
16 if (packageDependencyDirectory === undefined) {
17 throw new _errors.CLIError(`Node module directory for package ${packageName} was not found`);
18 } else {
19 return packageDependencyDirectory;
20 }
21}
22
23//# sourceMappingURL=resolveNodeModuleDir.ts.map
\No newline at end of file