"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs-extra");
const path = require("path");
exports.getBlockNames = async (blocksDir) => {
    const fileNames = await fs.readdir(blocksDir);
    return fileNames;
    // const blockNames = fileNames.filter(fileName => {
    //   const filePath = path.join(blocksDir, fileName);
    //   return fs.statSync(filePath).isDirectory();
    // });
    // return blockNames;
};
exports.fetchPackage = async (dir) => {
    const packagePath = path.join(dir, 'package.json');
    if (fs.statSync(packagePath).isFile()) {
        const result = await fs.readFile(packagePath, 'utf8');
        return JSON.parse(result);
    }
    else {
        return {};
    }
};
// const fetchPackage = async (blockName) => {
//   const blocktPath = path.join(blocksDir, blockName);
//   const packagePath = path.join(blocktPath, 'package.json');
//   const result = await fs.readFile(packagePath, 'utf8');
//   return JSON.parse(result);
// }
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZVV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbC9maWxlVXRpbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLCtCQUErQjtBQUMvQiw2QkFBNkI7QUFHaEIsUUFBQSxhQUFhLEdBQUcsS0FBSyxFQUFFLFNBQWlCLEVBQXFCLEVBQUU7SUFDMUUsTUFBTSxTQUFTLEdBQUcsTUFBTSxFQUFFLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQzlDLE9BQU8sU0FBUyxDQUFDO0lBQ2pCLG9EQUFvRDtJQUNwRCxxREFBcUQ7SUFDckQsZ0RBQWdEO0lBQ2hELE1BQU07SUFDTixxQkFBcUI7QUFDdkIsQ0FBQyxDQUFBO0FBRVksUUFBQSxZQUFZLEdBQUcsS0FBSyxFQUFFLEdBQVcsRUFBRSxFQUFFO0lBQ2hELE1BQU0sV0FBVyxHQUFHLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxFQUFFLGNBQWMsQ0FBQyxDQU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