initial
This commit is contained in:
45
scripts/slotgamekit.js
Executable file
45
scripts/slotgamekit.js
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const path = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
// Получаем подкоманду и дополнительные аргументы
|
||||
const [,, command, ...args] = process.argv;
|
||||
|
||||
// Функция для выполнения команды
|
||||
function runCommand(cmd) {
|
||||
try {
|
||||
execSync(`${cmd} ${args.join(' ')}`, { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.error(`Error running command: ${cmd}`);
|
||||
console.error(error.message);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// Определение пути к конфигурации
|
||||
const configs = {
|
||||
dev: path.resolve(__dirname, '../bundler/webpack.dev.js'),
|
||||
prod: path.resolve(__dirname, '../bundler/webpack.prod.js'),
|
||||
staging: path.resolve(__dirname, '../bundler/webpack.staging.js'),
|
||||
};
|
||||
|
||||
// Обработка подкоманд
|
||||
switch (command) {
|
||||
case 'dev':
|
||||
runCommand(`webpack --config ${configs.dev}`);
|
||||
break;
|
||||
case 'prod':
|
||||
runCommand(`webpack --config ${configs.prod}`);
|
||||
break;
|
||||
case 'staging':
|
||||
runCommand(`webpack --config ${configs.staging}`);
|
||||
break;
|
||||
case 'watch':
|
||||
runCommand(`webpack serve --config ${configs.dev}`);
|
||||
break;
|
||||
default:
|
||||
console.error(`Unknown command: ${command}`);
|
||||
console.error('Available commands: dev, prod, staging, watch');
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user