1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-01 05:37:16 -04:00
notes/node_modules/stylelint/lib/utils/getModulePath.js

19 lines
545 B
JavaScript
Raw Normal View History

2017-03-09 13:16:08 -05:00
/* @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
}