Skip to content

Commit

Permalink
feat: solidify npm modules path resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 24, 2018
1 parent c0dba47 commit 9094fd5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/get-npm-modules-path.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"use strict";

const log = require("log4").get("dev-package")
, memoize = require("memoizee")
, runProgram = require("./run-program");
const { resolve } = require("path")
, log = require("log4").get("dev-package")
, memoize = require("memoizee")
, runProgram = require("./run-program");

module.exports = memoize(
async () => {
Expand All @@ -12,7 +13,7 @@ module.exports = memoize(
const [npmPathPrefix] = String(stdout).split("\n", 1);
if (!npmPathPrefix) throw new Error("Could not resolve npm path prefix");
log.notice("resolved npm path prefix %s", npmPathPrefix);
return `${ npmPathPrefix }/lib/node_modules`;
return resolve(npmPathPrefix, "lib", "node_modules");
},
{ promise: true }
);

0 comments on commit 9094fd5

Please sign in to comment.