import { captureEvent } from "../common/analytics/lib.js";
import { identify } from "../common/middleware/user-identification.js";
import setBlocking from "../common/output.js";
import { ZuploProjectValidator } from "../common/validators/file-system-validator.js";
import { YargsChecker } from "../common/validators/lib.js";
import { compile } from "../compile/handler.js";
export default {
    desc: false,
    command: "compile",
    builder: (yargs) => {
        return yargs
            .option("dir", {
            type: "string",
            describe: "The directory containing your Zuplo API",
            default: ".",
            normalize: true,
            hidden: true,
        })
            .option("bundled-dir", {
            type: "string",
            describe: "The directory representing a built Zuplo API's sources. Use to skip build and bundling.",
            hidden: true,
        })
            .option("port", {
            type: "number",
            describe: "The port to run the Zuplo API server on",
            default: 9000,
        })
            .option("binary-name", {
            type: "string",
            describe: "The name of the binary",
            default: "compiled-zup",
        })
            .option("build-id", {
            type: "string",
            describe: "The buildId to use for remote assets",
            default: "",
            hidden: true,
        })
            .middleware([setBlocking, identify])
            .check(async (argv) => {
            if (argv["bundled-dir"]) {
                return true;
            }
            else {
                return await new YargsChecker(new ZuploProjectValidator()).check(argv);
            }
        });
    },
    handler: async (argv) => {
        await captureEvent({ argv, event: "zuplo compile" });
        await compile(argv);
    },
};
//# sourceMappingURL=compile.js.map