UNPKG

418 BJavaScriptView Raw
1import { realpathSync } from "fs";
2import { handleError } from "./error";
3
4export default function(configFile) {
5 configFile = realpathSync(configFile);
6
7 return Promise.resolve(require(configFile)).then(config => {
8 if (Object.keys(config).length === 0) {
9 handleError({
10 code: "MISSING_CONFIG",
11 message: "Config file must export an options object"
12 });
13 }
14 return config;
15 });
16}