Skip to content

Commit

Permalink
Make support for openDataContext for wegame which was mentioned in #44
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty472123 committed May 10, 2018
1 parent 29b6e6b commit 5084c78
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions wuWxapkg.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,15 @@ function packDone(dir,cb,order){
}else if(fs.existsSync(path.resolve(dir,"game.js"))){//wegame
console.log("Split game.js and rewrite game.json...");
let gameCfg=path.resolve(dir,"app-config.json");
wu.get(gameCfg,cfg=>{
wu.save(path.resolve(dir,"game.json"),JSON.stringify(JSON.parse(cfg),null,4));
wu.get(gameCfg,cfgPlain=>{
let cfg=JSON.parse(cfgPlain);
if(cfg.subContext){
console.log("Found subContext, splitting it...")
delete cfg.subContext;
let contextPath=path.resolve(dir,"subContext.js");
wuJs.splitJs(contextPath,()=>wu.del(contextPath));
}
wu.save(path.resolve(dir,"game.json"),JSON.stringify(cfg,null,4));
wu.del(gameCfg);
});
wuJs.splitJs(path.resolve(dir,"game.js"),()=>{
Expand Down

0 comments on commit 5084c78

Please # to comment.