create-tezx-app 4.0.3 → 4.0.9

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 (2) hide show
  1. package/bin +106 -70
  2. package/package.json +1 -1
package/bin CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import{execSync as B}from"node:child_process";import{mkdirSync as S,writeFileSync as q}from"node:fs";import k,{join as V,resolve as J}from"node:path";import W from"node:readline";var p=(n,s)=>({version:s,npm:["npm install",n],bun:["bun add",n],yarn:["yarn add",n],pnpm:["pnpm add",n]});var $={readme:`
2
+ var O = Object.defineProperty; var c = (o, s) => O(o, "name", { value: s, configurable: !0 }); import { execSync as j } from "node:child_process"; import { mkdirSync as v, writeFileSync as h } from "node:fs"; import k, { join as g, resolve as A } from "node:path"; import T from "node:readline"; const d = c((o, s) => ({ version: s, npm: ["npm install", o], bun: ["bun add", o], yarn: ["yarn add", o], pnpm: ["pnpm add", o] }), "packageManagerCommands"), I = {
3
+ readme: `
3
4
  # \u{1F510} GitHub OAuth2 Example for TezX
4
5
 
5
6
  This example demonstrates how to implement GitHub OAuth2 login using \`@tezx/github-oauth2\`.
@@ -20,7 +21,7 @@ This example demonstrates how to implement GitHub OAuth2 login using \`@tezx/git
20
21
  ### 1. Install the required package
21
22
 
22
23
  \`\`\`bash
23
- ${Object.values(p("@tezx/github-oauth2","^1.0.9"))?.filter(n=>typeof n!="string")?.join(`
24
+ ${Object.values(d("@tezx/github-oauth2", "^1.0.9"))?.filter(o => typeof o != "string")?.join(`
24
25
  #or
25
26
  `)}
26
27
  \`\`\`
@@ -91,7 +92,7 @@ app.get('/github/callback', verifyGithubToken({
91
92
  ---
92
93
 
93
94
  Login securely and build smarter auth with TezX! \u{1F680}
94
- `.trim(),content:`
95
+ `.trim(), content: `
95
96
  // 1. Initialize OAuth2 client
96
97
  const client = GitHubOauthClient({
97
98
  clientId: process.env.GITHUB_CLIENT_ID,
@@ -121,8 +122,12 @@ app.get('/github/callback', verifyGithubToken({
121
122
  }), async (ctx) => {
122
123
  return ctx.json({ success: true });
123
124
  });
124
- `.trim(),files:[{content:`GITHUB_CLIENT_ID=12323
125
- GITHUB_CLIENT_SECRET=234234`,path:".env"}],import:["import { GitHubOauthClient, getGithubOAuthURL, verifyGithubToken } from '@tezx/github-oauth2';"],package:[p("@tezx/github-oauth2","^1.0.9")]};var C={readme:`
125
+ `.trim(), files: [{
126
+ content: `GITHUB_CLIENT_ID=12323
127
+ GITHUB_CLIENT_SECRET=234234`, path: ".env"
128
+ }], import: ["import { GitHubOauthClient, getGithubOAuthURL, verifyGithubToken } from '@tezx/github-oauth2';"], package: [d("@tezx/github-oauth2", "^1.0.9")]
129
+ }, G = {
130
+ readme: `
126
131
  # \u{1F510} Google OAuth2 Example for TezX
127
132
 
128
133
  This example demonstrates how to use \`@tezx/google-oauth2\` to implement Google OAuth2 login in your TezX app.
@@ -145,12 +150,12 @@ This example demonstrates how to use \`@tezx/google-oauth2\` to implement Google
145
150
  Choose your package manager and install:
146
151
 
147
152
  \`\`\`bash
148
- ${Object.values(p("@tezx/google-oauth2","^1.0.13")).filter(n=>typeof n!="string").join(`
153
+ ${Object.values(d("@tezx/google-oauth2", "^1.0.13")).filter(o => typeof o != "string").join(`
149
154
  # or
150
155
  `)}
151
156
 
152
157
  # Plus Google OAuth SDK
153
- ${Object.values(p("@googleapis/oauth2","^2.0.1")).filter(n=>typeof n!="string").join(`
158
+ ${Object.values(d("@googleapis/oauth2", "^2.0.1")).filter(o => typeof o != "string").join(`
154
159
  # or
155
160
  `)}
156
161
  \`\`\`
@@ -231,7 +236,7 @@ app.get('/auth/callback', verifyGoogleToken({
231
236
  > \u{1F4A1} Note: TezX OAuth2 uses stateful sessions or JWTs depending on your setup. It supports advanced callback hooks for full control.
232
237
 
233
238
  Secure your apps with Google the easy way \u{1F512}
234
- `.trim(),content:`
239
+ `.trim(), content: `
235
240
  // 1. Initialize OAuth2 client
236
241
  const client = GoogleOauthClient({
237
242
  clientId: process.env.GOOGLE_CLIENT_ID,
@@ -279,9 +284,13 @@ app.get('/auth/callback', verifyGoogleToken({
279
284
  }), async (ctx) => {
280
285
  return ctx.json({ success: true });
281
286
  });
282
- `.trim(),files:[{content:`GOOGLE_CLIENT_ID=12323
287
+ `.trim(), files: [{
288
+ content: `GOOGLE_CLIENT_ID=12323
283
289
  GOOGLE_CLIENT_SECRET=234234
284
- `,path:".env"}],import:['import { GoogleOauthClient, getGoogleOAuthURL, verifyGoogleToken } from "@tezx/google-oauth2";'],package:[p("@tezx/google-oauth2","^1.0.13"),p("@googleapis/oauth2","^2.0.1")]};var O={readme:`
290
+ `, path: ".env"
291
+ }], import: ['import { GoogleOauthClient, getGoogleOAuthURL, verifyGoogleToken } from "@tezx/google-oauth2";'], package: [d("@tezx/google-oauth2", "^1.0.13"), d("@googleapis/oauth2", "^2.0.1")]
292
+ }, R = {
293
+ readme: `
285
294
  # TezX View Engine Example
286
295
 
287
296
  This example demonstrates how to use the \`@tezx/view-engine\` package to render server-side views using template engines such as **EJS**, **Pug**, **Handlebars**, **Mustache**, or **Nunjucks**.
@@ -336,7 +345,7 @@ app.get("engine", async (ctx) => {
336
345
  ---
337
346
 
338
347
  Happy TezX templating! \u{1F389}
339
- `.trim(),content:`
348
+ `.trim(), content: `
340
349
  const views = new ViewEngine("ejs", "./views");
341
350
 
342
351
  app.get("engine", async (ctx) => {
@@ -346,7 +355,8 @@ app.get("engine", async (ctx) => {
346
355
  });
347
356
  return ctx.html(html);
348
357
  });
349
- `.trim(),files:[{content:`
358
+ `.trim(), files: [{
359
+ content: `
350
360
  <html lang="en">
351
361
  <head>
352
362
  <meta charset="UTF-8">
@@ -357,7 +367,9 @@ app.get("engine", async (ctx) => {
357
367
  <p>Hello, <%= user.name %> \u{1F44B}</p>
358
368
  </body>
359
369
  </html>
360
- `.trim(),path:"views/home.ejs"}],import:['import { ViewEngine } from "@tezx/view-engine";'],package:[p("@tezx/view-engine","^1.0.3"),p("ejs","^3.1.10")]};var L=`
370
+ `.trim(), path: "views/home.ejs"
371
+ }], import: ['import { ViewEngine } from "@tezx/view-engine";'], package: [d("@tezx/view-engine", "^1.0.3"), d("ejs", "^3.1.10")]
372
+ }; let H = `
361
373
  <!DOCTYPE html>
362
374
  <html lang="en">
363
375
  <head>
@@ -522,10 +534,11 @@ app.get("engine", async (ctx) => {
522
534
  appendMessage("Client: ping", "client");
523
535
  }
524
536
  }
525
- </script>
537
+ <\/script>
526
538
  </body>
527
539
  </html>
528
- `,j={readme:`
540
+ `; const W = {
541
+ readme: `
529
542
  # \u{1F50C} TezX WebSocket Example
530
543
 
531
544
  This example demonstrates how to set up a WebSocket server using \`upgradeWebSocket\` from \`tezx/ws\`.
@@ -585,7 +598,7 @@ A simple HTML file is included in \`public/ws.html\`:
585
598
  ws.onclose = () => {
586
599
  console.log("Disconnected.");
587
600
  };
588
- </script>
601
+ <\/script>
589
602
  \`\`\`
590
603
 
591
604
  ---
@@ -603,7 +616,7 @@ A simple HTML file is included in \`public/ws.html\`:
603
616
  ---
604
617
 
605
618
  Enjoy real-time power with TezX! \u26A1\uFE0F
606
- `.trim(),content:`
619
+ `.trim(), content: `
607
620
  const socket = [];
608
621
 
609
622
  app.get(
@@ -640,8 +653,15 @@ app.get(
640
653
  return ctx.sendFile("public/ws.html");
641
654
  },
642
655
  );
643
- `.trim(),files:[{content:L,path:"public/ws.html"}],import:['import { upgradeWebSocket } from "tezx/ws";']};var T={minimal:{readme:"",content:"",files:[],import:[],package:[]},ws:j,"github-oauth2":$,"google-oauth2":C,"view-engine":O};import M from"node:readline";async function R(n,s,t){return new Promise(a=>{let o=0;M.emitKeypressEvents(process.stdin,n),process.stdin.isTTY&&process.stdin.setRawMode(!0);let l=()=>{process.stdout.write("\x1B[2J\x1B[0f"),console.log(s+` (Use \u2191 \u2193 arrows, Enter to confirm)
644
- `),t.forEach((c,r)=>{console.log(`${r===o?"\u{1F449}":" "} ${r===o?"\x1B[36m":"\x1B[0m"}${c}\x1B[0m`)})},i=(c,r)=>{if(r.name==="up")o=(o-1+t.length)%t.length,l();else if(r.name==="down")o=(o+1)%t.length,l();else if(r.name==="return")return a(t[o])};l(),process.stdin.on("keypress",i)})}var I={reset:"\x1B[0m",bold:"\x1B[1m",underline:"\x1B[4m",gray:"\x1B[90m",white:"\x1B[97m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",orange:"\x1B[38;2;255;88;30m",bgOrange:"\x1B[48;2;255;88;30m"};function e(n,s){return`${I[s]}${n}${I.reset}`}import{mkdirSync as D,writeFileSync as y}from"node:fs";import{join as d}from"node:path";var g="4.0.3";var U=`
656
+ `.trim(), files: [{ content: H, path: "public/ws.html" }], import: ['import { upgradeWebSocket } from "tezx/ws";']
657
+ }; let C = { minimal: { readme: "", content: "", files: [], import: [], package: [] }, ws: W, "github-oauth2": I, "google-oauth2": G, "view-engine": R }; async function _(o, s, t) {
658
+ return new Promise(a => {
659
+ let n = 0; T.emitKeypressEvents(process.stdin, o), process.stdin.isTTY && process.stdin.setRawMode(!0); const u = c(() => {
660
+ process.stdout.write("\x1B[2J\x1B[0f"), console.log(s + ` (Use \u2191 \u2193 arrows, Enter to confirm)
661
+ `), t.forEach((l, r) => { console.log(`${r === n ? "\u{1F449}" : " "} ${r === n ? "\x1B[36m" : "\x1B[0m"}${l}\x1B[0m`) })
662
+ }, "render"), i = c((l, r) => { if (r.name === "up") n = (n - 1 + t.length) % t.length, u(); else if (r.name === "down") n = (n + 1) % t.length, u(); else if (r.name === "return") return a(t[n]) }, "onKeyPress"); u(), process.stdin.on("keypress", i)
663
+ })
664
+ } c(_, "arrowSelect"); const $ = { reset: "\x1B[0m", bold: "\x1B[1m", underline: "\x1B[4m", gray: "\x1B[90m", white: "\x1B[97m", black: "\x1B[30m", red: "\x1B[31m", green: "\x1B[32m", yellow: "\x1B[33m", blue: "\x1B[34m", magenta: "\x1B[35m", cyan: "\x1B[36m", bgRed: "\x1B[41m", bgGreen: "\x1B[42m", bgYellow: "\x1B[43m", bgBlue: "\x1B[44m", bgMagenta: "\x1B[45m", bgCyan: "\x1B[46m", bgWhite: "\x1B[47m", orange: "\x1B[38;2;255;88;30m", bgOrange: "\x1B[48;2;255;88;30m" }; function e(o, s) { return `${$[s]}${o}${$.reset}` } c(e, "colorText"); const F = "4.0.1"; let D = `
645
665
  # \u26A1 TezX \u2013 High-Performance JavaScript Framework for **Bun**
646
666
 
647
667
  **TezX** is a modern, ultra-fast, and lightweight JavaScript framework built specifically for **Bun**.
@@ -832,7 +852,8 @@ Your support helps improve the framework.
832
852
 
833
853
  ---
834
854
 
835
- `,G=({ts:n,template:s,root:t,useStatic:a=!1,staticFolder:o})=>{let l=d(t,n?"src/index.ts":"src/index.js");D(d(t,"src"),{recursive:!0});let i="";s?.import?.push('import { wsHandlers } from "tezx/ws";'),i=`
855
+ `, P = c(({ ts: o, template: s, root: t, useStatic: a = !1, staticFolder: n }) => {
856
+ const u = g(t, o ? "src/index.ts" : "src/index.js"); v(g(t, "src"), { recursive: !0 }); let i = ""; s?.import?.push('import { wsHandlers } from "tezx/ws";'), i = `
836
857
  let PORT = Number(process.env.PORT) || 3000;
837
858
  Bun.serve({
838
859
  port: PORT,
@@ -845,7 +866,7 @@ Bun.serve({
845
866
  })
846
867
  });
847
868
  console.log(\`\u{1F680} TezX is running at http://localhost:\${PORT}\`);
848
- `;let c=`
869
+ `; let l = `
849
870
  import { TezX } from "tezx";
850
871
  import { serveStatic } from "tezx/static";
851
872
  import { logger } from "tezx/middleware";
@@ -859,12 +880,13 @@ app.use([logger()]);
859
880
 
860
881
  app.get("/", (ctx) => ctx.text("Hello from TezX"));
861
882
 
862
- ${a?`app.static(serveStatic("${o||"public"}"));`:""}
863
- ${s?.content?`
883
+ ${a ? `app.static(serveStatic("${n || "public"}"));` : ""}
884
+ ${s?.content ? `
864
885
  ${s?.content?.trim()}
865
- `:""}
886
+ `: ""}
866
887
  ${i}
867
- `;if(n){let r=`
888
+ `; if (o) {
889
+ const r = `
868
890
  {
869
891
  "compilerOptions": {
870
892
  "module": "esnext",
@@ -878,16 +900,19 @@ ${i}
878
900
  "include": ["src"],
879
901
  "exclude": ["node_modules", "dist"]
880
902
  }
881
- `.trim();y(d(t,"tsconfig.json"),r)}y(l,c.trim())},A=({template:n,root:s,projectName:t,ts:a,useWS:o,choiceStep:l})=>{let i=[];Array.isArray(n?.package)&&n?.package?.forEach(h=>{let{version:b,npm:m}=h||{};i.push(`"${m?.[1]}": "${b}"`)});let c=['"@types/bun": "^1.3.1"'];a&&(c.push('"typescript": "^5.8.2"'),c.push('"@types/node": "^22.13.14"'));let r=`
903
+ `.trim(); h(g(t, "tsconfig.json"), r)
904
+ } h(u, l.trim())
905
+ }, "index"), X = c(({ template: o, root: s, projectName: t, ts: a, useWS: n, choiceStep: u }) => {
906
+ let i = []; Array.isArray(o?.package) && o?.package?.forEach(b => { let { version: x, npm: m } = b || {}; i.push(`"${m?.[1]}": "${x}"`) }); let l = ['"@types/bun": "^1.3.1"']; a && (l.push('"typescript": "^5.8.2"'), l.push('"@types/node": "^22.13.14"')); let r = `
882
907
  {
883
- "name": "${t||"tezx-app-example"}",
908
+ "name": "${t || "tezx-app-example"}",
884
909
  "version": "1.0.0",
885
910
  "type": "module",
886
911
  "description": "TezX is a high-performance, lightweight JavaScript framework designed for speed, scalability, and flexibility. It enables efficient routing, middleware management, and static file serving with minimal configuration.",
887
912
  "scripts": {
888
- "start": "bun src/index${a?".ts":".js"}",
889
- "dev": "bun --hot --watch src/index${a?".ts":".js"}",
890
- "type-check": ${a?'"tsc --noEmit"':`"echo 'No TypeScript configured'"`}
913
+ "start": "bun src/index${a ? ".ts" : ".js"}",
914
+ "dev": "bun --hot --watch src/index${a ? ".ts" : ".js"}",
915
+ "type-check": ${a ? '"tsc --noEmit"' : `"echo 'No TypeScript configured'"`}
891
916
  },
892
917
  "repository": {
893
918
  "type": "git",
@@ -901,16 +926,18 @@ ${i}
901
926
  },
902
927
  "homepage": "https://github.com/tezxjs/tezx-app-example",
903
928
  "dependencies": {
904
- "tezx": "^${g}"${i.length?`,
929
+ "tezx": "^${F}"${i.length ? `,
905
930
  ${i.join(`,
906
- `)}`:""}
931
+ `)}` : ""}
907
932
  },
908
933
  "devDependencies": {
909
- ${c.join(`,
934
+ ${l.join(`,
910
935
  `)}
911
936
  }
912
937
  }
913
- `.trim();y(d(s,"package.json"),r)},H=({root:n})=>{let s=`
938
+ `.trim(); h(g(s, "package.json"), r)
939
+ }, "packageJson"); const N = c(({ root: o }) => {
940
+ const s = `
914
941
  # Node dependencies
915
942
  node_modules/
916
943
  .env
@@ -980,49 +1007,58 @@ Thumbs.db
980
1007
  .vscode/
981
1008
  .idea/
982
1009
  *.swp
983
- `.trim();y(d(n,".gitignore"),s,{encoding:"utf8"})},P=({root:n,readme:s})=>{let t=typeof s=="string"&&s?s?.trim():U.trim();y(d(n,"README.md"),t,{encoding:"utf8"})};var w=["npm","bun","yarn","pnpm"];function Y(n){let s=0,t=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],a=setInterval(()=>{process.stdout.write(`\r${t[s=++s%t.length]} ${n}`)},80);return()=>{clearInterval(a),process.stdout.write(`\r\u2705 Done!
984
- `)}}var z=W.createInterface({input:process.stdin,output:process.stdout});W.emitKeypressEvents(process.stdin);process.stdin.isTTY&&process.stdin.setRawMode(!0);var x=(n,s="")=>new Promise(t=>{z.question(s?`${n} (${s}): `:n,a=>{t(a.trim()||s)})});async function _(n){let s=n?.directory,t=n?.options;console.log(e(`
985
- \u26A1 TezX App Creator(v${g})`,"orange")),s||(s=await x(e("\u{1F4E6} Project name: ","magenta")),s||(console.log(e("\u274C Project name required.","red")),process.exit(0)));let a=k.basename(s),o=J(process.cwd(),s),l=!!t?.ts,i=t?.staticFolder||"public",c=!0,r={content:"",import:[],readme:"",files:[]};if(t?.t||t?.template){let u=t.t||t.template,v=T?.[u];v||(console.error(`\u274C Unknown template: "${u}"`),console.error(`\u2139\uFE0F Available templates: ${Object.keys(T).join(", ")}`),process.exit(0)),r=v}else l=!!(t?.ts||(await x("\u{1F7E6} Use TypeScript? (y/N): ")).toLowerCase()==="y"),c=!!t?.useStatic||(await x("\u{1F4C1} Use static folder? (y/N): ")).toLowerCase()==="y",i=c?t?.staticFolder||await x("\u{1F4C2} Static folder name? (default: public): "):"";let h=t?.pm||t?.p,b=w?.includes(h)?h:await R(z,"\u{1F4E6} Choose your package manager",w),m=t?.i==="true"||t?.install==="true"||(await x("\u{1F4E5} Install dependencies now? (y/N): ")).toLowerCase()==="y";console.log(`
1010
+ `.trim(); h(g(o, ".gitignore"), s, { encoding: "utf8" })
1011
+ }, "gitignore"), L = c(({ root: o, readme: s }) => { const t = typeof s == "string" && s ? s?.trim() : D.trim(); h(g(o, "README.md"), t, { encoding: "utf8" }) }, "README"); let S = ["npm", "bun", "yarn", "pnpm"]; function M(o) {
1012
+ let s = 0; const t = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"], a = setInterval(() => { process.stdout.write(`\r${t[s = ++s % t.length]} ${o}`) }, 80); return () => {
1013
+ clearInterval(a), process.stdout.write(`\r\u2705 Done!
1014
+ `)
1015
+ }
1016
+ } c(M, "startLoader"); const E = T.createInterface({ input: process.stdin, output: process.stdout }); T.emitKeypressEvents(process.stdin), process.stdin.isTTY && process.stdin.setRawMode(!0); const y = c((o, s = "") => new Promise(t => { E.question(s ? `${o} (${s}): ` : o, a => { t(a.trim() || s) }) }), "ask"); async function U(o) {
1017
+ let s = o?.directory, t = o?.options; console.log(e(`
1018
+ \u26A1 TezX App Creator(v${F})`, "orange")), s || (s = await y(e("\u{1F4E6} Project name: ", "magenta")), s || (console.log(e("\u274C Project name required.", "red")), process.exit(0))); let a = k.basename(s); const n = A(process.cwd(), s); let u = !!t?.ts, i = t?.staticFolder || "public", l = !0, r = { content: "", import: [], readme: "", files: [] }; if (t?.t || t?.template) { const p = t.t || t.template, w = C?.[p]; w || (console.error(`\u274C Unknown template: "${p}"`), console.error(`\u2139\uFE0F Available templates: ${Object.keys(C).join(", ")}`), process.exit(0)), r = w } else u = !!(t?.ts || (await y("\u{1F7E6} Use TypeScript? (y/N): ")).toLowerCase() === "y"), l = !!t?.useStatic || (await y("\u{1F4C1} Use static folder? (y/N): ")).toLowerCase() === "y", i = l ? t?.staticFolder || await y("\u{1F4C2} Static folder name? (default: public): ") : ""; let b = t?.pm || t?.p; const x = S?.includes(b) ? b : await _(E, "\u{1F4E6} Choose your package manager", S), m = t?.i === "true" || t?.install === "true" || (await y("\u{1F4E5} Install dependencies now? (y/N): ")).toLowerCase() === "y"; console.log(`
986
1019
  \u{1F4C1} Creating project: ${a}...
987
- `);let X=Y("Creating Project");if(S(o,{recursive:!0}),c){let u=V(o,i||"public");S(u,{recursive:!0})}let f={bun:{cd:"cd "+s,install:"bun install",dev:"bun dev",build:"bun build:esm && bun build:dts"},npm:{cd:"cd "+s,install:"npm install",dev:"npm run dev",build:"npm run build:esm && npm run build:dts"},yarn:{cd:"cd "+s,install:"yarn",dev:"yarn dev",build:"yarn build:esm && yarn build:dts"},pnpm:{cd:"cd "+s,install:"pnpm install",dev:"pnpm run dev",build:"pnpm run build:esm && pnpm run build:dts"}}[b];G({template:r,root:o,ts:!!l,staticFolder:i,useStatic:c}),A({projectName:a,root:o,ts:!!l,template:r,choiceStep:f}),H({root:o}),P({root:o,readme:r?.readme}),z.close(),r?.files?.forEach(u=>{let v=k.join(o,k.dirname(u?.path));S(v,{recursive:!0}),q(k.join(o,u?.path),u?.content)}),m&&B(f?.install,{cwd:o,stdio:"inherit"}),console.log(e(`
1020
+ `); let B = M("Creating Project"); if (v(n, { recursive: !0 }), l) { const p = g(n, i || "public"); v(p, { recursive: !0 }) } let f = { bun: { cd: "cd " + s, install: "bun install", dev: "bun dev", build: "bun build:esm && bun build:dts" }, npm: { cd: "cd " + s, install: "npm install", dev: "npm run dev", build: "npm run build:esm && npm run build:dts" }, yarn: { cd: "cd " + s, install: "yarn", dev: "yarn dev", build: "yarn build:esm && yarn build:dts" }, pnpm: { cd: "cd " + s, install: "pnpm install", dev: "pnpm run dev", build: "pnpm run build:esm && pnpm run build:dts" } }[x]; P({ template: r, root: n, ts: !!u, staticFolder: i, useStatic: l }), X({ projectName: a, root: n, ts: !!u, template: r, choiceStep: f }), N({ root: n }), L({ root: n, readme: r?.readme }), E.close(), r?.files?.forEach(p => { let w = k.join(n, k.dirname(p?.path)); v(w, { recursive: !0 }), h(k.join(n, p?.path), p?.content) }), m && j(f?.install, { cwd: n, stdio: "inherit" }), console.log(e(`
988
1021
  \u2705 TezX project "${a}" is ready!
989
- `,"green")),console.log(e("\u{1F9F0} Summary of your configuration:","cyan")),console.log(`\u{1F4C1} Project Name: ${e(a,"yellow")}`);let E=t?.t||t?.template;E&&console.log(`\u{1F4C1} Template Name: ${e(E,"orange")}`),console.log(`\u{1F7E6} TypeScript: ${e(l?"Yes":"No",l?"green":"gray")}`),console.log(`\u{1F4C1} Static Folder: ${e(c?i||"public":"Not Used",c?"green":"gray")}`),console.log(`\u{1F4E6} Package Manager: ${e(b,"magenta")}`),console.log(`\u{1F4E5} Dependencies Installed: ${e(m?"Yes":"No",m?"green":"red")}
990
- `),console.log(e("\u{1F449} Next Steps:","cyan")),console.log(e(` ${f?.cd}`,"white")),m||console.log(e(` ${f?.install}`,"white")),console.log(e(` ${f?.dev}`,"white")),console.log(""),X(),process.exit(0)}function F(){console.log(`
991
- ${e("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E","gray")}
992
- ${e("\u2502","gray")}${e(" \u26A1 Create TezX","yellow")} - Scaffold your next backend app ${e("\u2502","gray")}
993
- ${e("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F","gray")}
1022
+ `, "green")), console.log(e("\u{1F9F0} Summary of your configuration:", "cyan")), console.log(`\u{1F4C1} Project Name: ${e(a, "yellow")}`); let z = t?.t || t?.template; z && console.log(`\u{1F4C1} Template Name: ${e(z, "orange")}`), console.log(`\u{1F7E6} TypeScript: ${e(u ? "Yes" : "No", u ? "green" : "gray")}`), console.log(`\u{1F4C1} Static Folder: ${e(l ? i || "public" : "Not Used", l ? "green" : "gray")}`), console.log(`\u{1F4E6} Package Manager: ${e(x, "magenta")}`), console.log(`\u{1F4E5} Dependencies Installed: ${e(m ? "Yes" : "No", m ? "green" : "red")}
1023
+ `), console.log(e("\u{1F449} Next Steps:", "cyan")), console.log(e(` ${f?.cd}`, "white")), m || console.log(e(` ${f?.install}`, "white")), console.log(e(` ${f?.dev}`, "white")), console.log(""), B(), process.exit(0)
1024
+ } c(U, "create"); function q() {
1025
+ console.log(`
1026
+ ${e("\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E", "gray")}
1027
+ ${e("\u2502", "gray")}${e(" \u26A1 Create TezX", "yellow")} - Scaffold your next backend app ${e("\u2502", "gray")}
1028
+ ${e("\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F", "gray")}
994
1029
 
995
- ${e("\u{1F4E6} Usage:","cyan")}
996
- ${e("create-tezx","green")} ${e("[directory] [...options]","gray")}
1030
+ ${e("\u{1F4E6} Usage:", "cyan")}
1031
+ ${e("create-tezx", "green")} ${e("[directory] [...options]", "gray")}
997
1032
 
998
- ${e("\u{1F680} Quick Start:","cyan")}
999
- ${e("npm","magenta")} create tezx@latest
1000
- ${e("yarn","magenta")} create tezx
1001
- ${e("pnpm","magenta")} create tezx@latest
1002
- ${e("bun","magenta")} create tezx@latest
1033
+ ${e("\u{1F680} Quick Start:", "cyan")}
1034
+ ${e("npm", "magenta")} create tezx@latest
1035
+ ${e("yarn", "magenta")} create tezx
1036
+ ${e("pnpm", "magenta")} create tezx@latest
1037
+ ${e("bun", "magenta")} create tezx@latest
1003
1038
 
1004
- ${e("\u{1F39B}\uFE0F Options:","cyan")}
1039
+ ${e("\u{1F39B}\uFE0F Options:", "cyan")}
1005
1040
 
1006
- ${e("-t, --template <name>","green")} Use a specific starter template
1007
- ${e("--ts, -ts","green")} Enable TypeScript setup
1008
- ${e("-p, --pm <manager>","green")} Package manager: npm | bun | yarn | pnpm
1009
- ${e("-i, --install","green")} Automatically install dependencies
1010
- ${e("-y, --yes","green")} Skip prompts using default options
1011
- ${e("-v, --version","green")} Show CLI version
1012
- ${e("-h, --help","green")} Display this help message
1041
+ ${e("-t, --template <name>", "green")} Use a specific starter template
1042
+ ${e("--ts, -ts", "green")} Enable TypeScript setup
1043
+ ${e("-p, --pm <manager>", "green")} Package manager: npm | bun | yarn | pnpm
1044
+ ${e("-i, --install", "green")} Automatically install dependencies
1045
+ ${e("-y, --yes", "green")} Skip prompts using default options
1046
+ ${e("-v, --version", "green")} Show CLI version
1047
+ ${e("-h, --help", "green")} Display this help message
1013
1048
 
1014
- ${e("\u{1F9F0} Examples:","cyan")}
1015
- ${e("npm create tezx@latest my-app --template ws --ts","gray")}
1016
- ${e("bun create tezx@latest -- --install --pm bun","gray")}
1049
+ ${e("\u{1F9F0} Examples:", "cyan")}
1050
+ ${e("npm create tezx@latest my-app --template ws --ts", "gray")}
1051
+ ${e("bun create tezx@latest -- --install --pm bun", "gray")}
1017
1052
 
1018
- ${e("\u{1F4C1} Available Templates:","cyan")}
1019
- ${e("minimal","yellow")} Minimal TypeScript setup
1020
- ${e("ws","yellow")} Built-in WebSocket server
1021
- ${e("google-oauth2","yellow")} Google OAuth2 Authentication
1022
- ${e("github-oauth2","yellow")} GitHub OAuth2 Authentication
1053
+ ${e("\u{1F4C1} Available Templates:", "cyan")}
1054
+ ${e("minimal", "yellow")} Minimal TypeScript setup
1055
+ ${e("ws", "yellow")} Built-in WebSocket server
1056
+ ${e("google-oauth2", "yellow")} Google OAuth2 Authentication
1057
+ ${e("github-oauth2", "yellow")} GitHub OAuth2 Authentication
1023
1058
 
1024
- ${e("\u{1F517} Repository:","cyan")}
1025
- ${e("https://github.com/tezxjs/tezx","underline")}
1059
+ ${e("\u{1F517} Repository:", "cyan")}
1060
+ ${e("https://github.com/tezxjs/tezx", "underline")}
1026
1061
 
1027
- ${e("\u{1F9D1}\u200D\u{1F4BB} Author:","cyan")}
1028
- Rakibul Islam ${e("<https://github.com/srakib17>","blue")}`),process.exit(0)}function N(){console.log(`TezX CLI v${g}`),process.exit(0)}(async()=>{let n=(l,i)=>{i.name==="c"&&i.ctrl&&(process.stdin.off("keypress",n),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.exit(0))};process.stdin.on("keypress",n);let s=process.argv.slice(2),t={},a;for(let l=0;l<s.length;l++){let i=s[l];if(i.startsWith("--")){let c=i.slice(2),r=s[l+1];r&&!r.startsWith("-")?(t[c]=r,l++):t[c]="true"}else if(i.startsWith("-")){let c=i.slice(1),r=s[l+1];r&&!r.startsWith("-")?(t[c]=r,l++):t[c]="true"}else a||(a=i)}let o={directory:a,options:t};if((t.y==="true"||t.yes==="true")&&(o.options.ts="true",o.options.useStatic="true",o.options.staticFolder="public",o.options.pm=w?.includes(o.options?.p||o?.options?.pm)?o.options?.p||o?.options?.pm:"npm",o.options.p=w?.includes(o.options?.p||o?.options?.pm)?o.options?.p||o?.options?.pm:"npm",o.options.install="true"),t.help||t.h){F();return}if(t.v||t.version){N();return}_(o)})();
1062
+ ${e("\u{1F9D1}\u200D\u{1F4BB} Author:", "cyan")}
1063
+ Rakibul Islam ${e("<https://github.com/srakib17>", "blue")}`), process.exit(0)
1064
+ } c(q, "showHelp"); function V() { console.log(`TezX CLI v${F}`), process.exit(0) } c(V, "showVersion"), (async () => { const o = c((u, i) => { i.name === "c" && i.ctrl && (process.stdin.off("keypress", o), process.stdin.isTTY && process.stdin.setRawMode(!1), process.exit(0)) }, "onKeyPress"); process.stdin.on("keypress", o); const s = process.argv.slice(2); let t = {}, a; for (let u = 0; u < s.length; u++) { const i = s[u]; if (i.startsWith("--")) { const l = i.slice(2), r = s[u + 1]; r && !r.startsWith("-") ? (t[l] = r, u++) : t[l] = "true" } else if (i.startsWith("-")) { const l = i.slice(1), r = s[u + 1]; r && !r.startsWith("-") ? (t[l] = r, u++) : t[l] = "true" } else a || (a = i) } let n = { directory: a, options: t }; if ((t.y === "true" || t.yes === "true") && (n.options.ts = "true", n.options.useStatic = "true", n.options.staticFolder = "public", n.options.pm = S?.includes(n.options?.p || n?.options?.pm) ? n.options?.p || n?.options?.pm : "npm", n.options.p = S?.includes(n.options?.p || n?.options?.pm) ? n.options?.p || n?.options?.pm : "npm", n.options.install = "true"), t.help || t.h) { q(); return } if (t.v || t.version) { V(); return } U(n) })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-tezx-app",
3
- "version": "4.0.3",
3
+ "version": "4.0.9",
4
4
  "type": "module",
5
5
  "description": "TezX is a high-performance, lightweight JavaScript framework designed for speed, scalability, and flexibility. It enables efficient routing, middleware management, and static file serving with minimal configuration. Fully compatible with Node.js, Deno, and Bun.",
6
6
  "bin": "./bin",