const { execSync} = require('child_process');
const config = require('../package.json');

const args = process.argv[2]

// 执行命令并打印输出
function runCommand(name, local) {
    try {
        execSync(`node ./scripts/build/nodeBuild.js ${args} ${name}-${args}.zip ${local?'local':''}`, { stdio: 'inherit' });
    } catch (error) {
        console.error(`命令执行失败: ${error.message}`);
        process.exit(1);
    }
}

console.log(`----------------------------`)
console.log(`准备开始打包: ${config.buildName}`);

//打包官方版本
runCommand(config.buildName, false);

//打包本地模式版本
runCommand(config.buildName + '-local', true);

console.log(`----------------------------`)
console.log('全部编译打包完成')
