import { dirname, join } from 'path';
import findFileInCurrentPath from '../fs/findFileInCurrentPath.js';
import loadJsonFile from '../fs/loadJsonFile.js';
export default async function getDrupalInfo() {
    try {
        const path = findFileInCurrentPath('composer.json');
        if (!path) {
            return undefined;
        }
        const json = await loadJsonFile(path);
        if (json && json.extra?.['drupal-scaffold']?.locations?.['web-root']) {
            const root = join(dirname(path), json.extra['drupal-scaffold'].locations['web-root']);
            return {
                root,
                name: 'drupal',
                emulsifyParentDirectory: join(root, 'themes', 'custom'),
                platformMajorVersion: 11,
            };
        }
    }
    catch {
        return undefined;
    }
    return undefined;
}
