import { existsSync, opendirSync } from 'fs';
import { extname, basename } from 'path';
export function getEntitiesFromDir(configDir) {
    if (!existsSync(configDir)) {
        return [];
    }
    const dir = opendirSync(configDir);
    const entityNames = [];
    let dirent = dir.readSync();
    while (dirent !== null) {
        const extension = extname(dirent.name);
        if (dirent.isFile() && extension === '.json') {
            entityNames.push(basename(dirent.name, extension));
        }
        dirent = dir.readSync();
    }
    dir.closeSync();
    return entityNames;
}
