alapa
Version:
A cutting-edge web development framework designed to revolutionize the way developers build modern web applications.
22 lines (21 loc) • 897 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildSchema = void 0;
const globals_1 = require("../../../shared/globals");
const utils_1 = require("../../../utils");
const get_files_1 = require("./get-files");
const buildSchema = async () => {
const directoryPath = globals_1.GlobalConfig.api.docs?.dir || "docs";
const yamlFiles = await (0, get_files_1.getYamlFiles)(directoryPath);
let schema = {};
// Use Promise.all to handle multiple async operations concurrently
const promises = yamlFiles.map(async (file) => {
const data = await (0, utils_1.loadYaml)(file);
schema = { ...schema, ...data };
});
// Wait for all promises to resolve
await Promise.all(promises);
console.log(schema); // Now the schema will be updated after all async operations
return schema;
};
exports.buildSchema = buildSchema;
;