import { Args, Command } from '@oclif/core';
import path from 'path';
import { bundle, compileTs } from '../lib/bundler.js';
import { logger } from '../lib/logger.js';
export class Build extends Command {
    static args = {
        path: Args.string({
            description: 'The path where the extensions are located.',
            required: true,
        }),
    };
    static description = 'Build extensions for production deployment.';
    static examples = ['<%= config.bin %> <%= command.id %>'];
    static flags = {};
    /**
     * TODO: Currently, we're getting PATH via CLI arguments.
     * However, this information will later come from
     * the FastStore CLI when the developer runs a command like:
     * faststore build <account-name>. The remaining information will be
     * sourced from the faststore.config.json file.
     */
    async run() {
        const { args } = await this.parse(Build);
        const projectPath = path.resolve(args.path);
        logger.info('1. 🔎 Looking for type errors with TypeScript.');
        compileTs({ path: projectPath });
        logger.info('2. 📦  Building extensions for production deployment.');
        bundle({
            mode: 'production',
            path: projectPath,
        });
    }
}
//# sourceMappingURL=build.js.map