create-tezx-app 2.0.8 → 2.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin +13 -14
- package/package.json +1 -1
package/bin
CHANGED
|
@@ -640,8 +640,8 @@ app.get(
|
|
|
640
640
|
return ctx.sendFile("public/ws.html");
|
|
641
641
|
},
|
|
642
642
|
);
|
|
643
|
-
`.trim(),files:[{content:F,path:"public/ws.html"}],import:['import { upgradeWebSocket } from "tezx/ws";']};var
|
|
644
|
-
`),t.forEach((l,i)=>{console.log(`${i===o?"\u{1F449}":" "} ${i===o?"\x1B[36m":"\x1B[0m"}${l}\x1B[0m`)})},c=(l,i)=>{if(i.name==="up")o=(o-1+t.length)%t.length,a();else if(i.name==="down")o=(o+1)%t.length,a();else if(i.name==="return")return r(t[o])};a(),process.stdin.on("keypress",c)})}var A={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`${A[s]}${n}${A.reset}`}import{mkdirSync as V,writeFileSync as
|
|
643
|
+
`.trim(),files:[{content:F,path:"public/ws.html"}],import:['import { upgradeWebSocket } from "tezx/ws";']};var z={minimal:{readme:"",content:"",files:[],import:[],package:[]},ws:_,"github-oauth2":I,"google-oauth2":G,"view-engine":R};import B from"node:readline";async function C(n,s,t){return new Promise(r=>{let o=0;B.emitKeypressEvents(process.stdin,n),process.stdin.isTTY&&process.stdin.setRawMode(!0);let a=()=>{process.stdout.write("\x1B[2J\x1B[0f"),console.log(s+` (Use \u2191 \u2193 arrows, Enter to confirm)
|
|
644
|
+
`),t.forEach((l,i)=>{console.log(`${i===o?"\u{1F449}":" "} ${i===o?"\x1B[36m":"\x1B[0m"}${l}\x1B[0m`)})},c=(l,i)=>{if(i.name==="up")o=(o-1+t.length)%t.length,a();else if(i.name==="down")o=(o+1)%t.length,a();else if(i.name==="return")return r(t[o])};a(),process.stdin.on("keypress",c)})}var A={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`${A[s]}${n}${A.reset}`}import{mkdirSync as V,writeFileSync as y}from"node:fs";import{join as h}from"node:path";var g="2.0.8";var J=`
|
|
645
645
|
# \u{1F680} TezX Starter Template
|
|
646
646
|
|
|
647
647
|
Welcome to the **TezX Starter Template** \u2014 a blazing-fast, full-featured backend template built on [TezX](https://github.com/tezxjs/tezx), the lightweight web framework inspired by the best of Express, Hono, and Bun.
|
|
@@ -759,7 +759,7 @@ MIT \xA9 [SRAKIB17](https://github.com/SRAKIB17)
|
|
|
759
759
|
|
|
760
760
|
---
|
|
761
761
|
|
|
762
|
-
`,L=({ts:n,template:s,root:t,env:r,useStatic:o=!1,staticFolder:a})=>{let c=
|
|
762
|
+
`,L=({ts:n,template:s,root:t,env:r,useStatic:o=!1,staticFolder:a})=>{let c=h(t,n?"src/index.ts":"src/index.js");V(h(t,"src"),{recursive:!0});let l=`
|
|
763
763
|
import { TezX } from "tezx";
|
|
764
764
|
import { ${r}Adapter ,loadEnv} from "tezx/${r}";
|
|
765
765
|
import { logger } from "tezx/middleware";
|
|
@@ -803,7 +803,7 @@ ${r}Adapter(app).listen(3000, () => {
|
|
|
803
803
|
"tests"
|
|
804
804
|
]
|
|
805
805
|
}
|
|
806
|
-
`.trim();
|
|
806
|
+
`.trim();y(h(t,"tsconfig.json"),i)}y(c,l.trim())},N=({template:n,root:s,projectName:t,env:r,ts:o,useWS:a,choiceStep:c})=>{let l=[];Array.isArray(n?.package)&&n?.package?.forEach(m=>{let{version:v,npm:T}=m||{};l.push(`"${T?.[1]}": "${v}"`)});let i={bun:{start:"bun dist/index.js",dev:"bun run --hot --watch src/index.ts"},deno:{start:"deno run --allow-all dist/index.js",dev:"deno run --watch --allow-all --unstable-sloppy-imports src/index.ts"},node:{start:"node dist/index.js",dev:"tsx watch src/index.ts"}},u=`
|
|
807
807
|
{
|
|
808
808
|
"name": "${t||"tezx-app-example"}",
|
|
809
809
|
"version": "1.0.0",
|
|
@@ -829,7 +829,7 @@ ${r}Adapter(app).listen(3000, () => {
|
|
|
829
829
|
"homepage": "https://github.com/tezxjs/tezx-app-example",
|
|
830
830
|
"dependencies": {
|
|
831
831
|
${o?'"typescript": "^5.8.2",':""}
|
|
832
|
-
"tezx": "^${
|
|
832
|
+
"tezx": "^${g}"${r=="node"?`,
|
|
833
833
|
"tsx": "^4.19.2"`:""}${a&&r=="node"?`,
|
|
834
834
|
"ws": "^8.18.1"`:""}${l.length?`,
|
|
835
835
|
${l?.join(`,
|
|
@@ -838,7 +838,7 @@ ${r}Adapter(app).listen(3000, () => {
|
|
|
838
838
|
"devDependencies": {
|
|
839
839
|
"@types/node": "^22.13.14"
|
|
840
840
|
}
|
|
841
|
-
}`.trim();
|
|
841
|
+
}`.trim();y(h(s,"package.json"),u)},D=({root:n})=>{let s=`
|
|
842
842
|
# Node dependencies
|
|
843
843
|
node_modules/
|
|
844
844
|
.env
|
|
@@ -908,15 +908,14 @@ Thumbs.db
|
|
|
908
908
|
.vscode/
|
|
909
909
|
.idea/
|
|
910
910
|
*.swp
|
|
911
|
-
`.trim();
|
|
912
|
-
`)}}var $=P.createInterface({input:process.stdin,output:process.stdout});P.emitKeypressEvents(process.stdin);process.stdin.isTTY&&process.stdin.setRawMode(!0);var
|
|
913
|
-
\u26A1 TezX App Creator (
|
|
914
|
-
`,"orange")),s||(s=await y(e("\u{1F4E6} Project name: ","magenta")),s||(console.log(e("\u274C Project name required.","red")),process.exit(0)));let r=E.basename(s),o=Q(process.cwd(),s),a=!!t?.ts,c=t?.env||t?.runtime,l=x?.includes(c)?c:await z($,"\u{1F4BB} Runtime?",x),i=t?.staticFolder||"public",u=!0,m={content:"",import:[],readme:"",files:[]};if(t?.t||t?.template){let d=t.t||t.template,k=C?.[d];k||(console.error(`\u274C Unknown template: "${d}"`),console.error(`\u2139\uFE0F Available templates: ${Object.keys(C).join(", ")}`),process.exit(0)),m=k}else a=!!(t?.ts||(await y("\u{1F7E6} Use TypeScript? (y/N): ")).toLowerCase()==="y"),u=!!t?.useStatic||(await y("\u{1F4C1} Use static folder? (y/N): ")).toLowerCase()==="y",i=u?t?.staticFolder||await y("\u{1F4C2} Static folder name? (default: public): "):"";let w=t?.pm||t?.p,v=f?.includes(w)?w:await z($,"\u{1F4E6} Choose your package manager",f),T=t?.i==="true"||t?.install==="true"||(await y("\u{1F4E5} Install dependencies now? (y/N): ")).toLowerCase()==="y";console.log(`
|
|
911
|
+
`.trim();y(h(n,".gitignore"),s,{encoding:"utf8"})},M=({root:n,readme:s})=>{let t=typeof s=="string"&&s?s?.trim():J.trim();y(h(n,"README.md"),t,{encoding:"utf8"})};var x=["npm","bun","yarn","pnpm"],w=["node","bun","deno"];function Z(n){let s=0,t=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],r=setInterval(()=>{process.stdout.write(`\r${t[s=++s%t.length]} ${n}`)},80);return()=>{clearInterval(r),process.stdout.write(`\r\u2705 Done!
|
|
912
|
+
`)}}var $=P.createInterface({input:process.stdin,output:process.stdout});P.emitKeypressEvents(process.stdin);process.stdin.isTTY&&process.stdin.setRawMode(!0);var f=(n,s="")=>new Promise(t=>{$.question(s?`${n} (${s}): `:n,r=>{t(r.trim()||s)})});async function W(n){let s=n?.directory,t=n?.options;console.log(e(`
|
|
913
|
+
\u26A1 TezX App Creator(v${g})`,"orange")),s||(s=await f(e("\u{1F4E6} Project name: ","magenta")),s||(console.log(e("\u274C Project name required.","red")),process.exit(0)));let r=E.basename(s),o=Q(process.cwd(),s),a=!!t?.ts,c=t?.env||t?.runtime,l=w?.includes(c)?c:await C($,"\u{1F4BB} Runtime?",w),i=t?.staticFolder||"public",u=!0,m={content:"",import:[],readme:"",files:[]};if(t?.t||t?.template){let d=t.t||t.template,S=z?.[d];S||(console.error(`\u274C Unknown template: "${d}"`),console.error(`\u2139\uFE0F Available templates: ${Object.keys(z).join(", ")}`),process.exit(0)),m=S}else a=!!(t?.ts||(await f("\u{1F7E6} Use TypeScript? (y/N): ")).toLowerCase()==="y"),u=!!t?.useStatic||(await f("\u{1F4C1} Use static folder? (y/N): ")).toLowerCase()==="y",i=u?t?.staticFolder||await f("\u{1F4C2} Static folder name? (default: public): "):"";let v=t?.pm||t?.p,T=x?.includes(v)?v:await C($,"\u{1F4E6} Choose your package manager",x),k=t?.i==="true"||t?.install==="true"||(await f("\u{1F4E5} Install dependencies now? (y/N): ")).toLowerCase()==="y";console.log(`
|
|
915
914
|
\u{1F4C1} Creating project: ${r}...
|
|
916
|
-
`);let U=Z("Creating Project");if(j(o,{recursive:!0}),u){let d=q(o,i||"public");j(d,{recursive:!0})}let
|
|
915
|
+
`);let U=Z("Creating Project");if(j(o,{recursive:!0}),u){let d=q(o,i||"public");j(d,{recursive:!0})}let b={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"}}[T];L({template:m,root:o,ts:!!a,env:l,staticFolder:i,useStatic:u}),N({projectName:r,env:l,root:o,ts:!!a,template:m,choiceStep:b}),D({root:o}),M({root:o,readme:m?.readme}),$.close(),m?.files?.forEach(d=>{let S=E.join(o,E.dirname(d?.path));j(S,{recursive:!0}),Y(E.join(o,d?.path),d?.content)}),k&&K(b?.install,{cwd:o,stdio:"inherit"}),console.log(e(`
|
|
917
916
|
\u2705 TezX project "${r}" is ready!
|
|
918
|
-
`,"green")),console.log(e("\u{1F9F0} Summary of your configuration:","cyan")),console.log(`\u{1F4C1} Project Name: ${e(r,"yellow")}`);let O=t?.t||t?.template;O&&console.log(`\u{1F4C1} Template Name: ${e(O,"orange")}`),console.log(`\u{1F7E6} TypeScript: ${e(a?"Yes":"No",a?"green":"gray")}`),console.log(`\u{1F4BB} Runtime: ${e(l,"blue")}`),console.log(`\u{1F4C1} Static Folder: ${e(u?i||"public":"Not Used",u?"green":"gray")}`),console.log(`\u{1F4E6} Package Manager: ${e(
|
|
919
|
-
`),console.log(e("\u{1F449} Next Steps:","cyan")),console.log(e(` ${
|
|
917
|
+
`,"green")),console.log(e("\u{1F9F0} Summary of your configuration:","cyan")),console.log(`\u{1F4C1} Project Name: ${e(r,"yellow")}`);let O=t?.t||t?.template;O&&console.log(`\u{1F4C1} Template Name: ${e(O,"orange")}`),console.log(`\u{1F7E6} TypeScript: ${e(a?"Yes":"No",a?"green":"gray")}`),console.log(`\u{1F4BB} Runtime: ${e(l,"blue")}`),console.log(`\u{1F4C1} Static Folder: ${e(u?i||"public":"Not Used",u?"green":"gray")}`),console.log(`\u{1F4E6} Package Manager: ${e(T,"magenta")}`),console.log(`\u{1F4E5} Dependencies Installed: ${e(k?"Yes":"No",k?"green":"red")}
|
|
918
|
+
`),console.log(e("\u{1F449} Next Steps:","cyan")),console.log(e(` ${b?.cd}`,"white")),k||console.log(e(` ${b?.install}`,"white")),console.log(e(` ${b?.dev}`,"white")),console.log(""),U(),process.exit(0)}function X(){console.log(`
|
|
920
919
|
${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\u256E","gray")}
|
|
921
920
|
${e("\u2502","gray")} ${e("\u26A1 Create TezX","yellow")} - Scaffold your next backend app ${e("\u2502","gray")}
|
|
922
921
|
${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\u256F","gray")}
|
|
@@ -956,4 +955,4 @@ Thumbs.db
|
|
|
956
955
|
${e("https://github.com/tezxjs/tezx","underline")}
|
|
957
956
|
|
|
958
957
|
${e("\u{1F9D1}\u200D\u{1F4BB} Author:","cyan")}
|
|
959
|
-
Rakibul Islam ${e("<https://github.com/srakib17>","blue")}`),process.exit(0)}function H(){console.log(`TezX CLI v${
|
|
958
|
+
Rakibul Islam ${e("<https://github.com/srakib17>","blue")}`),process.exit(0)}function H(){console.log(`TezX CLI v${g}`),process.exit(0)}(async()=>{let n=(a,c)=>{c.name==="c"&&c.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={},r;for(let a=0;a<s.length;a++){let c=s[a];if(c.startsWith("--")){let l=c.slice(2),i=s[a+1];i&&!i.startsWith("-")?(t[l]=i,a++):t[l]="true"}else if(c.startsWith("-")){let l=c.slice(1),i=s[a+1];i&&!i.startsWith("-")?(t[l]=i,a++):t[l]="true"}else r||(r=c)}let o={directory:r,options:t};if((t.y==="true"||t.yes==="true")&&(o.options.ts="true",o.options.useStatic="true",o.options.staticFolder="public",o.options.pm=x?.includes(o.options?.p||o?.options?.pm)?o.options?.p||o?.options?.pm:"npm",o.options.p=x?.includes(o.options?.p||o?.options?.pm)?o.options?.p||o?.options?.pm:"npm",o.options.env=w?.includes(o.options?.env||o?.options?.runtime)?o.options?.env||o?.options?.runtime:"node",o.options.runtime=w?.includes(o.options?.env||o?.options?.runtime)?o.options?.env||o?.options?.runtime:"node",o.options.install="true"),t.help||t.h){X();return}if(t.v||t.version){H();return}W(o)})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-tezx-app",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.10",
|
|
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",
|