1
0
mirror of https://github.com/thangisme/notes.git synced 2024-09-27 08:05:54 -04:00
notes/node_modules/stylelint/lib/utils/getModulePath.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

19 lines
545 B
JavaScript

/* @flow */
"use strict"
const configurationError = require("./configurationError")
const resolveFrom = require("resolve-from")
module.exports = function (basedir/*: string*/, lookup/*: string*/)/*: string*/ {
// First try to resolve from the provided directory,
// then try to resolve from process.cwd.
let path = resolveFrom(basedir, lookup)
if (!path) {
path = resolveFrom(process.cwd(), lookup)
}
if (!path) {
throw configurationError(`Could not find "${lookup}". Do you need a \`configBasedir\`?`)
}
return path
}