UNPKG

@oppo-minigame/cli

Version:

Command line interface for rapid OPPO minigame development

1 lines 936 B
const path=require("path"),fs=require("fs-extra"),chalk=require("chalk"),shell=require("shelljs"),packer=require("../pack"),CONFIG=require("../config/config"),COCOS_CONFIG=require("../config/cocos_v2"),{mkBuildDirs:mkBuildDirs,copyFiles:copyFiles,prePackWorker:prePackWorker}=require("../utils");async function generate(e="",r=!0,i=!1,s=!1,c){let o=process.cwd();e?path.isAbsolute(e)||(e=path.resolve(o,e)):e=path.join(o,COCOS_CONFIG.DEFAULT_PARENT_DIR,COCOS_CONFIG.DEFAULT_PUB_DIR),fs.existsSync(e)||(console.log(chalk.red(`[错误]指定的发布文件夹不存在:${e}`)),shell.exit(1));const a=prePackWorker(c,e);let l=mkBuildDirs(e,o,CONFIG,COCOS_CONFIG,"cocos",r,a),t=COCOS_CONFIG.EXCLUDE_FILES.map(e=>e);i&&t.push("res"),copyFiles(e,l.quickgameDir,COCOS_CONFIG.EXCLUDE_FILE_TYPE,t.map(r=>path.join(e,r))),await packer.signDir(null,l.quickgameDir,l.distDir,l.manifestJson.option,l.signFiles,r,s,"cocos")}module.exports=generate;