files .map(f => fs.readFileSync(`./handlers/${f}`, 'utf8')) .map(raw => YAML.parse(raw)) .reduce( (result, handler) => Object.assign(result, handler), {})
function loadYAMLFile(file) { return YAML.parse(fs.readFileSync(file).toString()); }
async load() { if (!await this.constructor.isLoadable(this.store)) { logger.error("[%s] package is not loadable or does not exist", JudeLoader.name); return null; } try { const cfg = YAML.parse(await this.store.getFileString(JUDE_FN)); return this.getTask(cfg); } catch (e) { logger.error("[%s] package could not be read or parsed", JudeLoader.name); logger.debug(e); return null; } }
/** * load config file which can be .js or .yml */ _loadConfigFile (dir, filename) { let content = util.loadFile(path.join(dir, `${filename}.js`), true) if (!content) { // load yaml content = util.loadFile(path.join(dir, `${filename}.yml`), true) content = (content && yaml.parse(content)) || {} } return this.injectApp(content) }
function loadYAMLFile(file) { return YAML.parse(fs.readFileSync(file).toString()); }