build.js 759 B

1234567891011121314151617181920212223242526
  1. const { execSync} = require('child_process');
  2. const config = require('../package.json');
  3. const args = process.argv[2]
  4. // 执行命令并打印输出
  5. function runCommand(name, local) {
  6. try {
  7. execSync(`node ./scripts/build/nodeBuild.js ${args} ${name}-${args}.zip ${local?'local':''}`, { stdio: 'inherit' });
  8. } catch (error) {
  9. console.error(`命令执行失败: ${error.message}`);
  10. process.exit(1);
  11. }
  12. }
  13. console.log(`----------------------------`)
  14. console.log(`准备开始打包: ${config.buildName}`);
  15. //打包官方版本
  16. runCommand(config.buildName, false);
  17. //打包本地模式版本
  18. runCommand(config.buildName + '-local', true);
  19. console.log(`----------------------------`)
  20. console.log('全部编译打包完成')