async function main()

in ide/deploy/index.js [48:100]


async function main() {

    const pid = process.pid;


    process.on('SIGTERM', signalHandler);
    const pidfile = expanduser('~/.ops/tmp/deploy.pid');
    console.log('PID', pid);

    mkdirSync(expanduser('~/.ops/tmp'), {recursive: true});
    writeFileSync(pidfile, pid.toString());

    program
        .description('Deployer')
        .argument('<directory>', 'The mandatory first argument')
        .option('-n, --dry-run', 'Dry Run')
        .option('-f, --fast', 'Fast deploy mode')
        .option('-d, --deploy', 'Deploy')
        .option('-w, --watch', 'Watch for changes')
        .option('-s, --single <string>', 'Deploy a single action, either a single file or a directory.', '')
        .parse(process.argv);

    const options = program.opts();
    const directory = program.args[0];

    setDryRun(options.dryRun);
    process.chdir(directory);

    if (options.watch) {
        checkPort();
        if (!options.fast) {
            await scan();
            await build();
        }
        watchAndDeploy();
    } else if (options.deploy) {
        await scan();
        await build();
    } else if (options.single !== '') {
        let action = options.single;
        if (!action.startsWith('packages/')) {
            action = `packages/${action}`;
        }
        if (!existsSync(action)) {
            console.log(`action ${action} not found: must be either a file or a directory under packages`);
            return;
        }
        console.log(`Deploying ${action}`);
        await deploy(action);
    } else {
        program.help();
    }
}