text: #!/usr/bin/env node
  /*!
  io-arc
  WEB/PWA/SPA boilerplate CLI
  
  Version: 1.0.2
  License: ISC
  
  Repository: https://github.com/io-arc/io-arc
  Documents: https://io-arc.tech/
  
  Copyright (c) 2020-2021 arc one
  */
  "use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("commander"),s=require("kleur"),n=e(require("update-notifier")),r=e(require("fs")),i=e(require("make-dir")),a=e(require("path")),o=e(require("cpx")),c=e(require("inquirer")),p=require("child_process");const l={"@io-arc/types":"^1.0.0","@types/cpx":"^1.5.1","@types/inquirer":"^6.5.0","@types/update-notifier":"^4.1.0","cross-env":"^7.0.2","npm-run-all":"^4.1.5",webpack:"^4.43.0","webpack-cli":"^4.7.2"};var u,h,d={name:"@io-arc/cli",version:"1.0.2",description:"WEB/PWA/SPA boilerplate CLI",keywords:["web","pwa","spa","boilerplate","cli","html","css","javascript","pug","sass","scss","stylus","babel","typescript","manifest","serviceworker"],author:"arc one",homepage:"https://io-arc.tech/",license:"ISC",main:"",directories:{bin:"bin",lib:"lib",test:"tests"},files:["bin"],publishConfig:{access:"public"},repository:{type:"git",url:"https://github.com/io-arc/io-arc.git"},scripts:{prebuild:"eslint lib/*.ts",build:"rollup -c",io:"io-arc"},bin:{"io-arc":"bin/index.js"},dependencies:{commander:"^5.1.0",cpx:"^1.5.0",inquirer:"8.1.2",json2yaml:"^1.1.0",kleur:"^3.0.3","make-dir":"^3.1.0",rxjs:"^6.5.5","update-notifier":"^4.1.0"},devDependencies:l},m=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class g{constructor(){u.set(this,[10,17,0]),h.set(this,[0,0,0]);const e=process.versions.node.split(".");for(let t=0;t<0;t++)m(this,h)[t]=parseFloat(e[t])||0}check(){return m(this,u).every(((e,t)=>e>=m(this,h)[t]))}fail(){console.log(s.red("Please Node.js version update.")),console.log(s.blue(`Require: >= ${m(this,u).join(".")}\nYour version: ${process.versions.node}`)),console.log(s.green("Bye !")),process.exit(1)}}u=new WeakMap,h=new WeakMap;const w=(e,t)=>{console.log(s.red(`Oops X(\nFile create failed for ${e}`)),t&&console.error(t)},f=e=>{/{(.*)}/.test(e)?(e=>{const t=e.indexOf("{"),n=e.indexOf("}"),r=e.substr(0,t),i=e.substr(n+1);e.substr(t+1,n-2).split(",").forEach((e=>{console.log(s.white("File create completed for ")+s.green(r+e+i))}))})(e):/\*\*$/.test(e)?(e=>{const t=e.replace("/**","");console.log(s.white("File create completed for ")+s.green(t))})(e):console.log(s.white("File create completed for ")+s.green(e))},y=require("json2yaml");class b{async create(e,t){const s=`config/${e}.yml`,n=y.stringify(t).replace(/^---(\n|\r|\n\r)/g,"").replace(/^\s{2}/gm,"");await i(a.dirname(s));try{r.writeFileSync(s,n),f(s)}catch(e){w(s,e)}}}var v,k=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},j=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class E extends b{constructor(e,t,s,n,r){super(),v.set(this,void 0),k(this,v,{title:e,url:t,author:s,description:n,siteRoot:r})}async create(){await super.create("default",j(this,v)),await super.create("development",{type:"development"}),await super.create("production",{type:"production"})}}v=new WeakMap;var M,$,D=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},S=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};const x=`${a.dirname(__filename)}/template`;class W{constructor(){M.set(this,void 0),$.set(this,(async e=>{const t=this.workingSpace();await Promise.all(e.map((async e=>{await i(`${t}/${e}`)})))})),D(this,M,[{source:`${x}/.{editorconfig,gitignore,npmrc,browserslistrc}`,output:""},{source:`${x}/webpack.extends.js`,output:"config",logValue:"webpack.extends.js"}])}workingSpace(){return"src"}add(e){if(0===e.length)return;const t=[];D(this,M,[...S(this,M),...e].filter((e=>{if(0===t.length)return t.push(e),e;return!!t.every((t=>t.source!==e.source||t.output!=t.output))&&(t.push(e),e)})))}async create(e){await S(this,$).call(this,e),S(this,M).forEach((e=>{o.copySync(e.source,e.output);const t=e.logValue||e.source.split("/").pop(),s=/(.+)/.test(e.output)?/\/$/.test(e.output)?e.output+t:`${e.output}/${t}`:t;f(s)}))}}M=new WeakMap,$=new WeakMap;class T{startLog(e){console.log(s.bold().green(`# ${e}`))}fail(){console.log(s.red("Oops X(")),process.exit(1)}}const q="^1.5.1";var L,P,O,I,R,N,B=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},V=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};const A="html",C="pug",F="html",_="php";class J extends T{constructor(){super(...arguments),L.set(this,A),P.set(this,F),O.set(this,!1),I.set(this,(async e=>{if("html"===e)return;const t=await c.prompt({type:"list",name:"ext",message:"Build file extension",choices:[{name:".html",value:F},{name:".php",value:_}]}).catch((e=>(console.error(e),1)));"number"!=typeof t?B(this,P,t.ext):this.fail()})),R.set(this,(e=>[{source:`${x}/html/README.md`,output:`src/${e}`},{source:`${x}/html/index.html`,output:`src/${e}`}])),N.set(this,(e=>{const t=[{source:`${x}/pug/README.md`,output:`src/${e}`},{source:`${x}/.pug-lintrc.json`,output:""}];return V(this,O)?t.push({source:`${x}/pug/assets/**`,output:`src/${e}/assets`,logValue:"assets"},{source:`${x}/pug/index.pug`,output:`src/${e}`}):t.push({source:`${x}/pug/no-template/index.pug`,output:`src/${e}`}),t}))}engine(){return V(this,L)}ext(){return V(this,P)}isPug(){return V(this,L)===C}async questions(){this.startLog("Select HTML template engine");const e=await c.prompt({type:"list",name:"engine",message:"Template engine",choices:[{name:"None (Vanilla HTML)",value:A},{name:"Pug",value:C}]}).catch((e=>(console.error(e),1)));"number"!=typeof e?(B(this,L,e.engine),await V(this,I).call(this,e.engine)):this.fail()}taskLibrary(){switch(V(this,L)){case A:return"@io-arc/task-webpack-html";case C:return"@io-arc/task-webpack-pug";default:return null}}dependencies(){return V(this,L)!==C?null:{"@prettier/plugin-pug":q}}async createTemplateQuestion(){const e=(()=>{switch(V(this,L)){case A:return"HTML";case C:return"Pug";default:return""}})();if(V(this,L)!==C)return;const t=await c.prompt({type:"confirm",name:"template",message:`${e} template create?`,default:!1}).catch((e=>(console.error(e),1)));"number"!=typeof t?B(this,O,t.template):this.fail()}template(e){switch(V(this,L)){case A:return V(this,R).call(this,e);case C:return V(this,N).call(this,e);default:return[]}}}L=new WeakMap,P=new WeakMap,O=new WeakMap,I=new WeakMap,R=new WeakMap,N=new WeakMap;const G={"@babel/core":"^7.9.6","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-proposal-private-methods":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-transform-template-literals":"^7.8.3","@babel/preset-env":"^7.9.6",eslint:"^7.6.0","eslint-config-prettier":"^6.11.0","eslint-config-standard":"^14.1.1","eslint-plugin-babel":"^5.3.0","eslint-plugin-import":"^2.20.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.1","eslint-plugin-vue":"^6.2.2","node-sass":"^4.14.0",prettier:"^2.0.5",pug:"^3.0.0",stylus:"^0.54.7",vue:"^2.6.11",webpack:"^4.43.0","webpack-cli":"^4.7.2"},H={"@types/config":"^0.0.36","@types/node":"^13.13.4","@typescript-eslint/eslint-plugin":"^2.30.0","@typescript-eslint/parser":"^2.30.0",eslint:"^7.6.0","eslint-config-prettier":"^6.11.0","eslint-loader":"^4.0.2","eslint-plugin-prettier":"^3.1.3","eslint-plugin-vue":"^6.2.2",prettier:"^2.0.5",pug:"^3.0.0",stylus:"^0.54.7",vue:"^2.6.11",webpack:"^4.43.0","webpack-cli":"^4.7.2"},U={"@types/config":"^0.0.36","@types/node":"^13.13.4","@typescript-eslint/eslint-plugin":"^2.30.0","@typescript-eslint/parser":"^2.30.0",eslint:"^7.6.0","eslint-config-prettier":"^6.11.0","eslint-loader":"^4.0.2","eslint-plugin-prettier":"^3.1.3",prettier:"^2.0.5","ts-node":"^8.9.1",webpack:"^4.43.0","webpack-cli":"^4.7.2"},Q={"@babel/core":"^7.9.6","@babel/plugin-proposal-class-properties":"^7.8.3","@babel/plugin-proposal-private-methods":"^7.8.3","@babel/plugin-syntax-dynamic-import":"^7.8.3","@babel/plugin-transform-template-literals":"^7.8.3","@babel/preset-env":"^7.9.6","babel-eslint":"^10.1.0",eslint:"^7.6.0","eslint-config-prettier":"^6.11.0","eslint-config-standard":"^14.1.1","eslint-plugin-babel":"^5.3.0","eslint-plugin-import":"^2.20.2","eslint-plugin-node":"^11.1.0","eslint-plugin-promise":"^4.2.1","eslint-plugin-standard":"^4.0.1",prettier:"^2.0.5",webpack:"^4.43.0","webpack-cli":"^4.7.2"},X={node:">= 10.17.0",npm:">= 5.8.0",yarn:">= 1.7.0"},Y="7.6.0",z="6.10.0",K="^2.0.5",Z="8.8.2",ee="3.8.3";var te,se,ne,re,ie=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},ae=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s};const oe="typescript",ce="babel",pe="none",le="vue";class ue extends T{constructor(){super(...arguments),te.set(this,oe),se.set(this,pe),ne.set(this,(e=>{const t=[],s=ie(this,se)===le?"vue":"babel";return t.push({source:`${x}/lint/js/${s}/.eslintrc.yml`,output:""},{source:`${x}/.babelrc`,output:""},{source:`${x}/js/README.md`,output:`src/${e}`}),ie(this,se)===le&&t.push({source:`${x}/config-vue/.pug-lintrc.json`,output:"config-vue"}),t})),re.set(this,(e=>{const t=[],s=ie(this,se)===le?"vue-ts":"ts";return t.push({source:`${x}/lint/js/${s}/.eslintrc.yml`,output:""},{source:`${x}/tsconfig.json`,output:""},{source:`${x}/ts/README.md`,output:`src/${e}`}),ie(this,se)===le&&t.push({source:`${x}/config-vue/.pug-lintrc.json`,output:"config-vue"}),t}))}preprocessor(){return ie(this,te)}framework(){return ie(this,se)}async questions(){this.startLog("Select JavaScript preprocessor");const e=await c.prompt([{type:"list",name:"preprocessor",message:"JavaScript preprocessor",choices:[{name:"TypeScript",value:oe},{name:"Babel",value:ce}]},{type:"list",name:"framework",message:"Use framework",choices:[{name:"None",value:pe},{name:"Vue.js",value:le}]}]).catch((e=>(console.error(e),1)));"number"!=typeof e?(ae(this,te,e.preprocessor),ae(this,se,e.framework)):this.fail()}taskLibrary(){if(ie(this,se)===le)switch(ie(this,te)){case oe:return"@io-arc/task-webpack-vue-typescript";case ce:return"@io-arc/task-webpack-vue";default:return null}else switch(ie(this,te)){case oe:return"@io-arc/task-webpack-typescript";case ce:return"@io-arc/task-webpack-babel";default:return null}}dependencies(){let e={};if(ie(this,se)===le)switch(ie(this,te)){case oe:e={...e,...H};break;case ce:e={...e,...G}}switch(ie(this,te)){case oe:e={...e,...U,typescript:ee,"ts-node":Z};break;case ce:e={...e,...Q}}return e}template(e){switch(ie(this,te)){case oe:return ie(this,re).call(this,e);case ce:return ie(this,ne).call(this,e);default:return[]}}}te=new WeakMap,se=new WeakMap,ne=new WeakMap,re=new WeakMap;var he,de=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},me=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class ge extends b{constructor(e){super(),he.set(this,void 0),de(this,he,{outputDir:"dist",wsDir:{static:"static",html:"html",css:"css",js:"js",img:"img",yaml2json:"yaml2json"},deployDir:e,options:{css:{postcss:{mqpacker:!0}},js:{splitFilename:"asset",eslint:".eslintrc.yml"},fileLoader:{html:{use:!0,hash:!0,target:[{tag:"img",attribute:"src",type:"src"},{tag:"img",attribute:"srcset",type:"srcset"},{tag:"img",attribute:"data-src",type:"src"},{tag:"img",attribute:"data-srcset",type:"srcset"},{tag:"source",attribute:"src",type:"src"}]},css:{use:!0,hash:!0},js:{use:!0,hash:!0}}}})}workingDirectories(){const e=[];return Object.keys(me(this,he).wsDir).forEach((t=>{e.push(me(this,he).wsDir[t])})),e}pugToPHP(e,t,s){e===C&&(me(this,he).options.pug={php:t===_,lint:".pug-lintrc.json"}),s===le&&(void 0===me(this,he).options.pug&&(me(this,he).options.pug={}),me(this,he).options.pug.vuePugLint="config-vue/.pug-lintrc.json")}tsconfig(e){e===oe&&(me(this,he).options.js.tsconfig="tsconfig.json")}jsFramework(e){e!==le||(me(this,he).options.fileLoader.vue={use:!0,loader:{video:["src","poster"],source:"src",img:"src"}})}webp(e){me(this,he).options.webp=e}wsHTML(){return me(this,he).wsDir.html}wsCSS(){return me(this,he).wsDir.css}wsJS(){return me(this,he).wsDir.js}wsImg(){return me(this,he).wsDir.img}wsStatic(){return me(this,he).wsDir.static}async create(){await super.create("local",me(this,he)),await super.create("local-development",{options:{html:{minify:!1},css:{minify:!1},js:{minify:!1,sourceMap:!0},json:{minify:!1}}}),await super.create("local-production",{options:{html:{minify:!0},css:{minify:!0},js:{minify:!0,terser:{parallel:!0,extractComments:!1,terserOptions:{compress:{drop_console:!0}}},sourceMap:!1},json:{minify:!0}}})}template(){return[{source:`${x}/img/README.md`,output:`src/${me(this,he).wsDir.img}`},{source:`${x}/static/README.md`,output:`src/${me(this,he).wsDir.static}`},{source:`${x}/yaml2json/README.md`,output:`src/${me(this,he).wsDir.yaml2json}`}]}}he=new WeakMap;var we,fe=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},ye=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class be{constructor(){we.set(this,void 0),fe(this,we,"declare module '*.yml' {\n  const value: any\n  export default value\n}\n\ndeclare module '*.png'\ndeclare module '*.jpg'\ndeclare module '*.jpeg'\ndeclare module '*.gif'\ndeclare module '*.svg'\ndeclare module '*.webp'\n\n/* webpack define */\ndeclare const IS_PRODUCTION: boolean\ndeclare const SITE_TITLE: string\ndeclare const SITE_URL: string\ndeclare const SITE_AUTHOR: string\ndeclare const SITE_ROOT: string")}addVue(){fe(this,we,ye(this,we)+"\n\n/* Vue.js */\ndeclare module '*.vue' {\n  import Vue from 'vue'\n  export default Vue\n}")}async create(){await i("types");const e="types/custom.d.ts";fe(this,we,ye(this,we)+"\n");try{r.writeFileSync(e,ye(this,we)),f(e)}catch(t){w(e,t)}}}we=new WeakMap;var ve,ke,je=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},Ee=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s};const Me="npm",$e="yarn";class De extends T{constructor(){super(...arguments),ve.set(this,!0),ke.set(this,Me)}isInstall(){return je(this,ve)}async questions(){this.startLog("Package Install");const e=await c.prompt({type:"confirm",name:"install",message:"Library install?",default:!0}).catch((e=>(console.error(e),{install:!1})));Ee(this,ve,e.install)}async packageManager(){const e=await c.prompt({type:"list",name:"manager",message:"Package manager",choices:[{name:"npm",value:Me},{name:"yarn",value:$e}]}).catch((e=>(console.error(e),{manager:Me})));Ee(this,ke,e.manager)}start(e){console.log(s.bold().blue("Install start..."));const t=p.spawn(je(this,ke),["install"],{cwd:a.resolve(),stdio:"inherit"});console.log(""),t.on("close",(t=>{0===t?e&&e():console.error("Install error X(")}))}}ve=new WeakMap,ke=new WeakMap;var Se,xe,We,Te=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class qe{constructor(e,t,s,n){Se.set(this,{name:"",version:"",description:"",main:"",author:"",license:"ISC",engines:X,scripts:{},devDependencies:{},dependencies:{}}),xe.set(this,(e=>{const t={};return Object.keys(e).sort().forEach((s=>{t[s]=e[s]})),t})),We.set(this,(()=>{const e=["vue"],t=Object.keys(Te(this,Se).devDependencies),s={};for(const n of t)e.includes(n)&&(s[n]=Te(this,Se).devDependencies[n],delete Te(this,Se).devDependencies[n]);this.addDependenciesObject(s)})),Te(this,Se).name=e,Te(this,Se).version=t,Te(this,Se).description=s,Te(this,Se).author=n,Te(this,Se).devDependencies={"@io-arc/task-browser-sync":"^1.0.2","@io-arc/task-clean":"^1.0.2","@io-arc/task-copy":"^1.0.2","@io-arc/task-manifest":"^1.0.2","@io-arc/task-service-worker":"^1.0.2","@io-arc/task-yaml2json":"^1.0.2","@io-arc/task-webp-converter":"^1.0.2","cross-env":l["cross-env"],"npm-run-all":l["npm-run-all"],eslint:Y,"eslint-config-prettier":z,prettier:K,webpack:l.webpack,"webpack-cli":l["webpack-cli"]},Te(this,Se).scripts={start:"cross-env NODE_ENV=development MODE_ENV=watch npm-run-all -p webp b:*",build:"cross-env NODE_ENV=development MODE_ENV=once npm-run-all -s clean webp b:* service-worker",release:"cross-env NODE_ENV=production MODE_ENV=once npm-run-all -s clean webp b:* service-worker",clean:"ia-clean",server:"ia-browser-sync","service-worker":"ia-sw",webp:"ia-webp","b:copy":"ia-copy","b:yaml2json":"ia-yaml2json","b:manifest":"ia-manifest","b:webpack":"webpack"}}addDevDependencies(e){null!=e&&(Te(this,Se).devDependencies[e]="^1.0.2")}addDevDependenciesObject(e){null!=e&&(Te(this,Se).devDependencies={...Te(this,Se).devDependencies,...e})}addDependenciesObject(e){null!=e&&(Te(this,Se).dependencies={...Te(this,Se).dependencies,...e})}create(){Te(this,We).call(this),Te(this,Se).devDependencies=Te(this,xe).call(this,Te(this,Se).devDependencies),Te(this,Se).dependencies=Te(this,xe).call(this,Te(this,Se).dependencies);try{r.writeFileSync("package.json",JSON.stringify(Te(this,Se),null,2)),f("package.json")}catch(e){w("package.json",e),process.exit(1)}}}Se=new WeakMap,xe=new WeakMap,We=new WeakMap;var Le,Pe=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},Oe=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class Ie{constructor(e){Le.set(this,void 0),Pe(this,Le,"trailingComma: none\ntabWidth: 2\nsemi: false\nsingleQuote: true\narrowParens: always"),e&&Pe(this,Le,Oe(this,Le)+"\noverrides:")}addPug(e){e&&Pe(this,Le,Oe(this,Le)+"\n  - files: '*.pug'\n    options:\n      parser: pug\n      bracketSpacing: false\n      semi: true\n      singleQuote: false")}create(){const e=".prettierrc";try{r.writeFileSync(e,Oe(this,Le)),f(e)}catch(t){w(e,t)}}}Le=new WeakMap;const Re={webpack:"^4.42.1","webpack-cli":"^4.7.2"},Ne={stylus:"^0.54.7",webpack:"^4.42.1","webpack-cli":"^4.7.2"};var Be,Ve,Ae,Ce,Fe=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},_e=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s};const Je="css",Ge="sass",He="stylus";class Ue extends T{constructor(){super(...arguments),Be.set(this,Je),Ve.set(this,(e=>[{source:`${x}/css/README.md`,output:`src/${e}`},{source:`${x}/css/style.css`,output:`src/${e}`}])),Ae.set(this,(e=>[{source:`${x}/sass/README.md`,output:`src/${e}`},{source:`${x}/sass/style.scss`,output:`src/${e}`}])),Ce.set(this,(e=>[{source:`${x}/stylus/README.md`,output:`src/${e}`},{source:`${x}/stylus/style.styl`,output:`src/${e}`}]))}lang(){return Fe(this,Be)}async questions(){this.startLog("Select CSS Language");const e=await c.prompt([{type:"list",name:"lang",message:"CSS language",choices:[{name:"CSS (Vanilla)",value:Je},{name:"Sass (SASS/SCSS)",value:Ge},{name:"Stylus",value:He}]}]).catch((e=>(console.error(e),1)));"number"!=typeof e?_e(this,Be,e.lang):this.fail()}taskLibrary(){switch(Fe(this,Be)){case Je:return"@io-arc/task-webpack-css";case Ge:return"@io-arc/task-webpack-sass";case He:return"@io-arc/task-webpack-stylus";default:return null}}dependencies(){switch(Fe(this,Be)){case Ge:return Re;case He:return Ne;default:return null}}template(e){switch(Fe(this,Be)){case Je:return Fe(this,Ve).call(this,e);case Ge:return Fe(this,Ae).call(this,e);case He:return Fe(this,Ce).call(this,e);default:return[]}}}Be=new WeakMap,Ve=new WeakMap,Ae=new WeakMap,Ce=new WeakMap;var Qe,Xe,Ye,ze,Ke=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},Ze=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s};class et extends T{constructor(){super(...arguments),Qe.set(this,["common","css"]),Xe.set(this,["common","js"]),Ye.set(this,["common","img"]),ze.set(this,["common","data"])}async questions(){this.startLog("Deploy settings");const e=await c.prompt([{type:"input",name:"css",message:"CSS files output directory",default:Ke(this,Qe).join("/")},{type:"input",name:"js",message:"JavaScript files output directory",default:Ke(this,Xe).join("/")},{type:"input",name:"img",message:"Image files output directory",default:Ke(this,Ye).join("/")},{type:"input",name:"json",message:"YAML to JSON convert files output directory",suffix:`\n ${s.grey("* use @io-arc/task-yaml2json")}`,default:Ke(this,ze).join("/")}]).catch((e=>(console.error(e),1)));"number"!=typeof e?(Ze(this,Qe,e.css.split("/").filter(Boolean)),Ze(this,Xe,e.js.split("/").filter(Boolean)),Ze(this,Ye,e.img.split("/").filter(Boolean)),Ze(this,ze,e.json.split("/").filter(Boolean))):this.fail()}dir(){return{css:Ke(this,Qe),js:Ke(this,Xe),img:Ke(this,Ye),json:Ke(this,ze)}}}Qe=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,ze=new WeakMap;var tt,st,nt,rt,it=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)},at=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s};class ot extends T{constructor(){super(...arguments),tt.set(this,a.basename(process.cwd())),st.set(this,"1.0.0"),nt.set(this,""),rt.set(this,"")}name(){return it(this,tt)}version(){return it(this,st)}description(){return it(this,nt)}author(){return it(this,rt)}async questions(){this.startLog("Project settings");const e=await c.prompt([{type:"input",name:"name",message:"Project Name",default:it(this,tt)},{type:"input",name:"version",message:"Project Version",default:it(this,st)},{type:"input",name:"description",message:"Project Description"},{type:"input",name:"author",message:"Project Author"}]).catch((e=>(console.error(e),1)));"number"!=typeof e?(at(this,tt,e.name),at(this,st,e.version),at(this,nt,e.description),at(this,rt,e.author)):this.fail()}}tt=new WeakMap,st=new WeakMap,nt=new WeakMap,rt=new WeakMap;var ct,pt,lt,ut,ht,dt=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},mt=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class gt extends T{constructor(e){super(),ct.set(this,""),pt.set(this,""),lt.set(this,""),ut.set(this,""),ht.set(this,"/"),dt(this,lt,e)}title(){return mt(this,ct)}url(){return mt(this,pt)}siteRoot(){return mt(this,ht)}author(){return mt(this,lt)}description(){return mt(this,ut)}async questions(){this.startLog("Site settings");const e=await c.prompt([{type:"input",name:"title",message:"Site title"},{type:"input",name:"url",message:"Release Site URL",suffix:`\n${s.grey("No final slash required\ne.g. https://foo.com")}`,validate:e=>!/\/$/.test(e)},{type:"input",name:"author",message:"Site author",default:mt(this,lt)},{type:"input",name:"description",message:"Site description"},{type:"input",name:"siteRoot",message:"Site root directory",suffix:`\n${s.grey("Always add a slash at the end")}`,default:mt(this,ht)}]).catch((e=>(console.error(e),1)));"number"!=typeof e?(dt(this,ct,e.title),dt(this,pt,e.url),dt(this,ht,e.siteRoot),dt(this,lt,e.author),dt(this,ut,e.description)):this.fail()}}ct=new WeakMap,pt=new WeakMap,lt=new WeakMap,ut=new WeakMap,ht=new WeakMap;var wt,ft,yt,bt,vt,kt=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},jt=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class Et extends T{constructor(e,t){super(),wt.set(this,[{target:["src","img"],ext:{png:!1,jpg:!1,gif:!1},output:["src","img"],options:{quality:75},gifOptions:{quality:75},deleteBefore:!0},{target:["src","static"],ext:{png:!1,jpg:!1,gif:!1},output:["src","static"],options:{quality:75},gifOptions:{quality:75},deleteBefore:!0}]),ft.set(this,""),yt.set(this,""),bt.set(this,(async(e,{ext:t,deleteBefore:n})=>{const{png:r,jpg:i,gif:a}=t,o=await c.prompt([{type:"checkbox",name:"ext",message:`Select a target webp convert file extensions with '${s.bold().green(e)}'`,choices:[{name:"PNG",checked:r,value:"png"},{name:"JPG(JPEG)",checked:i,value:"jpg"},{name:"GIF",checked:a,value:"gif"}]},{type:"confirm",name:"deleteBefore",message:"Whether to delete the webp file when the task starts (Not delete when in watch task)",default:n}]).catch((e=>(console.error(e),1)));return"number"==typeof o?o:{ext:{png:o.ext.includes("png"),jpg:o.ext.includes("jpg"),gif:o.ext.includes("gif")},deleteBefore:o.deleteBefore}})),vt.set(this,((e,{ext:t,deleteBefore:s})=>{jt(this,wt)[e].ext=t,jt(this,wt)[e].deleteBefore=s})),kt(this,ft,e.join("/")),kt(this,yt,t.join("/")),jt(this,wt)[0].target=e,jt(this,wt)[1].target=t}async questions(){this.startLog("Using Webp converter");const e=await c.prompt({type:"confirm",name:"using",message:"Do you want to use the Webp Converter?",suffix:`\n${s.grey("PNG, JPEG, GIF to Webp file convert")}`,default:!1}).catch((e=>(console.error(e),1)));if("number"==typeof e)return void this.fail();if(!e.using)return;const t=[jt(this,ft),jt(this,yt)];let n={ext:{png:!0,jpg:!0,gif:!1},deleteBefore:!0};for(let e=0,s=t.length;e<s;e++){const s=await jt(this,bt).call(this,t[e],n);if("number"==typeof s)return void this.fail();jt(this,vt).call(this,e,s),n=s}}options(){return jt(this,wt)}}wt=new WeakMap,ft=new WeakMap,yt=new WeakMap,bt=new WeakMap,vt=new WeakMap;var Mt,$t=function(e,t,s){if(!t.has(e))throw new TypeError("attempted to set private field on non-instance");return t.set(e,s),s},Dt=function(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)};class St{constructor(e,t,s){Mt.set(this,void 0);const n=[];null!==e&&n.push(`const { html } = require('${e}')`),null!==t&&n.push(`const { css } = require('${t}')`),null!==s&&n.push(`const { js } = require('${s}')`),$t(this,Mt,`${n.join("\n")}\n\nmodule.exports = [html, css, js]\n`)}create(){try{r.writeFileSync("webpack.config.js",Dt(this,Mt)),f("webpack.config.js")}catch(e){w("webpack.config.js",e)}}}Mt=new WeakMap,n({pkg:d}).notify(),process.stdin.resume(),process.on("SIGINT",(()=>{console.log(s.green("Bye !")),process.exit(0)})),t.program.version("1.0.2").parse(process.argv),(async()=>{const e=new g;if(!e.check())return void e.fail();const t=new W,n=new ot;await n.questions();const r=new qe(n.name(),n.version(),n.description(),n.author());console.log("");const i=new gt(n.author());await i.questions(),console.log("");const a=new J;await a.questions(),r.addDevDependencies(a.taskLibrary()),r.addDevDependenciesObject(a.dependencies()),console.log("");const o=new Ue;await o.questions(),r.addDevDependencies(o.taskLibrary()),r.addDevDependenciesObject(o.dependencies()),console.log("");const c=new ue;await c.questions(),r.addDevDependencies(c.taskLibrary()),r.addDevDependenciesObject(c.dependencies()),console.log("");const p=new et;await p.questions();const l=new ge(p.dir());l.pugToPHP(a.engine(),a.ext(),c.framework()),l.jsFramework(c.framework()),l.tsconfig(c.preprocessor());const u=new E(i.title(),i.url(),i.author(),i.description(),i.siteRoot());console.log("");const h=new Et(["src",l.wsImg()],["src",l.wsStatic()]);if(await h.questions(),l.webp(h.options()),console.log(""),await a.createTemplateQuestion(),t.add(a.template(l.wsHTML())),t.add(o.template(l.wsCSS())),t.add(c.template(l.wsJS())),t.add(l.template()),await t.create(l.workingDirectories()),await l.create(),await u.create(),r.create(),c.preprocessor()===oe){const e=new be;c.framework()===le&&e.addVue(),await e.create()}const d=new Ie(a.isPug());d.addPug(a.isPug()),d.create();new St(a.taskLibrary(),o.taskLibrary(),c.taskLibrary()).create(),console.log("");const m=s.bold().blue("Done!\nEnjoy create!!"),w=new De;await w.questions(),w.isInstall()?(await w.packageManager(),w.start((()=>console.log(m)))):console.log(m)})();
  