UNPKG

@oppo-minigame/cli

Version:

Command line interface for rapid OPPO minigame development

1 lines 869 B
const path=require("path"),fs=require("fs-extra"),chalk=require("chalk"),shell=require("shelljs"),packer=require("../pack"),CONFIG=require("../config/config"),LAYA_CONFIG=require("../config/laya"),{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.join(a,LAYA_CONFIG.DEFAULT_PARENT_DIR,LAYA_CONFIG.DEFAULT_WECHAT_GAME_DIR),fs.existsSync(e)||(console.log(chalk.red(`[错误]指定的发布文件夹不存在:${e}`)),shell.exit(1));const l=prePackWorker(s,e);let c=mkBuildDirs(e,a,CONFIG,LAYA_CONFIG,"laya",r,l);copyFiles(e,c.quickgameDir,[],LAYA_CONFIG.EXCLUDE_FILES.map(r=>path.join(e,r))),await packer.signDir(null,c.quickgameDir,c.distDir,c.manifestJson.option,c.signFiles,r,i,"laya")}module.exports=generate;