"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var path_1=require("path"),utils_1=require("../../../../lib/utils");function default_1(e){var t,r,a=e.params||{},s=e.options||{},o=utils_1.getEnvironment(),i=o.workspaceRoot,n=o.frontendRoot,l=o.frontendType,p=o.angularJSON,e=o.libraryRoot;if(!i)throw Error("请在 NgCortex 工程目录中操作！");if(!n)throw new Error("请在前端项目目录中操作！");if("frontend"===l)t=path_1.join(n,"src/app");else{if(!e)throw new Error("请在库项目目录中操作！");t=path_1.join(e,"src")}try{r=p.schematics["@schematics/angular:component"].prefix}catch(e){}l=(r=r||("frontend"===l?"app":"lib"))+"-"+utils_1.getSeparatorCase(a.name),l={getPascalCase:utils_1.getPascalCase,getSeparatorCase:utils_1.getSeparatorCase,name:a.name,selector:s.selector?utils_1.getSeparatorCase(s.selector):l};process.chdir(__dirname),utils_1.src("./**/*",{base:"./files"}).pipe(utils_1.ejs(l)).pipe(utils_1.dest(t,{workspaceRoot:i,log:!0})).subscribe(function(e){e=e.filter(function(e){return".ts"===e.extname}).map(function(e){return e.fullPath});utils_1.appendLibraryExports(o,e)})}exports.default=default_1;
