#!/usr/bin/env node
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/* eslint-disable import/first -- 本文件禁用，要在入口最前面注册别名，后面的 import 才能使用别名；另外要先加载 dotenv，才能创建 redis 连接 */
const path_1 = tslib_1.__importDefault(require("path"));
const module_alias_1 = tslib_1.__importDefault(require("module-alias"));
module_alias_1.default.addAliases({
    '@': __dirname,
});
const yargs_1 = tslib_1.__importDefault(require("yargs"));
const dotenv_1 = tslib_1.__importDefault(require("dotenv"));
dotenv_1.default.config({ path: path_1.default.join(__dirname, './.env') });
require("@/utils/aegis");
const app_dev_1 = require("@/app-dev");
const webpack_1 = require("@/utils/webpack");
const log_1 = require("@/utils/log");
const package_json_1 = require("../package.json");
require("./process-handler");
const { argv } = yargs_1.default
    .alias('v', 'version')
    .describe('v', 'show version information ')
    .alias('h', 'help')
    .alias('c', 'config')
    .demand('config')
    .help()
    .version()
    .option('config', {
    type: 'string',
    default: '',
    describe: 'webpack config file ',
})
    .epilog(`Copyright (C) 2017-${new Date().getFullYear()} THL A29 Limited, a Tencent company.`);
const fullArgv = argv;
if (fullArgv.help)
    yargs_1.default.showHelp().exit(0, null);
if (fullArgv.version)
    yargs_1.default.version().exit(0, null);
const log = new log_1.Logger('entry');
log.info('version: %s', package_json_1.version);
(async () => {
    log.info('start dev argv: %j', fullArgv);
    const webpackConfig = await webpack_1.getWebpackConfig(fullArgv.config);
    app_dev_1.webpack(webpackConfig);
})();
