"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ansi_colors_1=require("ansi-colors"),fs_1=require("fs"),path_1=require("path"),rxjs_1=require("rxjs"),operators_1=require("rxjs/operators"),utils_1=require("../../../../lib/utils");function default_1(e){var i=e.params||{},r=e.options||{},e=utils_1.getRuntime(),o=e.workspaceRoot,a=e.workspaceConfig;if(!o)throw Error("请在 NgCortex 工程目录中操作！");r={fileName:utils_1.getSeparatorCase(i.name),prefix:r.prefix?utils_1.getSeparatorCase(r.prefix):"lib"};rxjs_1.zip(utils_1.src("./**/*",{base:path_1.join(__dirname,"./files")}).pipe(utils_1.transform(function(e){e.path="frontends/"+e.path})),utils_1.src("./**/*",{base:path_1.join(__dirname,"./mock-files")}).pipe(utils_1.transform(function(e){e.path="mock/"+e.path}))).pipe(operators_1.map(function(e){return[].concat.apply([],e)})).pipe(utils_1.ejs(r)).pipe(utils_1.dest(o,{workspaceRoot:o,log:!0})).subscribe(function(){var e=utils_1.getSeparatorCase(i.name),r=o+"/resources/resource.json",s=require(r);s[e]||(s[e]={type:"frontend",origin:"https://dev.grandbay.cloud/"+a.name+"/"+e},t=JSON.stringify(s,null,"  ")+"\n",fs_1.writeFileSync(r,t),utils_1.changeFileLog(ansi_colors_1.cyan("已更新"),r,o));var t=o+"/resources/resource.mock.json",r=require(t);r[e]||(r[e]={type:"frontend",origin:{remote:"https://dev.grandbay.cloud/"+a.name+"/"+e,local:"../mock/"+e}},r=JSON.stringify(r,null,"  ")+"\n",fs_1.writeFileSync(t,r),utils_1.changeFileLog(ansi_colors_1.cyan("已更新"),t,o))})}exports.default=default_1;
