You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
raqb/src/load-configuration.js

21 lines
580 B
JavaScript

"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`);
}
});
};