UNPKG

@honor-minigame/cli

Version:

honor minigame pack cli

41 lines (34 loc) 1.4 kB
import path from 'path' import chalk from 'chalk' import { fileURLToPath } from 'url' import { execSync } from 'child_process' import { _transfer } from '../weixin/index.js' import * as paths from '../packager/lib/paths.js' import { info } from '../utils/logger.js' import { build } from '../packager/index.js' export async function transferAction(param = 'debug', target) { const qgGamePath = await _transfer(target) // 切换到转换后的目录下 process.chdir(qgGamePath) paths.updateProject(qgGamePath) try { info(chalk.blueBright(`\n###开始自动进行build打包,rpk包体将打包到${paths.DIST}目录下`)) const q = false build({ dist: paths.DIST, isRelease: param === 'release', amd: true, complete: () => { info(chalk.blueBright('\n \n###build打包完成')) // if (q) { // info(chalk.blueBright('\n \n ###build打包完成,生成相应的二维码,可用调试器进行扫码安装')) // // initServer() // } else { // info(chalk.blueBright('\n \n###build打包完成,若需要打包后直接生成二维码,则可运行命令 qg transfer -q, -q命令表示转换且打包完成时,直接生成二维码')) // } } }) } catch (error) { console.error(`build 任务执行失败:${error.message}`) } }