create-vitnode-app 0.0.7-canary.4 → 0.0.7-canary.40

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.
Files changed (45) hide show
  1. package/README.md +13 -2
  2. package/dist/index.cjs +22 -20
  3. package/package.json +4 -7
  4. package/templates/basic/.gitignore_template +55 -0
  5. package/templates/basic/.npmrc_template +1 -0
  6. package/templates/basic/apps/backend/nest-cli.json +15 -0
  7. package/templates/basic/apps/backend/src/app.module.ts +23 -0
  8. package/templates/basic/apps/backend/src/database.ts +19 -0
  9. package/templates/basic/apps/backend/src/main.ts +27 -0
  10. package/templates/basic/apps/backend/src/plugins/plugins.module.ts +14 -0
  11. package/templates/basic/apps/backend/src/plugins/welcome/admin/admin.module.ts +4 -0
  12. package/templates/basic/apps/backend/src/plugins/welcome/admin/database/drizzle.config.ts +11 -0
  13. package/templates/basic/apps/backend/src/plugins/welcome/admin/database/functions.ts +6 -0
  14. package/templates/basic/apps/backend/src/plugins/welcome/admin/database/index.ts +1 -0
  15. package/templates/basic/apps/backend/src/plugins/welcome/config.json +10 -0
  16. package/templates/basic/apps/backend/src/plugins/welcome/versions.json +3 -0
  17. package/templates/basic/apps/backend/src/plugins/welcome/welcome.module.ts +8 -0
  18. package/templates/basic/apps/backend/tsconfig.build.json +4 -0
  19. package/templates/basic/apps/backend/tsconfig.json +14 -0
  20. package/templates/basic/apps/backend/uploads/index.html +0 -0
  21. package/templates/basic/apps/backend/uploads/private/index.html +0 -0
  22. package/templates/basic/apps/backend/uploads/public/index.html +0 -0
  23. package/templates/basic/apps/backend/uploads/temp/index.html +0 -0
  24. package/templates/basic/apps/frontend/app/global.css +82 -0
  25. package/templates/basic/apps/frontend/app/layout.tsx +9 -0
  26. package/templates/basic/apps/frontend/i18n.ts +13 -0
  27. package/templates/basic/apps/frontend/middleware.ts +7 -0
  28. package/templates/basic/apps/frontend/next.config.mjs +6 -0
  29. package/templates/basic/apps/frontend/plugins/welcome/langs/en.json +5 -0
  30. package/templates/basic/apps/frontend/plugins/welcome/langs/pl.json +5 -0
  31. package/templates/basic/apps/frontend/plugins/welcome/templates/default-page.tsx +3 -0
  32. package/templates/basic/apps/frontend/postcss.config.mjs +9 -0
  33. package/templates/basic/apps/frontend/tailwind.config.ts +15 -0
  34. package/templates/basic/apps/frontend/tsconfig.json +19 -0
  35. package/templates/basic/tsconfig.json +4 -0
  36. package/templates/basic/turbo.json +27 -0
  37. package/templates/create-packages-json.ts +160 -0
  38. package/templates/docker/docker-compose-dev.yml +35 -0
  39. package/templates/eslint/.prettierrc.mjs +11 -0
  40. package/templates/eslint/apps/backend/.eslintrc.json +5 -0
  41. package/templates/eslint/apps/frontend/.eslintrc.json +4 -0
  42. package/templates/i18n/with/apps/frontend/app/[locale]/layout.tsx +13 -0
  43. package/templates/i18n/with/apps/frontend/app/layout.tsx +9 -0
  44. package/templates/i18n/without/apps/frontend/app/layout.tsx +14 -0
  45. package/templates/pnpm/pnpm-workspace.yaml +2 -0
package/README.md CHANGED
@@ -26,11 +26,22 @@ npx create-vitnode-app@latest
26
26
  or
27
27
 
28
28
  ```bash
29
- pnpm create vitnode-app
29
+ pnpm create vitnode-app@latest
30
30
  ```
31
31
 
32
32
  or
33
33
 
34
34
  ```bash
35
- pnpm create vitnode-app
35
+ yarn create vitnode-app@latest
36
36
  ```
37
+
38
+ ## Options
39
+
40
+ | Option | Description |
41
+ | -------------------------- | ------------------------------------------------------------------ |
42
+ | `--package-manager`, `-pm` | Specify the package manager to use. Support `npm`, `pnpm`, `yarn`. |
43
+ | `--eslint` | Initialize with eslint config. |
44
+ | `--docker` | Initialize with Dockerfile & Docker Compose. |
45
+ | `--no-eslint` | Skip initializing with eslint config. |
46
+ | `--i18n-routing` | Initialize with i18n routing. |
47
+ | `--skip-install` | Skip installing packages after initializing the project. |
package/dist/index.cjs CHANGED
@@ -1,32 +1,34 @@
1
1
  #!/usr/bin/env node
2
- "use strict";var fe=Object.create;var J=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,be=Object.prototype.hasOwnProperty;var w=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var Ce=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of _e(e))!be.call(a,n)&&n!==t&&J(a,n,{get:()=>e[n],enumerable:!(i=ge(e,n))||i.enumerable});return a};var y=(a,e,t)=>(t=a!=null?fe(Oe(a)):{},Ce(e||!a||!a.__esModule?J(t,"default",{value:a,enumerable:!0}):t,a));var v=w(S=>{"use strict";var $=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},k=class extends ${constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};S.CommanderError=$;S.InvalidArgumentError=k});var x=w(P=>{"use strict";var{InvalidArgumentError:Ae}=v(),N=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new Ae(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function we(a){let e=a.name()+(a.variadic===!0?"...":"");return a.required?"<"+e+">":"["+e+"]"}P.Argument=N;P.humanReadableArgName=we});var j=w(z=>{"use strict";var{humanReadableArgName:ye}=x(),F=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!n&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>ye(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function l(p,O){if(O){let H=`${p.padEnd(i+r)}${O}`;return t.wrap(H,n-s,i+r)}return p}function o(p){return p.join(`
3
- `).replace(/^/gm," ".repeat(s))}let h=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(h=h.concat([t.wrap(u,n,0),""]));let c=t.visibleArguments(e).map(p=>l(t.argumentTerm(p),t.argumentDescription(p)));c.length>0&&(h=h.concat(["Arguments:",o(c),""]));let d=t.visibleOptions(e).map(p=>l(t.optionTerm(p),t.optionDescription(p)));if(d.length>0&&(h=h.concat(["Options:",o(d),""])),this.showGlobalOptions){let p=t.visibleGlobalOptions(e).map(O=>l(t.optionTerm(O),t.optionDescription(O)));p.length>0&&(h=h.concat(["Global Options:",o(p),""]))}let A=t.visibleCommands(e).map(p=>l(t.subcommandTerm(p),t.subcommandDescription(p)));return A.length>0&&(h=h.concat(["Commands:",o(A),""])),h.join(`
4
- `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",r=new RegExp(`[\\n][${s}]+`);if(e.match(r))return e;let l=t-i;if(l<n)return e;let o=e.slice(0,i),h=e.slice(i).replace(`\r
2
+ "use strict";var Pe=Object.create;var ne=Object.defineProperty;var je=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Fe=Object.getPrototypeOf,Ie=Object.prototype.hasOwnProperty;var x=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Te=(o,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of De(e))!Ie.call(o,n)&&n!==t&&ne(o,n,{get:()=>e[n],enumerable:!(i=je(e,n))||i.enumerable});return o};var v=(o,e,t)=>(t=o!=null?Pe(Fe(o)):{},Te(e||!o||!o.__esModule?ne(t,"default",{value:o,enumerable:!0}):t,o));var V=x(W=>{"use strict";var P=class extends Error{constructor(e,t,i){super(i),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},T=class extends P{constructor(e){super(1,"commander.invalidArgument",e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};W.CommanderError=P;W.InvalidArgumentError=T});var j=x(q=>{"use strict";var{InvalidArgumentError:We}=V(),M=class{constructor(e,t){switch(this.description=t||"",this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case"<":this.required=!0,this._name=e.slice(1,-1);break;case"[":this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.length>3&&this._name.slice(-3)==="..."&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new We(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function Me(o){let e=o.name()+(o.variadic===!0?"...":"");return o.required?"<"+e+">":"["+e+"]"}q.Argument=M;q.humanReadableArgName=Me});var J=x(se=>{"use strict";var{humanReadableArgName:qe}=j(),R=class{constructor(){this.helpWidth=void 0,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}visibleCommands(e){let t=e.commands.filter(n=>!n._hidden),i=e._getHelpCommand();return i&&!i._hidden&&t.push(i),this.sortSubcommands&&t.sort((n,s)=>n.name().localeCompare(s.name())),t}compareOptions(e,t){let i=n=>n.short?n.short.replace(/^-/,""):n.long.replace(/^--/,"");return i(e).localeCompare(i(t))}visibleOptions(e){let t=e.options.filter(n=>!n.hidden),i=e._getHelpOption();if(i&&!i.hidden){let n=i.short&&e._findOption(i.short),s=i.long&&e._findOption(i.long);!n&&!s?t.push(i):i.long&&!s?t.push(e.createOption(i.long,i.description)):i.short&&!n&&t.push(e.createOption(i.short,i.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let i=e.parent;i;i=i.parent){let n=i.options.filter(s=>!s.hidden);t.push(...n)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||""}),e.registeredArguments.find(t=>t.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(i=>qe(i)).join(" ");return e._name+(e._aliases[0]?"|"+e._aliases[0]:"")+(e.options.length?" [options]":"")+(t?" "+t:"")}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((i,n)=>Math.max(i,t.subcommandTerm(n).length),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((i,n)=>Math.max(i,t.optionTerm(n).length),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((i,n)=>Math.max(i,t.argumentTerm(n).length),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+"|"+e._aliases[0]);let i="";for(let n=e.parent;n;n=n.parent)i=n.name()+" "+i;return i+t+" "+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];return e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue=="boolean")&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0?`${e.description} (${t.join(", ")})`:e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(i=>JSON.stringify(i)).join(", ")}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let i=`(${t.join(", ")})`;return e.description?`${e.description} ${i}`:i}return e.description}formatHelp(e,t){let i=t.padWidth(e,t),n=t.helpWidth||80,s=2,r=2;function l(d,w){if(w){let I=`${d.padEnd(i+r)}${w}`;return t.wrap(I,n-s,i+r)}return d}function a(d){return d.join(`
3
+ `).replace(/^/gm," ".repeat(s))}let c=[`Usage: ${t.commandUsage(e)}`,""],u=t.commandDescription(e);u.length>0&&(c=c.concat([t.wrap(u,n,0),""]));let h=t.visibleArguments(e).map(d=>l(t.argumentTerm(d),t.argumentDescription(d)));h.length>0&&(c=c.concat(["Arguments:",a(h),""]));let f=t.visibleOptions(e).map(d=>l(t.optionTerm(d),t.optionDescription(d)));if(f.length>0&&(c=c.concat(["Options:",a(f),""])),this.showGlobalOptions){let d=t.visibleGlobalOptions(e).map(w=>l(t.optionTerm(w),t.optionDescription(w)));d.length>0&&(c=c.concat(["Global Options:",a(d),""]))}let A=t.visibleCommands(e).map(d=>l(t.subcommandTerm(d),t.subcommandDescription(d)));return A.length>0&&(c=c.concat(["Commands:",a(A),""])),c.join(`
4
+ `)}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}wrap(e,t,i,n=40){let s=" \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF",r=new RegExp(`[\\n][${s}]+`);if(e.match(r))return e;let l=t-i;if(l<n)return e;let a=e.slice(0,i),c=e.slice(i).replace(`\r
5
5
  `,`
6
- `),u=" ".repeat(i),d="\\s\u200B",A=new RegExp(`
7
- |.{1,${l-1}}([${d}]|$)|[^${d}]+?([${d}]|$)`,"g"),p=h.match(A)||[];return o+p.map((O,H)=>O===`
8
- `?"":(H>0?u:"")+O.trimEnd()).join(`
9
- `)}};z.Help=F});var I=w(q=>{"use strict";var{InvalidArgumentError:ve}=v(),T=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=$e(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new ve(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Ee(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},D=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function Ee(a){return a.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function $e(a){let e,t,i=a.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}q.Option=T;q.DualOptions=D});var Y=w(K=>{"use strict";function xe(a,e){if(Math.abs(a.length-e.length)>3)return Math.max(a.length,e.length);let t=[];for(let i=0;i<=a.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=a.length;n++){let s=1;a[n-1]===e[i-1]?s=0:s=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+s),n>1&&i>1&&a[n-1]===e[i-2]&&a[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1))}return t[a.length][e.length]}function Ve(a,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=a.startsWith("--");t&&(a=a.slice(2),e=e.map(r=>r.slice(2)));let i=[],n=3,s=.4;return e.forEach(r=>{if(r.length<=1)return;let l=xe(a,r),o=Math.max(a.length,r.length);(o-l)/o>s&&(l<n?(n=l,i=[r]):l===n&&i.push(r))}),i.sort((r,l)=>r.localeCompare(l)),t&&(i=i.map(r=>`--${r}`)),i.length>1?`
6
+ `),u=" ".repeat(i),f="\\s\u200B",A=new RegExp(`
7
+ |.{1,${l-1}}([${f}]|$)|[^${f}]+?([${f}]|$)`,"g"),d=c.match(A)||[];return a+d.map((w,I)=>w===`
8
+ `?"":(I>0?u:"")+w.trimEnd()).join(`
9
+ `)}};se.Help=R});var z=x(B=>{"use strict";var{InvalidArgumentError:Re}=V(),L=class{constructor(e,t){this.flags=e,this.description=t||"",this.required=e.includes("<"),this.optional=e.includes("["),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let i=Le(e);this.short=i.shortFlag,this.long=i.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith("--no-")),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e=="string"&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_concatValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:t.concat(e)}choices(e){return this.argChoices=e.slice(),this.parseArg=(t,i)=>{if(!this.argChoices.includes(t))throw new Re(`Allowed choices are ${this.argChoices.join(", ")}.`);return this.variadic?this._concatValue(t,i):t},this}name(){return this.long?this.long.replace(/^--/,""):this.short.replace(/^-/,"")}attributeName(){return Je(this.name().replace(/^no-/,""))}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},U=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(t=>{t.negate?this.negativeOptions.set(t.attributeName(),t):this.positiveOptions.set(t.attributeName(),t)}),this.negativeOptions.forEach((t,i)=>{this.positiveOptions.has(i)&&this.dualOptions.add(i)})}valueFromOption(e,t){let i=t.attributeName();if(!this.dualOptions.has(i))return!0;let n=this.negativeOptions.get(i).presetArg,s=n!==void 0?n:!1;return t.negate===(s===e)}};function Je(o){return o.split("-").reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function Le(o){let e,t,i=o.split(/[ |,]+/);return i.length>1&&!/^[[<]/.test(i[1])&&(e=i.shift()),t=i.shift(),!e&&/^-[^-]$/.test(t)&&(e=t,t=void 0),{shortFlag:e,longFlag:t}}B.Option=L;B.DualOptions=U});var oe=x(re=>{"use strict";function Ue(o,e){if(Math.abs(o.length-e.length)>3)return Math.max(o.length,e.length);let t=[];for(let i=0;i<=o.length;i++)t[i]=[i];for(let i=0;i<=e.length;i++)t[0][i]=i;for(let i=1;i<=e.length;i++)for(let n=1;n<=o.length;n++){let s=1;o[n-1]===e[i-1]?s=0:s=1,t[n][i]=Math.min(t[n-1][i]+1,t[n][i-1]+1,t[n-1][i-1]+s),n>1&&i>1&&o[n-1]===e[i-2]&&o[n-2]===e[i-1]&&(t[n][i]=Math.min(t[n][i],t[n-2][i-2]+1))}return t[o.length][e.length]}function Be(o,e){if(!e||e.length===0)return"";e=Array.from(new Set(e));let t=o.startsWith("--");t&&(o=o.slice(2),e=e.map(r=>r.slice(2)));let i=[],n=3,s=.4;return e.forEach(r=>{if(r.length<=1)return;let l=Ue(o,r),a=Math.max(o.length,r.length);(a-l)/a>s&&(l<n?(n=l,i=[r]):l===n&&i.push(r))}),i.sort((r,l)=>r.localeCompare(l)),t&&(i=i.map(r=>`--${r}`)),i.length>1?`
10
10
  (Did you mean one of ${i.join(", ")}?)`:i.length===1?`
11
- (Did you mean ${i[0]}?)`:""}K.suggestSimilar=Ve});var te=w(ee=>{"use strict";var He=require("events").EventEmitter,W=require("child_process"),_=require("path"),M=require("fs"),m=require("process"),{Argument:ke,humanReadableArgName:Se}=x(),{CommanderError:U}=v(),{Help:Ne}=j(),{Option:X,DualOptions:Pe}=I(),{suggestSimilar:Q}=Y(),L=class a extends He{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>m.stdout.write(t),writeErr:t=>m.stderr.write(t),getOutHelpWidth:()=>m.stdout.isTTY?m.stdout.columns:void 0,getErrHelpWidth:()=>m.stderr.isTTY?m.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let n=t,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,l]=e.match(/([^ ]+) *(.*)/),o=this.createCommand(r);return n&&(o.description(n),o._executableHandler=!0),s.isDefault&&(this._defaultCommandName=o._name),o._hidden=!!(s.noHelp||s.hidden),o._executableFile=s.executableFile||null,l&&o.arguments(l),this._registerCommand(o),o.parent=this,o.copyInheritedSettings(this),n?this:o}createCommand(e){return new a(e)}createHelp(){return Object.assign(new Ne,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
- - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new ke(e,t)}argument(e,t,i,n){let s=this.createArgument(e,t);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",r=this.createCommand(i);return r.helpOption(!1),n&&r.arguments(n),s&&r.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=r,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
- Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new U(e,t,i)),m.exit(e)}action(e){let t=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new X(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
14
- - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),i=t(e).find(n=>this._findCommand(n));if(i){let n=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let n=(s,r,l)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let o=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,o,r):s!==null&&e.variadic&&(s=e._concatValue(s,o)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,l)};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,r,"env")}),this}_optionEx(e,t,i,n,s){if(typeof t=="object"&&t instanceof X)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,i);if(r.makeOptionMandatory(!!e.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let l=n;n=(o,h)=>{let u=l.exec(o);return u?u[0]:h},r.default(s).argParser(n)}else r.default(n);return this.addOption(r)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:!0},e,t,i,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){m.versions?.electron&&(t.from="electron");let n=m.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=m.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":m.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,c){let d=_.resolve(u,c);if(M.existsSync(d))return d;if(n.includes(_.extname(c)))return;let A=n.find(p=>M.existsSync(`${d}${p}`));if(A)return`${d}${A}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,l=this._executableDir||"";if(this._scriptPath){let u;try{u=M.realpathSync(this._scriptPath)}catch{u=this._scriptPath}l=_.resolve(_.dirname(u),l)}if(l){let u=s(l,r);if(!u&&!e._executableFile&&this._scriptPath){let c=_.basename(this._scriptPath,_.extname(this._scriptPath));c!==this._name&&(u=s(l,`${c}-${e._name}`))}r=u||r}i=n.includes(_.extname(r));let o;m.platform!=="win32"?i?(t.unshift(r),t=Z(m.execArgv).concat(t),o=W.spawn(m.argv[0],t,{stdio:"inherit"})):o=W.spawn(r,t,{stdio:"inherit"}):(t.unshift(r),t=Z(m.execArgv).concat(t),o=W.spawn(m.execPath,t,{stdio:"inherit"})),o.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(c=>{m.on(c,()=>{o.killed===!1&&o.exitCode===null&&o.kill(c)})});let h=this._exitCallback;o.on("close",u=>{u=u??1,h?h(new U(u,"commander.executeSubCommandAsync","(close)")):m.exit(u)}),o.on("error",u=>{if(u.code==="ENOENT"){let c=l?`searched for local subcommand relative to directory '${l}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",d=`'${r}' does not exist
11
+ (Did you mean ${i[0]}?)`:""}re.suggestSimilar=Be});var he=x(ue=>{"use strict";var ze=require("events").EventEmitter,G=require("child_process"),y=require("path"),Y=require("fs"),p=require("process"),{Argument:Ge,humanReadableArgName:Ye}=j(),{CommanderError:K}=V(),{Help:Ke}=J(),{Option:ae,DualOptions:Xe}=z(),{suggestSimilar:le}=oe(),X=class o extends ze{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!0,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||"",this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description="",this._summary="",this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._outputConfiguration={writeOut:t=>p.stdout.write(t),writeErr:t=>p.stderr.write(t),getOutHelpWidth:()=>p.stdout.isTTY?p.stdout.columns:void 0,getErrHelpWidth:()=>p.stderr.isTTY?p.stderr.columns:void 0,outputError:(t,i)=>i(t)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={}}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,i){let n=t,s=i;typeof n=="object"&&n!==null&&(s=n,n=null),s=s||{};let[,r,l]=e.match(/([^ ]+) *(.*)/),a=this.createCommand(r);return n&&(a.description(n),a._executableHandler=!0),s.isDefault&&(this._defaultCommandName=a._name),a._hidden=!!(s.noHelp||s.hidden),a._executableFile=s.executableFile||null,l&&a.arguments(l),this._registerCommand(a),a.parent=this,a.copyInheritedSettings(this),n?this:a}createCommand(e){return new o(e)}createHelp(){return Object.assign(new Ke,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(Object.assign(this._outputConfiguration,e),this)}showHelpAfterError(e=!0){return typeof e!="string"&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw new Error(`Command passed to .addCommand() must have a name
12
+ - specify the name in Command constructor or using .name()`);return t=t||{},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new Ge(e,t)}argument(e,t,i,n){let s=this.createArgument(e,t);return typeof i=="function"?s.default(n).argParser(i):s.default(i),this.addArgument(s),this}arguments(e){return e.trim().split(/ +/).forEach(t=>{this.argument(t)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t&&t.variadic)throw new Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw new Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e=="boolean")return this._addImplicitHelpCommand=e,this;e=e??"help [command]";let[,i,n]=e.match(/([^ ]+) *(.*)/),s=t??"display help for command",r=this.createCommand(i);return r.helpOption(!1),n&&r.arguments(n),s&&r.description(s),this._addImplicitHelpCommand=!0,this._helpCommand=r,this}addHelpCommand(e,t){return typeof e!="object"?(this.helpCommand(e,t),this):(this._addImplicitHelpCommand=!0,this._helpCommand=e,this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let i=["preSubcommand","preAction","postAction"];if(!i.includes(e))throw new Error(`Unexpected value for event passed to hook : '${e}'.
13
+ Expecting one of '${i.join("', '")}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync")throw t},this}_exit(e,t,i){this._exitCallback&&this._exitCallback(new K(e,t,i)),p.exit(e)}action(e){let t=i=>{let n=this.registeredArguments.length,s=i.slice(0,n);return this._storeOptionsAsProperties?s[n]=this:s[n]=this.opts(),s.push(this),e.apply(this,s)};return this._actionHandler=t,this}createOption(e,t){return new ae(e,t)}_callParseArg(e,t,i,n){try{return e.parseArg(t,i)}catch(s){if(s.code==="commander.invalidArgument"){let r=`${n} ${s.message}`;this.error(r,{exitCode:s.exitCode,code:s.code})}throw s}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let i=e.long&&this._findOption(e.long)?e.long:e.short;throw new Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'
14
+ - already used by option '${t.flags}'`)}this.options.push(e)}_registerCommand(e){let t=n=>[n.name()].concat(n.aliases()),i=t(e).find(n=>this._findCommand(n));if(i){let n=t(this._findCommand(i)).join("|"),s=t(e).join("|");throw new Error(`cannot add command '${s}' as already have command '${n}'`)}this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),i=e.attributeName();if(e.negate){let s=e.long.replace(/^--no-/,"--");this._findOption(s)||this.setOptionValueWithSource(i,e.defaultValue===void 0?!0:e.defaultValue,"default")}else e.defaultValue!==void 0&&this.setOptionValueWithSource(i,e.defaultValue,"default");let n=(s,r,l)=>{s==null&&e.presetArg!==void 0&&(s=e.presetArg);let a=this.getOptionValue(i);s!==null&&e.parseArg?s=this._callParseArg(e,s,a,r):s!==null&&e.variadic&&(s=e._concatValue(s,a)),s==null&&(e.negate?s=!1:e.isBoolean()||e.optional?s=!0:s=""),this.setOptionValueWithSource(i,s,l)};return this.on("option:"+t,s=>{let r=`error: option '${e.flags}' argument '${s}' is invalid.`;n(s,r,"cli")}),e.envVar&&this.on("optionEnv:"+t,s=>{let r=`error: option '${e.flags}' value '${s}' from env '${e.envVar}' is invalid.`;n(s,r,"env")}),this}_optionEx(e,t,i,n,s){if(typeof t=="object"&&t instanceof ae)throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");let r=this.createOption(t,i);if(r.makeOptionMandatory(!!e.mandatory),typeof n=="function")r.default(s).argParser(n);else if(n instanceof RegExp){let l=n;n=(a,c)=>{let u=l.exec(a);return u?u[0]:c},r.default(s).argParser(n)}else r.default(n);return this.addOption(r)}option(e,t,i,n){return this._optionEx({},e,t,i,n)}requiredOption(e,t,i,n){return this._optionEx({mandatory:!0},e,t,i,n)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw new Error("call .storeOptionsAsProperties() before adding options");if(Object.keys(this._optionValues).length)throw new Error("call .storeOptionsAsProperties() before setting option values");return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,i){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=i,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(i=>{i.getOptionValueSource(e)!==void 0&&(t=i.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw new Error("first parameter to parse must be array or undefined");if(t=t||{},e===void 0&&t.from===void 0){p.versions?.electron&&(t.from="electron");let n=p.execArgv??[];(n.includes("-e")||n.includes("--eval")||n.includes("-p")||n.includes("--print"))&&(t.from="eval")}e===void 0&&(e=p.argv),this.rawArgs=e.slice();let i;switch(t.from){case void 0:case"node":this._scriptPath=e[1],i=e.slice(2);break;case"electron":p.defaultApp?(this._scriptPath=e[1],i=e.slice(2)):i=e.slice(1);break;case"user":i=e.slice(0);break;case"eval":i=e.slice(1);break;default:throw new Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||"program",i}parse(e,t){let i=this._prepareUserArgs(e,t);return this._parseCommand([],i),this}async parseAsync(e,t){let i=this._prepareUserArgs(e,t);return await this._parseCommand([],i),this}_executeSubCommand(e,t){t=t.slice();let i=!1,n=[".js",".ts",".tsx",".mjs",".cjs"];function s(u,h){let f=y.resolve(u,h);if(Y.existsSync(f))return f;if(n.includes(y.extname(h)))return;let A=n.find(d=>Y.existsSync(`${f}${d}`));if(A)return`${f}${A}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=e._executableFile||`${this._name}-${e._name}`,l=this._executableDir||"";if(this._scriptPath){let u;try{u=Y.realpathSync(this._scriptPath)}catch{u=this._scriptPath}l=y.resolve(y.dirname(u),l)}if(l){let u=s(l,r);if(!u&&!e._executableFile&&this._scriptPath){let h=y.basename(this._scriptPath,y.extname(this._scriptPath));h!==this._name&&(u=s(l,`${h}-${e._name}`))}r=u||r}i=n.includes(y.extname(r));let a;p.platform!=="win32"?i?(t.unshift(r),t=ce(p.execArgv).concat(t),a=G.spawn(p.argv[0],t,{stdio:"inherit"})):a=G.spawn(r,t,{stdio:"inherit"}):(t.unshift(r),t=ce(p.execArgv).concat(t),a=G.spawn(p.execPath,t,{stdio:"inherit"})),a.killed||["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"].forEach(h=>{p.on(h,()=>{a.killed===!1&&a.exitCode===null&&a.kill(h)})});let c=this._exitCallback;a.on("close",u=>{u=u??1,c?c(new K(u,"commander.executeSubCommandAsync","(close)")):p.exit(u)}),a.on("error",u=>{if(u.code==="ENOENT"){let h=l?`searched for local subcommand relative to directory '${l}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory",f=`'${r}' does not exist
15
15
  - if '${e._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
16
16
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
17
- - ${c}`;throw new Error(d)}else if(u.code==="EACCES")throw new Error(`'${r}' not executable`);if(!h)m.exit(1);else{let c=new U(1,"commander.executeSubCommandAsync","(error)");c.nestedError=u,h(c)}}),this.runningCommand=o}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,n,s)=>{let r=n;if(n!==null&&i.parseArg){let l=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,s,l)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((r,l)=>e(i,l,r),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=e(i,s,i.defaultValue))),t[n]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(r=>{n.push({hookedCommand:s,callback:r})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t))}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],n=t,s=e.slice();function r(o){return o.length>1&&o[0]==="-"}let l=null;for(;s.length;){let o=s.shift();if(o==="--"){n===i&&n.push(o),n.push(...s);break}if(l&&!r(o)){this.emit(`option:${l.name()}`,o);continue}if(l=null,r(o)){let h=this._findOption(o);if(h){if(h.required){let u=s.shift();u===void 0&&this.optionMissingArgument(h),this.emit(`option:${h.name()}`,u)}else if(h.optional){let u=null;s.length>0&&!r(s[0])&&(u=s.shift()),this.emit(`option:${h.name()}`,u)}else this.emit(`option:${h.name()}`);l=h.variadic?h:null;continue}}if(o.length>2&&o[0]==="-"&&o[1]!=="-"){let h=this._findOption(`-${o[1]}`);if(h){h.required||h.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${h.name()}`,o.slice(2)):(this.emit(`option:${h.name()}`),s.unshift(`-${o.slice(2)}`));continue}}if(/^--[^=]+=/.test(o)){let h=o.indexOf("="),u=this._findOption(o.slice(0,h));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,o.slice(h+1));continue}}if(r(o)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(o)){t.push(o),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&o===this._getHelpCommand().name()){t.push(o),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(o),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(o),s.length>0&&n.push(...s);break}n.push(o)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let n=this.options[i].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
17
+ - ${h}`;throw new Error(f)}else if(u.code==="EACCES")throw new Error(`'${r}' not executable`);if(!c)p.exit(1);else{let h=new K(1,"commander.executeSubCommandAsync","(error)");h.nestedError=u,c(h)}}),this.runningCommand=a}_dispatchSubcommand(e,t,i){let n=this._findCommand(e);n||this.help({error:!0});let s;return s=this._chainOrCallSubCommandHook(s,n,"preSubcommand"),s=this._chainOrCall(s,()=>{if(n._executableHandler)this._executeSubCommand(n,t.concat(i));else return n._parseCommand(t,i)}),s}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(i,n,s)=>{let r=n;if(n!==null&&i.parseArg){let l=`error: command-argument value '${n}' is invalid for argument '${i.name()}'.`;r=this._callParseArg(i,n,s,l)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((i,n)=>{let s=i.defaultValue;i.variadic?n<this.args.length?(s=this.args.slice(n),i.parseArg&&(s=s.reduce((r,l)=>e(i,l,r),i.defaultValue))):s===void 0&&(s=[]):n<this.args.length&&(s=this.args[n],i.parseArg&&(s=e(i,s,i.defaultValue))),t[n]=s}),this.processedArgs=t}_chainOrCall(e,t){return e&&e.then&&typeof e.then=="function"?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let i=e,n=[];return this._getCommandAndAncestors().reverse().filter(s=>s._lifeCycleHooks[t]!==void 0).forEach(s=>{s._lifeCycleHooks[t].forEach(r=>{n.push({hookedCommand:s,callback:r})})}),t==="postAction"&&n.reverse(),n.forEach(s=>{i=this._chainOrCall(i,()=>s.callback(s.hookedCommand,this))}),i}_chainOrCallSubCommandHook(e,t,i){let n=e;return this._lifeCycleHooks[i]!==void 0&&this._lifeCycleHooks[i].forEach(s=>{n=this._chainOrCall(n,()=>s(this,t))}),n}_parseCommand(e,t){let i=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(i.operands),t=i.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(i.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let n=()=>{i.unknown.length>0&&this.unknownOption(i.unknown[0])},s=`command:${this.name()}`;if(this._actionHandler){n(),this._processArguments();let r;return r=this._chainOrCallHooks(r,"preAction"),r=this._chainOrCall(r,()=>this._actionHandler(this.processedArgs)),this.parent&&(r=this._chainOrCall(r,()=>{this.parent.emit(s,e,t)})),r=this._chainOrCallHooks(r,"postAction"),r}if(this.parent&&this.parent.listenerCount(s))n(),this._processArguments(),this.parent.emit(s,e,t);else if(e.length){if(this._findCommand("*"))return this._dispatchSubcommand("*",e,t);this.listenerCount("command:*")?this.emit("command:*",e,t):this.commands.length?this.unknownCommand():(n(),this._processArguments())}else this.commands.length?(n(),this.help({error:!0})):(n(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(i=>{let n=i.attributeName();return this.getOptionValue(n)===void 0?!1:this.getOptionValueSource(n)!=="default"});e.filter(i=>i.conflictsWith.length>0).forEach(i=>{let n=e.find(s=>i.conflictsWith.includes(s.attributeName()));n&&this._conflictingOption(i,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],i=[],n=t,s=e.slice();function r(a){return a.length>1&&a[0]==="-"}let l=null;for(;s.length;){let a=s.shift();if(a==="--"){n===i&&n.push(a),n.push(...s);break}if(l&&!r(a)){this.emit(`option:${l.name()}`,a);continue}if(l=null,r(a)){let c=this._findOption(a);if(c){if(c.required){let u=s.shift();u===void 0&&this.optionMissingArgument(c),this.emit(`option:${c.name()}`,u)}else if(c.optional){let u=null;s.length>0&&!r(s[0])&&(u=s.shift()),this.emit(`option:${c.name()}`,u)}else this.emit(`option:${c.name()}`);l=c.variadic?c:null;continue}}if(a.length>2&&a[0]==="-"&&a[1]!=="-"){let c=this._findOption(`-${a[1]}`);if(c){c.required||c.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${c.name()}`,a.slice(2)):(this.emit(`option:${c.name()}`),s.unshift(`-${a.slice(2)}`));continue}}if(/^--[^=]+=/.test(a)){let c=a.indexOf("="),u=this._findOption(a.slice(0,c));if(u&&(u.required||u.optional)){this.emit(`option:${u.name()}`,a.slice(c+1));continue}}if(r(a)&&(n=i),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&i.length===0){if(this._findCommand(a)){t.push(a),s.length>0&&i.push(...s);break}else if(this._getHelpCommand()&&a===this._getHelpCommand().name()){t.push(a),s.length>0&&t.push(...s);break}else if(this._defaultCommandName){i.push(a),s.length>0&&i.push(...s);break}}if(this._passThroughOptions){n.push(a),s.length>0&&n.push(...s);break}n.push(a)}return{operands:t,unknown:i}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let i=0;i<t;i++){let n=this.options[i].attributeName();e[n]=n===this._versionOptionName?this._version:this[n]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}
18
18
  `,this._outputConfiguration.writeErr),typeof this._showHelpAfterError=="string"?this._outputConfiguration.writeErr(`${this._showHelpAfterError}
19
19
  `):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
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
- `),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.
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 p.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()}`,p.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new Xe(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(),a=this.getOptionValue(l),c=this.options.find(h=>h.negate&&l===h.attributeName()),u=this.options.find(h=>!h.negate&&l===h.attributeName());return c&&(c.presetArg===void 0&&a===!1||c.presetArg!==void 0&&a===c.presetArg)?c:u||r},n=r=>{let l=i(r),a=l.attributeName();return this.getOptionValueSource(a)==="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=le(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=le(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
+ `),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=>Ye(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=y.basename(e,y.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=p.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}=v(),{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 b=require("path"),me=require("fs");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),pe=y(require("figlet"),1),de=y(require("prompts"),1);var le={name:"create-vitnode-app",version:"0.0.7-canary.3",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:{lint:"eslint .","lint:fix":"eslint . --fix","build:scripts":"tsup index.ts","dev:script":"tsup index.ts --watch","start:script":"node dist/index.cjs"},dependencies:{figlet:"^1.7.0",picocolors:"^1.0.1",prompts:"^2.4.2","validate-npm-package-name":"^5.0.1"},devDependencies:{"@types/figlet":"^1.5.8","@types/node":"^20","@types/prompts":"^2.4.9","@types/validate-npm-package-name":"^4.0.2",commander:"^12.1.0",tsup:"^8.1.0",typescript:"^5","eslint-config-typescript-vitnode":"workspace:*"}};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 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)&&!n.endsWith(".iml"));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(`
23
+ `)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(n=>t.is(n))&&(this.outputHelp(),this._exit(0,"commander.helpDisplayed","(outputHelp)"))}};function ce(o){return o.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})}ue.Command=X});var fe=x(g=>{"use strict";var{Argument:pe}=j(),{Command:Q}=he(),{CommanderError:Qe,InvalidArgumentError:de}=V(),{Help:Ze}=J(),{Option:me}=z();g.program=new Q;g.createCommand=o=>new Q(o);g.createOption=(o,e)=>new me(o,e);g.createArgument=(o,e)=>new pe(o,e);g.Command=Q;g.Option=me;g.Argument=pe;g.Help=Ze;g.CommanderError=Qe;g.InvalidArgumentError=de;g.InvalidOptionArgumentError=de});var C=require("path"),Ve=require("fs");var ge=v(fe(),1),{program:ct,createCommand:ut,createArgument:ht,createOption:pt,CommanderError:dt,InvalidArgumentError:mt,InvalidOptionArgumentError:ft,Command:_e,Argument:gt,Option:be,Help:_t}=ge.default;var b=v(require("picocolors"),1),He=v(require("figlet"),1),Ne=v(require("prompts"),1);var Oe={name:"create-vitnode-app",version:"0.0.7-canary.39",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"},type:"module",bin:{"create-vitnode-app":"dist/index.cjs"},scripts:{lint:"eslint .","lint:fix":"eslint . --fix","build:scripts":"tsup index.ts","dev:script":"tsup index.ts --watch","start:script":"node dist/index.cjs"},dependencies:{figlet:"^1.7.0",picocolors:"^1.0.1",prompts:"^2.4.2","validate-npm-package-name":"^5.0.1"},devDependencies:{"@types/figlet":"^1.5.8","@types/node":"^20.14.11","@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","eslint-config-typescript-vitnode":"workspace:*"}};var Ce=v(require("validate-npm-package-name"),1),Z=({name:o})=>{let e=(0,Ce.default)(o);return e.validForNewPackages?{valid:!0}:{valid:!1,problems:[...e.errors||[],...e.warnings||[]]}};var D=require("fs"),ve=require("path"),ee=v(require("picocolors"),1);function F(o,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,D.readdirSync)(o).filter(n=>!t.includes(n)&&!n.endsWith(".iml"));if(i.length>0){console.log(`The directory ${ee.default.green(e)} contains files that could conflict:
24
+ `);for(let n of i)try{(0,D.lstatSync)((0,ve.join)(o,n)).isDirectory()?console.log(`${ee.default.blue(n)}/`):console.log(`${n}`)}catch{console.log(`${n}`)}return console.log(`
24
25
  Either try using a new directory name, or remove the files listed above.
25
- `),!1}return!0}var E="",C=new ae().version(le.version).argument("[project-directory]").usage(`${g.default.green("[project-directory]")} [options]`).action(a=>{E=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(pe.default.textSync("VitNode",{horizontalLayout:"full"}))),!E){let r=await(0,de.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"&&(E=r.path.trim())}E||(console.log(`
26
+ `),!1}return!0}var ye=require("constants"),we=require("fs/promises");async function Ae(o){try{return await(0,we.access)(o,ye.W_OK),!0}catch{return!1}}var m=require("fs"),_=require("path"),te=v(require("picocolors"),1);var $=require("fs"),H=require("path"),xe=({appName:o,root:e,packageManager:t,docker:i})=>{let n=JSON.parse((0,$.readFileSync)((0,H.join)(__dirname,"..","package.json"),"utf-8")),s={name:o,version:"1.0.0",private:!0,scripts:{"config:init":"turbo config:init",dev:"turbo dev",build:"turbo build",lint:"turbo lint","lint:fix":"turbo lint:fix",...i?{"docker:dev":"docker compose -f ./docker-compose-dev.yml -p vitnode-development up -d"}:{}},overrides:t.startsWith("npm")?{react:"^19.0.0-rc.0","react-dom":"^19.0.0-rc.0"}:{},dependencies:{"drizzle-kit":"^0.22.8","drizzle-orm":"^0.31.4"},devDependencies:{"eslint-config-typescript-vitnode":`^${n.version}`,prettier:"^3.3.3","prettier-plugin-tailwindcss":"^0.6.5",turbo:"^2.0.7",typescript:"^5.4.5"},packageManager:t,workspaces:["apps/*"]};(0,$.writeFileSync)((0,H.join)(e,"package.json"),JSON.stringify(s,null,2));let r={name:"frontend",version:"1.0.0",private:!0,scripts:{"config:init":"vitnode-frontend init",dev:"vitnode-frontend init && next dev --turbo",build:"next build",start:"next start",lint:"eslint .","lint:fix":"eslint . --fix"},dependencies:{geist:"^1.3.1",next:"15.0.0-canary.72",react:"^19.0.0-rc.0","react-dom":"^19.0.0-rc.0","next-intl":"^3.17.1","vitnode-frontend":`^${n.version}`},devDependencies:{"@types/node":"^20.14.11","@types/react":"^18.3.3","@types/react-dom":"^18.3.0",autoprefixer:"^10.4.19",eslint:"^8.57.0","eslint-config-typescript-vitnode":`^${n.version}`,postcss:"^8.4.39",tailwindcss:"^3.4.4",typescript:"^5.5.3"}};(0,$.writeFileSync)((0,H.join)(e,"apps","frontend","package.json"),JSON.stringify(r,null,2));let l={name:"backend",version:"1.0.0",private:!0,scripts:{"config:init":"vitnode-backend init",dev:"vitnode-backend init && cross-env NODE_ENV=development nest start -w",build:"nest build",start:"node dist/main",lint:"eslint .","lint:fix":"eslint . --fix"},dependencies:{"@nestjs/common":"^10.3.10","@nestjs/core":"^10.3.10","@nestjs/graphql":"^12.2.0","@react-email/components":"^0.0.21",react:"^19.0.0-rc.0","react-dom":"^19.0.0-rc.0","reflect-metadata":"^0.2.2","vitnode-backend":`^${n.version}`},devDependencies:{"@nestjs/cli":"^10.4.2","@nestjs/platform-express":"^10.3.10","@nestjs/schematics":"^10.1.2","@types/express":"^4.17.21","@types/node":"^20.14.11","@types/pg":"^8.11.6","@types/react":"^18.3.3","cross-env":"^7.0.3","drizzle-kit":"^0.22.8","drizzle-orm":"^0.31.4",eslint:"^8.57.0","eslint-config-typescript-vitnode":`^${n.version}`,pg:"^8.12.0","source-map-support":"^0.5.21","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0",typescript:"^5.5.3"}};(0,$.writeFileSync)((0,H.join)(e,"apps","backend","package.json"),JSON.stringify(l,null,2))};var ke=async({root:o,appName:e,packageManager:t,eslint:i,i18nRouting:n,docker:s})=>{let r=(0,_.join)(__dirname,"..","templates");if(console.log(`Creating a new VitNode app in ${te.default.green(o)}. Using ${te.default.green(t)}...
27
+ `),(0,m.mkdirSync)(o,{recursive:!0}),F(o,e)||process.exit(1),process.chdir(o),(0,m.cpSync)((0,_.join)(r,"basic"),o,{recursive:!0}),xe({appName:e,root:o,packageManager:t,docker:s}),(0,m.renameSync)((0,_.join)(o,".gitignore_template"),(0,_.join)(o,".gitignore")),(0,m.renameSync)((0,_.join)(o,".npmrc_template"),(0,_.join)(o,".npmrc")),t.startsWith("pnpm")){let l=(0,_.join)(o,"apps","frontend","tailwind.config.ts"),c=(0,m.readFileSync)(l,"utf-8").replace("../../node_modules/vitnode-frontend/src/components/**/*.tsx","./node_modules/vitnode-frontend/src/components/**/*.tsx").replace("../../node_modules/vitnode-frontend/src/views/**/*.tsx","./node_modules/vitnode-frontend/src/views/**/*.tsx");(0,m.writeFileSync)(l,c)}t.startsWith("pnpm")&&(0,m.cpSync)((0,_.join)(r,"pnpm"),o,{recursive:!0}),i&&(0,m.cpSync)((0,_.join)(r,"eslint"),o,{recursive:!0}),(0,m.cpSync)(n?(0,_.join)(r,"i18n","with"):(0,_.join)(r,"i18n","without"),o,{recursive:!0})};var E=v(require("picocolors"),1),S=v(require("prompts"),1);var $e=require("child_process"),ie=async o=>new Promise(e=>{(0,$e.exec)(o,(t,i,n)=>{t&&e(void 0),e((i||n).replace(/\s+/g,""))})}),Ee=async()=>{let[o,e,t]=await Promise.all([ie("yarnpkg --version"),ie("npm --version"),ie("pnpm --version")]);return{yarn:o,pnpm:t,npm:e}};var k=o=>{o.aborted&&(process.stdout.write("\x1B[?25h"),process.stdout.write(`
28
+ `),process.exit(1))},Se=async o=>{let e=o.opts(),t={packageManager:e.packageManager,eslint:e.eslint,i18nRouting:e.i18nRouting,install:!e.skipInstall,docker:e.docker};if(!e.packageManager){let i=await Ee(),n=E.default.blue("package manager"),{packageManager:s}=await(0,S.default)({onState:k,name:"packageManager",type:"select",message:`Which ${n} do you want to use?`,initial:e.packageManager,choices:[{title:`npm${i.npm?`@${i.npm}`:""}`,value:"npm",disabled:!i.npm},{title:`pnpm${i.pnpm?`@${i.pnpm}`:""}`,value:"pnpm",disabled:!i.pnpm},{title:`yarn${i.yarn?`@${i.yarn}`:""}`,value:"yarn",disabled:!i.yarn}]});t={...t,packageManager:`${s}@${i[s]}`}}if(e.eslint===void 0){let i=E.default.blue("ESLint"),{eslint:n}=await(0,S.default)({onState:k,type:"toggle",name:"eslint",message:`Would you like to use ${i}?`,initial:e.eslint?"Yes":"No",active:"Yes",inactive:"No"});t={...t,eslint:!!n}}if(e.i18nRouting===void 0){let i=E.default.blue("i18n routing"),{i18nRouting:n}=await(0,S.default)({onState:k,type:"toggle",name:"i18nRouting",message:`Would you like to use ${i}?`,initial:e.i18nRouting?"Yes":"No",active:"Yes",inactive:"No"});t={...t,i18nRouting:!!n}}if(e.docker===void 0){let i=E.default.blue("Dockerfile & Docker Compose"),{docker:n}=await(0,S.default)({onState:k,type:"toggle",name:"docker",message:`Would you like to create ${i}?`,initial:e.i18nRouting?"Yes":"No",active:"Yes",inactive:"No"});t={...t,docker:!!n}}if(e.skipInstall===void 0){let i=E.default.blue("Install dependencies"),{install:n}=await(0,S.default)({onState:k,type:"toggle",name:"install",message:`Would you like to ${i}?`,initial:e.eslint?"Yes":"No",active:"Yes",inactive:"No"});t={...t,install:!!n}}return console.log("program",t),t};var N="",O=new _e().version(Oe.version).argument("[project-directory]").usage(`${b.default.green("[project-directory]")} [options]`).action(o=>{N=o});O.addOption(new be("-pm, --package-manager <package-manager>","Specify the package manager to use").choices(["npm","pnpm","yarn"]));O.option("--eslint","Initialize with eslint config.");O.option("--docker","Initialize with Dockerfile & Docker Compose.");O.option("--no-eslint","Initialize without eslint config.");O.option("--i18n-routing","Initialize with i18n routing.");O.option("--skip-install","Skip installing packages after initializing the project.");O.parse(process.argv);(async()=>{if(console.log(b.default.blue(He.default.textSync("VitNode",{horizontalLayout:"full"}))),!N){let l=await(0,Ne.default)({onState:k,type:"text",name:"path",message:"What is your project named?",initial:"my-vitnode",validate:a=>{let c=Z({name:(0,C.basename)((0,C.resolve)(a))});return c.valid?!0:`Invalid project name: ${c.problems[0]}`}});typeof l.path=="string"&&(N=l.path.trim())}N||(console.log(`
26
29
  Please specify the project directory:
27
- ${g.default.cyan(C.name())} ${g.default.green("<project-directory>")}
30
+ ${b.default.cyan(O.name())} ${b.default.green("<project-directory>")}
28
31
  For example:
29
- ${g.default.cyan(C.name())} ${g.default.green("my-vitnode-app")}
32
+ ${b.default.cyan(O.name())} ${b.default.green("my-vitnode-app")}
30
33
 
31
- Run ${g.default.cyan(`${C.name()} --help`)} to see all options.`),process.exit(1));let a=(0,b.resolve)(E),e=(0,b.basename)(a),t=G({name:e});t.valid||(console.error(`Could not create a project called ${g.default.red(`"${e}"`)} because of npm naming restrictions:`),t.problems.forEach(r=>console.error(`${g.default.red(g.default.bold("*"))} ${r}`)),process.exit(1));let i=(0,b.resolve)(a),n=(0,b.basename)(i);(0,me.existsSync)(i)&&!ce(i,n)&&process.exit(1),console.log(`Creating a new VitNode app in ${a}.
32
- `)})();
34
+ Run ${b.default.cyan(`${O.name()} --help`)} to see all options.`),process.exit(1));let o=(0,C.resolve)(N),e=(0,C.basename)(o),t=Z({name:e});t.valid||(console.error(`Could not create a project called ${b.default.red(`"${e}"`)} because of npm naming restrictions:`),t.problems.forEach(l=>console.error(`${b.default.red(b.default.bold("*"))} ${l}`)),process.exit(1));let i=(0,C.resolve)(o),n=(0,C.basename)(i);(0,Ve.existsSync)(i)&&!F(i,n)&&(console.error("The specified directory is not empty."),process.exit(1)),await Ae((0,C.dirname)(i))||(console.error("The application path is not writable, please check folder permissions and try again."),console.error("It is likely you do not have write permissions for this folder."),process.exit(1));let r=await Se(O);await ke({root:i,appName:n,...r})})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vitnode-app",
3
- "version": "0.0.7-canary.4",
3
+ "version": "0.0.7-canary.40",
4
4
  "description": "Create a new VitNode app in seconds.",
5
5
  "author": "VitNode Team",
6
6
  "license": "MIT",
@@ -10,9 +10,6 @@
10
10
  "url": "git+https://github.com/aXenDeveloper/VitNode.git",
11
11
  "directory": "packages/create-vitnode-app"
12
12
  },
13
- "files": [
14
- "dist"
15
- ],
16
13
  "type": "module",
17
14
  "bin": {
18
15
  "create-vitnode-app": "dist/index.cjs"
@@ -25,13 +22,13 @@
25
22
  },
26
23
  "devDependencies": {
27
24
  "@types/figlet": "^1.5.8",
28
- "@types/node": "^20",
25
+ "@types/node": "^20.14.11",
29
26
  "@types/prompts": "^2.4.9",
30
27
  "@types/validate-npm-package-name": "^4.0.2",
31
28
  "commander": "^12.1.0",
32
29
  "tsup": "^8.1.0",
33
- "typescript": "^5",
34
- "eslint-config-typescript-vitnode": "0.0.7-canary.4"
30
+ "typescript": "^5.5.3",
31
+ "eslint-config-typescript-vitnode": "0.0.7-canary.40"
35
32
  },
36
33
  "scripts": {
37
34
  "lint": "eslint .",
@@ -0,0 +1,55 @@
1
+ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
+
3
+ # Dependencies
4
+ node_modules
5
+ .pnp
6
+ .pnp.js
7
+
8
+ # Local env files
9
+ .env
10
+ .env.local
11
+ .env.development.local
12
+ .env.test.local
13
+ .env.production.local
14
+
15
+ # Testing
16
+ coverage
17
+
18
+ # Turbo
19
+ .turbo
20
+
21
+ # Vercel
22
+ .vercel
23
+
24
+ # Build Outputs
25
+ .next/
26
+ out/
27
+ build
28
+ dist
29
+
30
+
31
+ # Debug
32
+ npm-debug.log*
33
+ yarn-debug.log*
34
+ yarn-error.log*
35
+
36
+ # Misc
37
+ .DS_Store
38
+ *.pem
39
+
40
+ # Docker
41
+ /docker
42
+
43
+ # Others
44
+ /apps/backend/uploads/public/*
45
+ /apps/backend/uploads/private/*
46
+ /apps/backend/uploads/temp/*
47
+ !/apps/backend/uploads/index.html
48
+ !/apps/backend/uploads/public/index.html
49
+ !/apps/backend/uploads/private/index.html
50
+ !/apps/backend/uploads/temp/index.html
51
+ /apps/backend/schema.gql
52
+
53
+ # Configuration
54
+ /apps/backend/src/plugins/*/admin/database/migrations
55
+ /apps/backend/src/plugins/core/
@@ -0,0 +1 @@
1
+ package-manager-strict=false
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/nest-cli",
3
+ "collection": "@nestjs/schematics",
4
+ "sourceRoot": "src",
5
+ "compilerOptions": {
6
+ "deleteOutDir": true,
7
+ "builder": {
8
+ "type": "swc",
9
+ "options": {
10
+ "extensions": [".ts", ".tsx"]
11
+ }
12
+ },
13
+ "typeCheck": true
14
+ }
15
+ }
@@ -0,0 +1,23 @@
1
+ import { join } from 'path';
2
+
3
+ import { Module } from '@nestjs/common';
4
+ import { VitNodeCoreModule } from 'vitnode-backend';
5
+
6
+ import { PluginsModule } from './plugins/plugins.module';
7
+ import { DATABASE_ENVS, schemaDatabase } from './database';
8
+
9
+ @Module({
10
+ imports: [
11
+ VitNodeCoreModule.register({
12
+ paths: {
13
+ envFile: join(process.cwd(), '..', '..', '.env'),
14
+ },
15
+ database: {
16
+ config: DATABASE_ENVS,
17
+ schemaDatabase,
18
+ },
19
+ }),
20
+ PluginsModule,
21
+ ],
22
+ })
23
+ export class AppModule {}
@@ -0,0 +1,19 @@
1
+ // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
2
+
3
+ import tableCore from '@/plugins/core/admin/database/index';
4
+ import tableWelcome from '@/plugins/welcome/admin/database/index';
5
+ // ! === IMPORT ===
6
+
7
+ export const schemaDatabase = {
8
+ ...tableWelcome,
9
+ // ! === MODULE ===
10
+ ...tableCore,
11
+ };
12
+
13
+ export const DATABASE_ENVS = {
14
+ host: process.env.DB_HOST || 'localhost',
15
+ port: process.env.DB_PORT ? +process.env.DB_PORT : 5432,
16
+ user: process.env.DB_USER || 'root',
17
+ password: process.env.DB_PASSWORD || 'root',
18
+ database: process.env.DB_DATABASE || 'vitnode',
19
+ };
@@ -0,0 +1,27 @@
1
+ /* eslint-disable no-console */
2
+ import { NestFactory } from '@nestjs/core';
3
+ import { INestApplication } from '@nestjs/common';
4
+ import { nestjsMainApp } from 'vitnode-backend';
5
+
6
+ import { AppModule } from './app.module';
7
+
8
+ async function bootstrap() {
9
+ const app: INestApplication = await NestFactory.create(AppModule);
10
+
11
+ nestjsMainApp(app, {
12
+ cors: {
13
+ origin: [
14
+ process.env.NEXT_PUBLIC_FRONTEND_URL
15
+ ? process.env.NEXT_PUBLIC_FRONTEND_URL
16
+ : 'http://localhost:3000',
17
+ ],
18
+ },
19
+ });
20
+
21
+ await app.listen(process.env.PORT ?? '8080', null, () => {
22
+ console.log(
23
+ `Application is running on: http://localhost:${process.env.PORT ?? 8080}/graphql`,
24
+ );
25
+ });
26
+ }
27
+ bootstrap();
@@ -0,0 +1,14 @@
1
+ // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
2
+
3
+ import { Module } from '@nestjs/common';
4
+
5
+ import { WelcomeModule } from './welcome/welcome.module';
6
+ // ! === IMPORT ===
7
+
8
+ @Module({
9
+ imports: [
10
+ WelcomeModule,
11
+ // ! === MODULE ===
12
+ ],
13
+ })
14
+ export class PluginsModule {}
@@ -0,0 +1,4 @@
1
+ import { Module } from '@nestjs/common';
2
+
3
+ @Module({})
4
+ export class AdminWelcomeModule {}
@@ -0,0 +1,11 @@
1
+ // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
2
+ import { defineConfig } from 'drizzle-kit';
3
+
4
+ import { DATABASE_ENVS } from '@/database';
5
+
6
+ export default defineConfig({
7
+ dialect: 'postgresql',
8
+ dbCredentials: DATABASE_ENVS,
9
+ schema: './plugins/welcome/admin/database/schema/*.ts',
10
+ out: './plugins/welcome/admin/database/migrations/',
11
+ });
@@ -0,0 +1,6 @@
1
+ // ! DO NOT REMOVE, MODIFY OR MOVE THIS FILE!!!
2
+ import { default as tables } from './index';
3
+
4
+ export const getTables = () => {
5
+ return Object.keys(tables);
6
+ };
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "Welcome",
3
+ "description": "Basic plugin with default page.",
4
+ "code": "welcome",
5
+ "author": "VitNode",
6
+ "author_url": "https://vitnode.com/",
7
+ "support_url": "https://github.com/aXenDeveloper/vitnode/issues",
8
+ "allow_default": true,
9
+ "nav": []
10
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "10000": "1.0.0"
3
+ }
@@ -0,0 +1,8 @@
1
+ import { Module } from '@nestjs/common';
2
+
3
+ import { AdminWelcomeModule } from './admin/admin.module';
4
+
5
+ @Module({
6
+ imports: [AdminWelcomeModule],
7
+ })
8
+ export class WelcomeModule {}
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["node_modules", "test", "dist", "**/*spec.ts", "uploads"]
4
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "eslint-config-typescript-vitnode/tsconfig.nest.json",
4
+ "compilerOptions": {
5
+ "target": "ESNext",
6
+ "module": "commonjs",
7
+ "baseUrl": "./",
8
+ "outDir": "./dist",
9
+ "paths": {
10
+ "@/*": ["./src/*", "./node_modules/vitnode-backend/dist/*"]
11
+ }
12
+ },
13
+ "exclude": ["uploads"]
14
+ }
@@ -0,0 +1,82 @@
1
+ @tailwind components;
2
+ @tailwind utilities;
3
+ @tailwind base;
4
+
5
+ @layer base {
6
+ * {
7
+ @apply border-border;
8
+ }
9
+
10
+ body {
11
+ @apply bg-background text-foreground;
12
+ }
13
+
14
+ a {
15
+ @apply text-primary;
16
+ @apply cursor-pointer;
17
+ }
18
+
19
+ :root {
20
+ --background: 220 40% 98%;
21
+ --foreground: 213deg 5% 8%;
22
+ --card: 220 40% 100%;
23
+ --card-foreground: 213deg 26% 7%;
24
+ --popover: var(--card);
25
+ --popover-foreground: var(--card-foreground);
26
+ --primary: 220 74% 50%;
27
+ --primary-foreground: 220 40% 98%;
28
+ --secondary: 0 0% 100%;
29
+ --secondary-foreground: 210 40% 2%;
30
+ --muted: 220 40% 96%;
31
+ --muted-foreground: 220 8% 44%;
32
+ --accent: 220 40% 92%;
33
+ --accent-foreground: 222 47% 11%;
34
+ --destructive: 0 57% 43%;
35
+ --destructive-foreground: 210 40% 98%;
36
+ --border: 220 20% 90%;
37
+ --input: var(--border);
38
+ --ring: var(--primary);
39
+ --radius: 0.5rem;
40
+ --cover: 220 80% 67%;
41
+ --cover-foreground: 210 40% 98%;
42
+ }
43
+
44
+ .dark {
45
+ --background: 216 32% 7%;
46
+ --foreground: 0 0% 98%;
47
+ --card: 216 32% 10%;
48
+ --card-foreground: 0 0% 98%;
49
+ /* --popover: var(--card); */
50
+ /* --popover-foreground: var(--card-foreground); */
51
+ --primary: 216 84% 59%;
52
+ --primary-foreground: 216 40% 98%;
53
+ --secondary: 222 25% 18%;
54
+ --secondary-foreground: 0 0% 98%;
55
+ --muted: 216 32% 11%;
56
+ --muted-foreground: 216 18% 64%;
57
+ --accent: 216 32% 14%;
58
+ --accent-foreground: 0 0% 98%;
59
+ --destructive: 359 78% 55%;
60
+ --destructive-foreground: 210 40% 98%;
61
+ --border: 216 25% 16%;
62
+ /* --input: var(--border); */
63
+ /* --ring: var(--primary); */
64
+ --cover: 216 64% 39%;
65
+ --cover-foreground: 210 40% 98%;
66
+ }
67
+ }
68
+
69
+ @layer utilities {
70
+ .underline-strike-through {
71
+ text-decoration: underline line-through;
72
+ }
73
+
74
+ .no-scrollbar {
75
+ -ms-overflow-style: none;
76
+ scrollbar-width: none;
77
+
78
+ &::-webkit-scrollbar {
79
+ display: none;
80
+ }
81
+ }
82
+ }
@@ -0,0 +1,9 @@
1
+ import './global.css';
2
+
3
+ export default async function RootLayout({
4
+ children,
5
+ }: {
6
+ children: React.ReactNode;
7
+ }) {
8
+ return children;
9
+ }
@@ -0,0 +1,13 @@
1
+ import { getRequestConfig } from 'next-intl/server';
2
+ import { i18nConfig } from 'vitnode-frontend/i18n';
3
+
4
+ export default getRequestConfig(async args => {
5
+ const config = await i18nConfig({
6
+ ...args,
7
+ pathsToMessagesFromPlugins: async ({ plugin, locale }) => {
8
+ return import(`./plugins/${plugin}/langs/${locale}.json`);
9
+ },
10
+ });
11
+
12
+ return config;
13
+ });
@@ -0,0 +1,7 @@
1
+ import createMiddleware from 'vitnode-frontend/middleware';
2
+
3
+ export default createMiddleware();
4
+
5
+ export const config = {
6
+ matcher: '/((?!_next/static|_next/image|robots.txt|sitemap.xml|sitemap).*)',
7
+ };
@@ -0,0 +1,6 @@
1
+ import VitNodeConfig from 'vitnode-frontend/next.config';
2
+
3
+ /** @type {import('next').NextConfig} */
4
+ const nextConfig = {};
5
+
6
+ export default VitNodeConfig(nextConfig);
@@ -0,0 +1,5 @@
1
+ {
2
+ "welcome": {
3
+ "admin": {}
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "welcome": {
3
+ "admin": {}
4
+ }
5
+ }
@@ -0,0 +1,3 @@
1
+ export default function DefaultPage() {
2
+ return <div className="container my-4">Default Page for welcome</div>;
3
+ }
@@ -0,0 +1,9 @@
1
+ /** @type {import('postcss-load-config').Config} */
2
+ const config = {
3
+ plugins: {
4
+ tailwindcss: {},
5
+ autoprefixer: {},
6
+ },
7
+ };
8
+
9
+ export default config;
@@ -0,0 +1,15 @@
1
+ import { Config } from 'tailwindcss';
2
+ import vitnodeConfig from 'vitnode-frontend/tailwind.config';
3
+
4
+ const config = {
5
+ presets: [vitnodeConfig],
6
+ content: [
7
+ '../../node_modules/vitnode-frontend/src/components/**/*.tsx',
8
+ '../../node_modules/vitnode-frontend/src/views/**/*.tsx',
9
+ './components/**/*.{ts,tsx}',
10
+ './app/**/*.{ts,tsx}',
11
+ './plugins/templates/**/*.{ts,tsx}',
12
+ ],
13
+ } satisfies Config;
14
+
15
+ export default config;
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "eslint-config-typescript-vitnode/tsconfig.next.json",
4
+ "compilerOptions": {
5
+ "target": "ES2022",
6
+ "module": "ESNext",
7
+ "baseUrl": "./",
8
+ "lib": ["dom", "dom.iterable", "esnext"],
9
+ "plugins": [
10
+ {
11
+ "name": "next"
12
+ }
13
+ ],
14
+ "paths": {
15
+ "@/*": ["./*"]
16
+ }
17
+ },
18
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
19
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "eslint-config-typescript-vitnode/tsconfig.shared.json"
4
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "https://turbo.build/schema.json",
3
+ "tasks": {
4
+ "build": {
5
+ "outputs": [".next/**", "!.next/cache/**", "dist/**"],
6
+ "dependsOn": ["^build"]
7
+ },
8
+ "start": {
9
+ "outputs": [".next/**", "!.next/cache/**", "dist/**"],
10
+ "dependsOn": ["^start"],
11
+ "persistent": true
12
+ },
13
+ "config:init": {
14
+ "dependsOn": ["^config:init"]
15
+ },
16
+ "lint": {
17
+ "dependsOn": ["^lint"]
18
+ },
19
+ "lint:fix": {
20
+ "dependsOn": ["^lint:fix"]
21
+ },
22
+ "dev": {
23
+ "cache": false,
24
+ "persistent": true
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,160 @@
1
+ import { readFileSync, writeFileSync } from 'fs';
2
+ import { join } from 'path';
3
+
4
+ interface PackageJSON {
5
+ name: string;
6
+ private: boolean;
7
+ version: string;
8
+ dependencies?: Record<string, string>;
9
+ devDependencies?: Record<string, string>;
10
+ overrides?: Record<string, string>;
11
+ packageManager?: string;
12
+ scripts?: Record<string, string>;
13
+ workspaces?: string[];
14
+ }
15
+
16
+ export const createPackagesJSON = ({
17
+ appName,
18
+ root,
19
+ packageManager,
20
+ docker,
21
+ }: {
22
+ appName: string;
23
+ docker: boolean;
24
+ packageManager: string;
25
+ root: string;
26
+ }) => {
27
+ const pkg: PackageJSON = JSON.parse(
28
+ readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'),
29
+ );
30
+
31
+ const basePackageJSON: PackageJSON = {
32
+ name: appName,
33
+ version: '1.0.0',
34
+ private: true,
35
+ scripts: {
36
+ 'config:init': 'turbo config:init',
37
+ dev: 'turbo dev',
38
+ build: 'turbo build',
39
+ lint: 'turbo lint',
40
+ 'lint:fix': 'turbo lint:fix',
41
+ ...(docker
42
+ ? {
43
+ 'docker:dev':
44
+ 'docker compose -f ./docker-compose-dev.yml -p vitnode-development up -d',
45
+ }
46
+ : {}),
47
+ },
48
+ overrides: packageManager.startsWith('npm')
49
+ ? {
50
+ react: '^19.0.0-rc.0',
51
+ 'react-dom': '^19.0.0-rc.0',
52
+ }
53
+ : {},
54
+ dependencies: {
55
+ 'drizzle-kit': '^0.22.8',
56
+ 'drizzle-orm': '^0.31.4',
57
+ },
58
+ devDependencies: {
59
+ 'eslint-config-typescript-vitnode': `^${pkg.version}`,
60
+ prettier: '^3.3.3',
61
+ 'prettier-plugin-tailwindcss': '^0.6.5',
62
+ turbo: '^2.0.7',
63
+ typescript: '^5.4.5',
64
+ },
65
+ packageManager,
66
+ workspaces: ['apps/*'],
67
+ };
68
+
69
+ writeFileSync(
70
+ join(root, 'package.json'),
71
+ JSON.stringify(basePackageJSON, null, 2),
72
+ );
73
+
74
+ const frontendPackagesJSON: PackageJSON = {
75
+ name: 'frontend',
76
+ version: '1.0.0',
77
+ private: true,
78
+ scripts: {
79
+ 'config:init': 'vitnode-frontend init',
80
+ dev: 'vitnode-frontend init && next dev --turbo',
81
+ build: 'next build',
82
+ start: 'next start',
83
+ lint: 'eslint .',
84
+ 'lint:fix': 'eslint . --fix',
85
+ },
86
+ dependencies: {
87
+ geist: '^1.3.1',
88
+ next: '15.0.0-canary.72',
89
+ react: '^19.0.0-rc.0',
90
+ 'react-dom': '^19.0.0-rc.0',
91
+ 'next-intl': '^3.17.1',
92
+ 'vitnode-frontend': `^${pkg.version}`,
93
+ },
94
+ devDependencies: {
95
+ '@types/node': '^20.14.11',
96
+ '@types/react': '^18.3.3',
97
+ '@types/react-dom': '^18.3.0',
98
+ autoprefixer: '^10.4.19',
99
+ eslint: '^8.57.0',
100
+ 'eslint-config-typescript-vitnode': `^${pkg.version}`,
101
+ postcss: '^8.4.39',
102
+ tailwindcss: '^3.4.4',
103
+ typescript: '^5.5.3',
104
+ },
105
+ };
106
+
107
+ writeFileSync(
108
+ join(root, 'apps', 'frontend', 'package.json'),
109
+ JSON.stringify(frontendPackagesJSON, null, 2),
110
+ );
111
+
112
+ const backendPackagesJSON: PackageJSON = {
113
+ name: 'backend',
114
+ version: '1.0.0',
115
+ private: true,
116
+ scripts: {
117
+ 'config:init': 'vitnode-backend init',
118
+ dev: 'vitnode-backend init && cross-env NODE_ENV=development nest start -w',
119
+ build: 'nest build',
120
+ start: 'node dist/main',
121
+ lint: 'eslint .',
122
+ 'lint:fix': 'eslint . --fix',
123
+ },
124
+ dependencies: {
125
+ '@nestjs/common': '^10.3.10',
126
+ '@nestjs/core': '^10.3.10',
127
+ '@nestjs/graphql': '^12.2.0',
128
+ '@react-email/components': '^0.0.21',
129
+ react: '^19.0.0-rc.0',
130
+ 'react-dom': '^19.0.0-rc.0',
131
+ 'reflect-metadata': '^0.2.2',
132
+ 'vitnode-backend': `^${pkg.version}`,
133
+ },
134
+ devDependencies: {
135
+ '@nestjs/cli': '^10.4.2',
136
+ '@nestjs/platform-express': '^10.3.10',
137
+ '@nestjs/schematics': '^10.1.2',
138
+ '@types/express': '^4.17.21',
139
+ '@types/node': '^20.14.11',
140
+ '@types/pg': '^8.11.6',
141
+ '@types/react': '^18.3.3',
142
+ 'cross-env': '^7.0.3',
143
+ 'drizzle-kit': '^0.22.8',
144
+ 'drizzle-orm': '^0.31.4',
145
+ eslint: '^8.57.0',
146
+ 'eslint-config-typescript-vitnode': `^${pkg.version}`,
147
+ pg: '^8.12.0',
148
+ 'source-map-support': '^0.5.21',
149
+ 'ts-loader': '^9.5.1',
150
+ 'ts-node': '^10.9.2',
151
+ 'tsconfig-paths': '^4.2.0',
152
+ typescript: '^5.5.3',
153
+ },
154
+ };
155
+
156
+ writeFileSync(
157
+ join(root, 'apps', 'backend', 'package.json'),
158
+ JSON.stringify(backendPackagesJSON, null, 2),
159
+ );
160
+ };
@@ -0,0 +1,35 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ database:
5
+ container_name: vitnode_postgres_development
6
+ image: postgres:16.3-alpine
7
+ restart: unless-stopped
8
+ environment:
9
+ POSTGRES_USER: ${DB_USER-root}
10
+ POSTGRES_PASSWORD: ${DB_PASSWORD-root}
11
+ POSTGRES_DB: vitnode
12
+ command: ['postgres', '-c', 'log_statement=all'] # log all sql queries
13
+ volumes:
14
+ - ./docker/dev/database:/var/lib/postgresql/data
15
+ ports:
16
+ - '5432:5432'
17
+ networks:
18
+ - vitnode_dev
19
+
20
+ pgadmin:
21
+ container_name: vitnode_pgadmin_development
22
+ image: dpage/pgadmin4:latest
23
+ restart: unless-stopped
24
+ environment:
25
+ PGADMIN_DEFAULT_EMAIL: admin@admin.com
26
+ PGADMIN_DEFAULT_PASSWORD: admin
27
+ ports:
28
+ - '5050:80'
29
+ depends_on:
30
+ - database
31
+ networks:
32
+ - vitnode_dev
33
+
34
+ networks:
35
+ vitnode_dev:
@@ -0,0 +1,11 @@
1
+ import vitnodePrettier from "eslint-config-typescript-vitnode/prettierrc.mjs";
2
+
3
+ /**
4
+ * @see https://prettier.io/docs/en/configuration.html
5
+ * @type {import("prettier").Config}
6
+ */
7
+ const config = {
8
+ ...vitnodePrettier,
9
+ };
10
+
11
+ export default config;
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/eslintrc",
3
+ "extends": ["eslint-config-typescript-vitnode/.eslintrc.shared.json"],
4
+ "ignorePatterns": ["uploads"]
5
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/eslintrc",
3
+ "extends": ["eslint-config-typescript-vitnode/.eslintrc.react.json"]
4
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { GeistSans } from 'geist/font/sans';
3
+ import {
4
+ RootLayout,
5
+ RootLayoutProps,
6
+ generateMetadataRootLayout,
7
+ } from 'vitnode-frontend/views/layout/root-layout';
8
+
9
+ export const generateMetadata = generateMetadataRootLayout;
10
+
11
+ export default function Layout(props: RootLayoutProps) {
12
+ return <RootLayout className={GeistSans.className} {...props} />;
13
+ }
@@ -0,0 +1,9 @@
1
+ import './global.css';
2
+
3
+ export default async function RootLayout({
4
+ children,
5
+ }: {
6
+ children: React.ReactNode;
7
+ }) {
8
+ return children;
9
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { GeistSans } from 'geist/font/sans';
3
+ import {
4
+ RootLayout,
5
+ RootLayoutProps,
6
+ generateMetadataRootLayout,
7
+ } from 'vitnode-frontend/views/layout/root-layout';
8
+ import './global.css';
9
+
10
+ export const generateMetadata = generateMetadataRootLayout;
11
+
12
+ export default function Layout(props: RootLayoutProps) {
13
+ return <RootLayout className={GeistSans.className} {...props} />;
14
+ }
@@ -0,0 +1,2 @@
1
+ packages:
2
+ - 'apps/*'