2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
|
#!/usr/bin/env node
|
||
|
(()=>{var e={761:(e,t,i)=>{i(147),i(17),i(84);const s=i(483);e.exports=class{constructor(){this.cliHelper=new s,this.cliHelper.debug("Root cli directory : "+this.cliHelper.getCliDir()),this.run()}run(){switch(this.cliHelper.getInstruction()){case"init":case"new":this.init();break;case"start":case"run":this.start();break;case"build":case"prod":this.build();break;case"buildNpm":case"buildCSS":this.buildNpm();break;case"test":this.cliHelper.info("We are sorry ! Tests are not implemented yet");break;case"doc":case"docs":case"documentation":this.doc();break;case"v":case"-v":case"--v":case"V":case"-V":case"--V":case"Version":case"-Version":case"--Version":case"version":case"-version":case"--version":this.cliHelper.info("The version of this program is in all the posts"),this.cliHelper.info("Made By : hassani ayoub (D3v4pp)"),this.cliHelper.info("Please visite http://cli.d3v4pp.fr if you feel the need to know more about @d3v4pp/cli");break;default:this.cliHelper.info("Need help Bro?"),this.cliHelper.info("Please visite http://cli.d3v4pp.fr if you feel the need to know more about @d3v4pp/cli")}}init(){this.cliHelper.info(`Initializing new ${this.cliHelper.appType} application "${this.cliHelper.getParamAsString(["init","new"])}" in : ${this.cliHelper.getWorkingDir()}`),new(i(504))(this.cliHelper).run()}start(){this.cliHelper.info(`Starting ${this.cliHelper.appType} application...`),new(i(572))(this.cliHelper).run()}build(){this.cliHelper.info("Building ..."),new(i(707))(this.cliHelper).run()}buildNpm(){this.cliHelper.info(" Building For NPM..."),new(i(152))(this.cliHelper).run()}doc(){this.cliHelper.info("Generating documentation ..."),new(i(72))(this.cliHelper).run()}}},483:(e,t,i)=>{i(84);const s=i(147),r=i(17),o={showVersion:!0,showName:!0,debugMode:!0,nameColor:63,infoColor:39,warnColor:220,errorColor:210,debugColor:22};e.exports=class{constructor(e=o){this.cp=i(81),this.readLine=i(521),this.wd=process.cwd(),this.CliDir=process.mainModule.path,this.package=JSON.parse(s.readFileSync(r.join(this.CliDir,"package.json"),"utf8")),this.config=Object.assign(o,e),this._args=process.argv.slice(2),this.appType=this.getParamAsString(["-t","--t","-type","--type"],"react")}isDebug(){return this.config.debugMode}getName(){return this.config.showVersion?`[${this.package.name}, Version : ${this.package.version}]`.color(this.config.nameColor):this.config.showName?`[${this.package.name}]`.color(this.config.nameColor):""}info(e){console.log(this.getName()+" info : ".color(this.config.infoColor)+e.color(this.config.infoColor))}warn(e){console.log(this.getName()+" warn : ".color(this.config.warnColor)+e.color(this.config.warnColor))}error(e){console.log(this.getName()+" error : ".color(this.config.errorColor)+e.color(this.config.errorColor))}debug(e){this.isDebug()&&console.log(this.getName()+" __DEGUG__ ".color(23)+e.color(this.config.debugColor))}getWorkingDir(){return this.wd}getCliDir(){return this.CliDir}getInstruction(){return this._args[0]}getArgsPosition(e){for(let t=0;t<=e.length;t++){let i=this._args.findIndex((i=>i===e[t]));if(i>-1)return i}return-1}getParamAsString(e,t){let i=this.getArgsPosition(e);return-1==i?t:this._args[i+1]}getParamAsNumber(e,t){let i=this.getArgsPosition(e);return-1==i?t:parseInt(this._args[i+1])}getParamAsBoolean(e){return this.getArgsPosition(e)>-1}question(e){return new Promise(((t,i)=>{const s=this.readLine.createInterface({input:process.stdin,output:process.stderr});s.question(this.getName()+" Question : ".color(220)+e.color(220)+"\n"+this.getName()+" Answer : ".color(220),(e=>{s.close(),t(e)}))}))}exec(e,t,i){return new Promise(((s,r)=>{const o=this.cp.spawn(e,t,{stdio:"inherit",shell:!0,cwd:i||process.cwd()});o.on("error",(e=>{r(e)})),o.on("exit",(e=>{0===e?s():r()}))}))}}},608:(e,t,i)=>{const s=i(147),r=i(17);e.exports=function(e,t,i,o){var n=o;o||(n=i,i={});var a=process.cwd(),c=r.resolve(a,e),l=r.resolve(a,t),p=i.filter,h=i.rename,u=i.transform,d=!1!==i.clobber,g=i.modified,m=i.dereference,f=null,w=0,b=0,k=0,v=i.limit||16;function x(e){if(w++,p)if(p instanceof RegExp){if(!p.test(e))return A(!0)}else
|