"use strict"; const Promise = require("bluebird"); const findUp = require("find-up"); module.exports = function loadConfiguration(basePath) { return Promise.try(() => { return findUp("zapfile.js", { cwd: basePath }); }).then((configurationPath) => { if (configurationPath != null) { return { configurationPath: configurationPath, configuration: require(configurationPath) }; } else { // FIXME: Link to configuration documentation throw new Error(`Unable to find a zapfile; make sure that you've created one in the root of your project`); } }); };