Skip to content

Commit

Permalink
chore: fix global path lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
evenstensberg committed Nov 4, 2018
1 parent 2a43d44 commit cf450e4
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 140 deletions.
9 changes: 8 additions & 1 deletion bin/prompt-command.js
Expand Up @@ -34,13 +34,20 @@ module.exports = function promptForInstallation(packages, ...args) {
let pathForCmd;
try {
const path = require("path");
const fs = require("fs");
pathForCmd = path.resolve(
process.cwd(),
"node_modules",
"@webpack-cli",
packages
);
require.resolve(pathForCmd);
if (!fs.existsSync(pathForCmd)) {
const globalModules = require("global-modules");
pathForCmd = globalModules + "/@webpack-cli/" + packages;
require.resolve(pathForCmd);
} else {
require.resolve(pathForCmd);
}
packageIsInstalled = true;
} catch (err) {
packageIsInstalled = false;
Expand Down

0 comments on commit cf450e4

Please sign in to comment.