/**
 * Minified by jsDelivr using Terser v5.37.0.
 * Original file: /npm/frontengineerplugin@0.1.31/project.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
#!/usr/bin/env node
const execSync=require("child_process").execSync,path=require("path"),handleEvent=require(path.join(__dirname,"util","handleEvent")),fs=require("fs"),{program:program}=require("commander"),inquirer=require("inquirer"),ora=require("ora"),chalk=require("chalk"),log=e=>console.log(`frontengineerplugin - ${e}`);let[,,cmd,...args]=process.argv;cmd||(log("script 中 添加 frontengineerplugin gui 运行 | 或者直接运行 frontengineerplugin gui "),process.exit(1)),cmd=cmd.toLowerCase(),args.map((e=>e.toLowerCase()));const cmdGroup={install:()=>{args.includes("husky")&&handleEvent.gitFn(),args.includes("eslint")&&handleEvent.eslintFn(),args.includes("prettier")&&handleEvent.prettierFn(),args.includes("npm")&&handleEvent.npmFn(),args.includes("env")&&handleEvent.envFn(),args.includes("cicd")&&handleEvent.CICDFn(),args.includes("cor")&&handleEvent.corFn()},gui:()=>{guiFn({gitFn:handleEvent.gitFn,eslintFn:handleEvent.eslintFn,prettierFn:handleEvent.prettierFn,npmFn:handleEvent.npmFn,envFn:handleEvent.envFn,CICDFn:handleEvent.CICDFn,corFn:handleEvent.corFn,testFn:handleEvent.testFn,readmeFn:handleEvent.readmeFn})},"-v":()=>{log(require(path.join(__dirname,"package.json")).version)}};try{cmdGroup[cmd]?cmdGroup[cmd]():help(0)}catch(e){console.error(e instanceof Error?`frontengineerplugin - ${e.message}`:e),process.exit(1)}function guiFn({gitFn:e,prettierFn:n,eslintFn:r,npmFn:s,envFn:i,CICDFn:t,corFn:c,testFn:o,readmeFn:a}){let l=require(path.join(__dirname,"package.json")).version;program.version(l).command("gui").description("Electrolux 的 工程化配置").action((l=>{inquirer.prompt([{type:"checkbox",name:"useChoices",pageSize:20,message:"前端工程化配置选项：",choices:[{name:"git(husky) | 提交规范"},{name:"prettier | 代码美化工具"},{name:"eslint | 代码统一工具"},{name:"npm_source | 代码源管理"},{name:"test dev pro | 环境区分"},{name:"CICD | 各种脚本示例"},{name:"Test case | jest 通用测试用例"},{name:"cors | nginx && express(写plugin的工具)"},{name:"README | 生成标准格式的README"}]}]).then((async l=>{const u=ora("工程化配置中^.^ \n");if(u.start(),execSync("npm install chalk@4 commander@9 inquirer@7 ora@4 -D"),l.useChoices.includes("prettier | 代码美化工具")&&n(),l.useChoices.includes("eslint | 代码统一工具")&&r(),l.useChoices.includes("npm_source | 代码源管理")&&s(),l.useChoices.includes("git(husky) | 提交规范")&&e(),l.useChoices.includes("test dev pro | 环境区分")&&i(),l.useChoices.includes("CICD | 各种脚本示例")&&t(),l.useChoices.includes("cors | nginx && express(写plugin的工具)")&&c(),l.useChoices.includes("Test case | jest 通用测试用例")&&o(),l.useChoices.includes("README | 生成标准格式的README")){let e=await a();console.log(chalk.green("frontengineerplugin - ",e)+"\n")}console.log(chalk.grey('package.json中可以添加如下字段\n"label":[\n  {\n    "frontName": "Bili",\n    "behindName": "Electrolux",\n    "src": "https://space.bilibili.com/286773126",\n    "color": "pink"\n  }\n]\n')),fs.existsSync(path.resolve(process.cwd(),".gitignore"))||(console.log(".gitignore 不存在 | 自动帮你添加"),fs.writeFileSync(path.resolve(process.cwd(),".gitignore"),JSON.stringify("node_modules",null,"\t"))),u.succeed(),console.log(chalk.green("success! 项目初始化成功 - 使用请参考 https://www.npmjs.com/package/frontengineerplugin | https://gitee.com/electrolux/front-engineer-plugin")+"\n")}))})),program.parse(process.argv)}
//# sourceMappingURL=/sm/3256e6e71a6420af8de52408edfa048a5a335fdc871cab29af4b97bfb91ba527.map