#!/usr/bin/env ts-node

import * as dotenv from 'dotenv';

dotenv.config({ path: '.env' });

import colors from 'colors';
import glob from 'glob-promise'; // <- TODO: [🚰] Use just 'glob'
import { join } from 'path';

if (process.cwd() !== join(__dirname, '../..')) {
    console.error(colors.red(`CWD must be root of the project`));
    process.exit(1);
}

playground()
    .catch((error) => {
        console.error(colors.bgRed(error.name || 'NamelessError'));
        console.error(error);
        process.exit(1);
    })
    .then(() => {
        process.exit(0);
    });

async function playground() {
    console.info(`🧸  Playground`);

    // Do here stuff you want to test
    //========================================>

    const filesGlob = './**/*.book';
    const ignore = ['./book/**/*', './examples/**/*'];

    const filenames = await glob(filesGlob!, { ignore });

    console.log({ filesGlob, ignore, filenames });

    //========================================/
}

/** Note: [⚫] Code for archived playground [playground-glob.ts](src/playground/backup/playground-glob.ts.txt) should never be published in any package */
