#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.server = void 0;
const commander_1 = require("commander");
const fs_1 = require("fs");
const path = require("path");
const path_1 = require("../path");
const serve_1 = require("./serve");
const packageJson = JSON.parse((0, fs_1.readFileSync)(path.join(path_1.PATH_UNIT, 'package.json')).toString());
const { version } = packageJson;
const program = new commander_1.Command();
program
    .version(version)
    .option('-p, --port <number>', 'Port to run unit server on');
program.parse(process.argv);
const options = program.opts();
const { port } = options;
/* eslint-disable no-console */
process.on('uncaughtException', function (err) {
    console.error(new Date().toUTCString() + ' uncaughtException:', err.message);
    console.error(err.stack);
    process.exit(1);
});
exports.server = (0, serve_1.serve)({ port });
//# sourceMappingURL=index.js.map