"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const fs = require("fs");
const path = require("path");
const chalk_1 = require("chalk");
function createDirTree(rootDir, dir, name) {
    console.log((0, chalk_1.blue)(`${name} was generated in src/pages/ like: `));
    console.log();
    const recur = (curDir) => {
        fs.readdirSync(curDir, { withFileTypes: true }).forEach((value) => {
            const childPath = path.join(curDir, value.name);
            const depth = childPath.replace(rootDir, '').split(path.sep).filter(Boolean).length;
            const isDirectory = value.isDirectory();
            const prefix = `${'|  '.repeat(depth - 4)}${isDirectory ? '+' : '|'}—— `;
            console.log((0, chalk_1.green)(`${prefix}${value.name}`));
            if (isDirectory) {
                recur(path.join(curDir, value.name));
            }
        });
    };
    recur(dir);
}
exports.default = createDirTree;
