"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FRAMEWORK_DEV_CONFIG = void 0;
exports.buildDevServerCommand = buildDevServerCommand;
/** Dev command + default port per framework. Single source of truth. */
exports.FRAMEWORK_DEV_CONFIG = {
    nextjs: { devCommand: 'dev', defaultPort: 3000 },
    vite: { devCommand: 'dev', defaultPort: 5173 },
    cra: { devCommand: 'start', defaultPort: 3000 },
    remix: { devCommand: 'dev', defaultPort: 3000 },
    svelte: { devCommand: 'dev', defaultPort: 5173 },
    static: { devCommand: '', defaultPort: 0 },
};
/**
 * Build the shell command to start a framework's dev server on a specific
 * port. Honors how each framework actually accepts a port:
 *   - CRA reads from the PORT env var (no CLI flag)
 *   - npm passes flags after `--` separator: `npm run dev -- --port N`
 *   - yarn / pnpm pass them inline: `yarn dev --port N`
 */
function buildDevServerCommand(framework, packageManager, devCommand, port) {
    if (framework === 'cra') {
        const args = packageManager === 'npm' ? ['run', devCommand] : [devCommand];
        return { cmd: packageManager, args, env: { PORT: String(port) } };
    }
    if (packageManager === 'npm') {
        return {
            cmd: 'npm',
            args: ['run', devCommand, '--', '--port', String(port)],
            env: {},
        };
    }
    if (packageManager === 'yarn') {
        return { cmd: 'yarn', args: [devCommand, '--port', String(port)], env: {} };
    }
    return { cmd: 'pnpm', args: [devCommand, '--port', String(port)], env: {} };
}
//# sourceMappingURL=devServerCommand.js.map