create-vitnode-app 0.0.6 → 0.0.7-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,7 +20,7 @@ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._life
|
|
|
20
20
|
`),this.outputHelp({error:!0}));let i=t||{},n=i.exitCode||1,s=i.code||"commander.error";this._exit(n,s,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in m.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||["default","config","env"].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,m.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Pe(this.options),t=i=>this.getOptionValue(i)!==void 0&&!["default","implied"].includes(this.getOptionValueSource(i));this.options.filter(i=>i.implied!==void 0&&t(i.attributeName())&&e.valueFromOption(this.getOptionValue(i.attributeName()),i)).forEach(i=>{Object.keys(i.implied).filter(n=>!t(n)).forEach(n=>{this.setOptionValueWithSource(n,i.implied[n],"implied")})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:"commander.missingArgument"})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(e,t){let i=r=>{let l=r.attributeName(),o=this.getOptionValue(l),h=this.options.find(c=>c.negate&&l===c.attributeName()),u=this.options.find(c=>!c.negate&&l===c.attributeName());return h&&(h.presetArg===void 0&&o===!1||h.presetArg!==void 0&&o===h.presetArg)?h:u||r},n=r=>{let l=i(r),o=l.attributeName();return this.getOptionValueSource(o)==="env"?`environment variable '${l.envVar}'`:`option '${l.flags}'`},s=`error: ${n(e)} cannot be used with ${n(t)}`;this.error(s,{code:"commander.conflictingOption"})}unknownOption(e){if(this._allowUnknownOption)return;let t="";if(e.startsWith("--")&&this._showSuggestionAfterError){let n=[],s=this;do{let r=s.createHelp().visibleOptions(s).filter(l=>l.long).map(l=>l.long);n=n.concat(r),s=s.parent}while(s&&!s._enablePositionalOptions);t=Q(e,n)}let i=`error: unknown option '${e}'${t}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,i=t===1?"":"s",s=`error: too many arguments${this.parent?` for '${this.name()}'`:""}. Expected ${t} argument${i} but got ${e.length}.`;this.error(s,{code:"commander.excessArguments"})}unknownCommand(){let e=this.args[0],t="";if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(s=>{n.push(s.name()),s.alias()&&n.push(s.alias())}),t=Q(e,n)}let i=`error: unknown command '${e}'${t}`;this.error(i,{code:"commander.unknownCommand"})}version(e,t,i){if(e===void 0)return this._version;this._version=e,t=t||"-V, --version",i=i||"output the version number";let n=this.createOption(t,i);return this._versionOptionName=n.attributeName(),this._registerOption(n),this.on("option:"+n.name(),()=>{this._outputConfiguration.writeOut(`${e}
|
|
21
21
|
`),this._exit(0,"commander.version",e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw new Error("Command alias can't be the same as its name");let i=this.parent?._findCommand(e);if(i){let n=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${n}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(t=>this.alias(t)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let t=this.registeredArguments.map(i=>Se(i));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}nameFromFilename(e){return this._name=_.basename(e,_.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp();return t.helpWidth===void 0&&(t.helpWidth=e&&e.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()),t.formatHelp(this,t)}_getHelpContext(e){e=e||{};let t={error:!!e.error},i;return t.error?i=n=>this._outputConfiguration.writeErr(n):i=n=>this._outputConfiguration.writeOut(n),t.write=e.write||i,t.command=this,t}outputHelp(e){let t;typeof e=="function"&&(t=e,e=void 0);let i=this._getHelpContext(e);this._getCommandAndAncestors().reverse().forEach(s=>s.emit("beforeAllHelp",i)),this.emit("beforeHelp",i);let n=this.helpInformation(i);if(t&&(n=t(n),typeof n!="string"&&!Buffer.isBuffer(n)))throw new Error("outputHelp callback must return a string or a Buffer");i.write(n),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit("afterHelp",i),this._getCommandAndAncestors().forEach(s=>s.emit("afterAllHelp",i))}helpOption(e,t){return typeof e=="boolean"?(e?this._helpOption=this._helpOption??void 0:this._helpOption=null,this):(e=e??"-h, --help",t=t??"display help for command",this._helpOption=this.createOption(e,t),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this}help(e){this.outputHelp(e);let t=m.exitCode||0;t===0&&e&&typeof e!="function"&&e.error&&(t=1),this._exit(t,"commander.help","(outputHelp)")}addHelpText(e,t){let i=["beforeAll","before","after","afterAll"];if(!i.includes(e))throw new Error(`Unexpected value for position to addHelpText.
|
|
22
22
|
Expecting one of '${i.join("', '")}'`);let n=`${e}Help`;return this.on(n,s=>{let r;typeof t=="function"?r=t({error:s.error,command:s.command}):r=t,r&&s.write(`${r}
|
|
23
|
-
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Z(a){return a.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}ee.Command=L});var re=w(f=>{"use strict";var{Argument:ie}=x(),{Command:R}=te(),{CommanderError:Fe,InvalidArgumentError:ne}=E(),{Help:je}=j(),{Option:se}=I();f.program=new R;f.createCommand=a=>new R(a);f.createOption=(a,e)=>new se(a,e);f.createArgument=(a,e)=>new ie(a,e);f.Command=R;f.Option=se;f.Argument=ie;f.Help=je;f.CommanderError=Fe;f.InvalidArgumentError=ne;f.InvalidOptionArgumentError=ne});var oe=y(re(),1),{program:Ge,createCommand:Be,createArgument:Je,createOption:ze,CommanderError:Ke,InvalidArgumentError:Ye,InvalidOptionArgumentError:Xe,Command:ae,Argument:Qe,Option:Ze,Help:et}=oe.default;var g=y(require("picocolors"),1),me=y(require("figlet"),1);var le={name:"create-vitnode-app",version:"0.0.6
|
|
23
|
+
`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function Z(a){return a.map(e=>{if(!e.startsWith("--inspect"))return e;let t,i="127.0.0.1",n="9229",s;return(s=e.match(/^(--inspect(-brk)?)$/))!==null?t=s[1]:(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null?(t=s[1],/^\d+$/.test(s[3])?n=s[3]:i=s[3]):(s=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=s[1],i=s[3],n=s[4]),t&&n!=="0"?`${t}=${i}:${parseInt(n)+1}`:e})}ee.Command=L});var re=w(f=>{"use strict";var{Argument:ie}=x(),{Command:R}=te(),{CommanderError:Fe,InvalidArgumentError:ne}=E(),{Help:je}=j(),{Option:se}=I();f.program=new R;f.createCommand=a=>new R(a);f.createOption=(a,e)=>new se(a,e);f.createArgument=(a,e)=>new ie(a,e);f.Command=R;f.Option=se;f.Argument=ie;f.Help=je;f.CommanderError=Fe;f.InvalidArgumentError=ne;f.InvalidOptionArgumentError=ne});var oe=y(re(),1),{program:Ge,createCommand:Be,createArgument:Je,createOption:ze,CommanderError:Ke,InvalidArgumentError:Ye,InvalidOptionArgumentError:Xe,Command:ae,Argument:Qe,Option:Ze,Help:et}=oe.default;var g=y(require("picocolors"),1),me=y(require("figlet"),1);var le={name:"create-vitnode-app",version:"0.0.6",description:"Create a new VitNode app in seconds.",author:"VitNode Team",license:"MIT",homepage:"https://VitNode.com",repository:{type:"git",url:"git+https://github.com/aXenDeveloper/VitNode.git",directory:"packages/create-vitnode-app"},files:["dist"],type:"module",bin:{"create-vitnode-app":"dist/index.cjs"},scripts:{"build:scripts":"tsup index.ts","dev:script":"tsup index.ts --watch","start:script":"node dist/index.cjs"},devDependencies:{"@types/figlet":"^1.5.8","@types/node":"^20.14.10","@types/prompts":"^2.4.9","@types/validate-npm-package-name":"^4.0.2",commander:"^12.1.0",tsup:"^8.1.0",typescript:"^5.5.3"},dependencies:{figlet:"^1.7.0",picocolors:"^1.0.1",prompts:"^2.4.2","validate-npm-package-name":"^5.0.1"}};var pe=y(require("prompts"),1);var he=y(require("validate-npm-package-name"),1),G=({name:a})=>{let e=(0,he.default)(a);return e.validForNewPackages?{valid:!0}:{valid:!1,problems:[...e.errors||[],...e.warnings||[]]}};var b=require("path"),de=require("fs");var V=require("fs"),ue=require("path"),B=y(require("picocolors"),1);function ce(a,e){let t=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"],i=(0,V.readdirSync)(a).filter(n=>!t.includes(n)&&!/\.iml$/.test(n));if(i.length>0){console.log(`The directory ${B.default.green(e)} contains files that could conflict:`),console.log();for(let n of i)try{(0,V.lstatSync)((0,ue.join)(a,n)).isDirectory()?console.log(`${B.default.blue(n)}/`):console.log(`${n}`)}catch{console.log(`${n}`)}return console.log(`
|
|
24
24
|
Either try using a new directory name, or remove the files listed above.
|
|
25
25
|
`),!1}return!0}var v="",C=new ae().version(le.version).argument("[project-directory]").usage(`${g.default.green("[project-directory]")} [options]`).action(a=>{v=a});C.option("--turbo","Enable Turbopack by default for development.");C.option("--use-npm","Use NPM as the package manager.");C.option("--use-pnpm","Use PNPM as the package manager.");C.option("--skip-install","Skip installing packages after initializing the project.");C.parse(process.argv);(async()=>{if(console.log(g.default.blue(me.default.textSync("VitNode",{horizontalLayout:"full"}))),!v){let r=await(0,pe.default)({type:"text",name:"path",message:"What is your project named?",initial:"my-app",validate:l=>{let o=G({name:(0,b.basename)((0,b.resolve)(l))});return o.valid?!0:`Invalid project name: ${o.problems[0]}`}});typeof r.path=="string"&&(v=r.path.trim())}v||(console.log(`
|
|
26
26
|
Please specify the project directory:
|