Files
mcb-platform-monorepo/packages/webpack-config/lib/cli/index.js
T
2025-06-17 11:01:37 +03:00

46 lines
1.8 KiB
JavaScript

#!/usr/bin/env node
"use strict";
/* eslint-disable sonarjs/no-identical-functions */
/* eslint-disable sonarjs/no-duplicate-string */
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const yargs_1 = __importDefault(require("yargs"));
const node_path_1 = __importDefault(require("node:path"));
const commands_1 = require("./commands");
const DEFAULT_CONFIG_FILE_PATH = node_path_1.default.resolve('webpack.config.ts');
yargs_1.default
.scriptName('build-app')
.command(['build'], 'Собрать приложение в production режиме', command => {
command.option('config', {
alias: 'c',
default: DEFAULT_CONFIG_FILE_PATH,
type: 'string',
description: 'Путь до конфигурационного файла webpack.config.ts',
});
}, argv => {
(0, commands_1.build)({ configPath: argv.config, mode: 'production' });
})
.command(['build:dev'], 'Собрать приложение в development режиме', command => {
command.option('config', {
alias: 'c',
default: DEFAULT_CONFIG_FILE_PATH,
type: 'string',
description: 'Путь до конфигурационного файла webpack.config.ts',
});
}, argv => {
(0, commands_1.build)({ configPath: argv.config, mode: 'development' });
})
.command(['start'], 'Запустить webpack-dev-server', command => {
command.option('config', {
alias: 'c',
default: DEFAULT_CONFIG_FILE_PATH,
type: 'string',
description: 'Путь до конфигурационного файла webpack.config.ts',
});
}, argv => {
(0, commands_1.start)({ configPath: argv.config });
})
.help().argv;