@oppo-minigame/cli
Version:
Command line interface for rapid OPPO minigame development
1 lines • 844 B
JavaScript
const path=require("path"),fs=require("fs-extra"),chalk=require("chalk"),shell=require("shelljs"),packer=require("../pack"),CONFIG=require("../config/config"),EGRET_CONFIG=require("../config/egret"),{mkBuildDirs:mkBuildDirs,copyFiles:copyFiles,prePackWorker:prePackWorker}=require("../utils");async function generate(e="",r=!0,i=!1,s){let a=process.cwd();e?path.isAbsolute(e)||(e=path.resolve(a,e)):e=path.resolve(a,"../",path.basename(a)+"_wxgame"),fs.existsSync(e)||(console.log(chalk.red(`[错误]指定的发布文件夹不存在:${e}`)),shell.exit(1));const l=prePackWorker(s,e);let t=mkBuildDirs(e,a,CONFIG,EGRET_CONFIG,"egret",r,l);copyFiles(e,t.quickgameDir,[],EGRET_CONFIG.EXCLUDE_FILES.map(r=>path.join(e,r))),await packer.signDir(null,t.quickgameDir,t.distDir,t.manifestJson.option,t.signFiles,r,i,"egret")}module.exports=generate;