@ooneex/cli 1.8.3 → 1.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +19 -19
- package/dist/index.js.map +21 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -296,7 +296,7 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
|
|
|
296
296
|
yield* this.ai.runStream(prompt || "My prompt", config);
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
`;class Le{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter name"});t=Cd(t).replace(/Ai$/,"");let r=ro.replace(/{{NAME}}/g,t),o=s?H("modules",s):".",i=H(o,"src","ai"),a=H(process.cwd(),i),n=H(a,`${t}Ai.ts`);await Bun.write(n,r);let d=so.replace(/{{NAME}}/g,t),l=H(o,"tests","ai"),c=H(process.cwd(),l),u=H(c,`${t}Ai.spec.ts`);await Bun.write(u,d);let p=new Md;p.success(`${H(i,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${H(l,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/ai"],{cwd:process.cwd(),stdout:"
|
|
299
|
+
`;class Le{getName(){return"make:ai"}getDescription(){return"Generate a new AI class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter name"});t=Cd(t).replace(/Ai$/,"");let r=ro.replace(/{{NAME}}/g,t),o=s?H("modules",s):".",i=H(o,"src","ai"),a=H(process.cwd(),i),n=H(a,`${t}Ai.ts`);await Bun.write(n,r);let d=so.replace(/{{NAME}}/g,t),l=H(o,"tests","ai"),c=H(process.cwd(),l),u=H(c,`${t}Ai.spec.ts`);await Bun.write(u,d);let p=new Md;p.success(`${H(i,t)}Ai.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${H(l,t)}Ai.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/ai"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Le=b([x.command()],Le);import{join as F}from"path";import{TerminalLogger as Od}from"@ooneex/logger";import{toPascalCase as Dd}from"@ooneex/utils";var oo=`import { describe, expect, test } from "bun:test";
|
|
300
300
|
import { {{NAME}}Analytics } from "@/analytics/{{NAME}}Analytics";
|
|
301
301
|
|
|
302
302
|
describe("{{NAME}}Analytics", () => {
|
|
@@ -320,7 +320,7 @@ export class {{NAME}}Analytics<T extends CaptureOptionsType = CaptureOptionsType
|
|
|
320
320
|
// console.log("Analytics captured:", options);
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
|
-
`;class Ue{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter analytics name"});t=Dd(t).replace(/Analytics$/,"");let r=io.replace(/{{NAME}}/g,t),o=s?F("modules",s):".",i=F(o,"src","analytics"),a=F(process.cwd(),i),n=F(a,`${t}Analytics.ts`);await Bun.write(n,r);let d=oo.replace(/{{NAME}}/g,t),l=F(o,"tests","analytics"),c=F(process.cwd(),l),u=F(c,`${t}Analytics.spec.ts`);await Bun.write(u,d);let p=new Od;p.success(`${F(i,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${F(l,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/analytics"],{cwd:process.cwd(),stdout:"
|
|
323
|
+
`;class Ue{getName(){return"make:analytics"}getDescription(){return"Generate a new analytics class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter analytics name"});t=Dd(t).replace(/Analytics$/,"");let r=io.replace(/{{NAME}}/g,t),o=s?F("modules",s):".",i=F(o,"src","analytics"),a=F(process.cwd(),i),n=F(a,`${t}Analytics.ts`);await Bun.write(n,r);let d=oo.replace(/{{NAME}}/g,t),l=F(o,"tests","analytics"),c=F(process.cwd(),l),u=F(c,`${t}Analytics.spec.ts`);await Bun.write(u,d);let p=new Od;p.success(`${F(i,t)}Analytics.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${F(l,t)}Analytics.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/analytics"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Ue=b([x.command()],Ue);import{join as T}from"path";import{TerminalLogger as wl}from"@ooneex/logger";import{toKebabCase as El,toSnakeCase as Al}from"@ooneex/utils";var ao=te(ae(),1);var no=async(e)=>{let t=new ve;return(await ao.prompt({type:"input",name:"destination",message:e.message,initial:e.initial||".",validate:(r)=>{let o=t.validate(r);if(!o.isValid)return o.message||"Invalid destination";return!0}})).destination};var lo=`import { RuleConfigSeverity, type UserConfig } from "@commitlint/types";
|
|
324
324
|
|
|
325
325
|
const Configuration: UserConfig = {
|
|
326
326
|
extends: ["@commitlint/config-conventional"],
|
|
@@ -1500,7 +1500,7 @@ export class {{NAME}}Controller {
|
|
|
1500
1500
|
};
|
|
1501
1501
|
`;class ye{getName(){return"make:controller"}getDescription(){return"Generate a new controller class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Controller`,o=`import { ${r} } from "./controllers/${r}";
|
|
1502
1502
|
`,i=s.lastIndexOf("import "),a=s.indexOf(`
|
|
1503
|
-
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(controllers:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,isSocket:r}=e;if(!t)t=await v({message:"Enter controller name"});if(r===void 0)r=await fe({message:"Is this a socket controller?"});t=Ge(t).replace(/Controller$/,"");let{route:o={}}=e,a=(r?Co:Io).replaceAll("{{NAME}}",t),n="",d="";if(!o.name)o.name=await To({message:"Enter route name (e.g., api.user.create)"});if(n=Ge(o.name),d=o.name,a=a.replaceAll("{{ROUTE_NAME}}",o.name).replaceAll("{{TYPE_NAME}}",n).replaceAll("{{TYPE_NAME_FILE}}",d),!o.path)o.path=await Mo({message:"Enter route path",initial:"/"});let l=`/${ml(pl(o.path,"/"))}`;if(a=a.replaceAll("{{ROUTE_PATH}}",l),!r&&!o.method)o.method=await No({message:"Enter route method"});if(!r&&o.method)a=a.replaceAll("{{ROUTE_METHOD}}",o.method.toLowerCase());let c=s?O("modules",s):".",u=O(c,"src","controllers"),p=O(process.cwd(),u),m=O(p,`${t}Controller.ts`);await Bun.write(m,a);let h=O(c,"src","types","routes"),f=O(process.cwd(),h),g=O(f,`${d}.ts`),y=Oo.replaceAll("{{TYPE_NAME}}",n);await Bun.write(g,y);let E=_o.replace(/{{NAME}}/g,t),A=O(c,"tests","controllers"),N=O(process.cwd(),A),R=O(N,`${t}Controller.spec.ts`);await Bun.write(R,E);let _=s?Ge(s):Ge(ll(process.cwd())),Se=O(process.cwd(),c,"src",`${_}Module.ts`);if(await Bun.file(Se).exists())await this.addToModule(Se,t);let ee=new cl;ee.success(`${O(u,t)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),ee.success(`${O(h,d)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),ee.success(`${O(A,t)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/controller"],{cwd:process.cwd(),stdout:"
|
|
1503
|
+
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(controllers:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,isSocket:r}=e;if(!t)t=await v({message:"Enter controller name"});if(r===void 0)r=await fe({message:"Is this a socket controller?"});t=Ge(t).replace(/Controller$/,"");let{route:o={}}=e,a=(r?Co:Io).replaceAll("{{NAME}}",t),n="",d="";if(!o.name)o.name=await To({message:"Enter route name (e.g., api.user.create)"});if(n=Ge(o.name),d=o.name,a=a.replaceAll("{{ROUTE_NAME}}",o.name).replaceAll("{{TYPE_NAME}}",n).replaceAll("{{TYPE_NAME_FILE}}",d),!o.path)o.path=await Mo({message:"Enter route path",initial:"/"});let l=`/${ml(pl(o.path,"/"))}`;if(a=a.replaceAll("{{ROUTE_PATH}}",l),!r&&!o.method)o.method=await No({message:"Enter route method"});if(!r&&o.method)a=a.replaceAll("{{ROUTE_METHOD}}",o.method.toLowerCase());let c=s?O("modules",s):".",u=O(c,"src","controllers"),p=O(process.cwd(),u),m=O(p,`${t}Controller.ts`);await Bun.write(m,a);let h=O(c,"src","types","routes"),f=O(process.cwd(),h),g=O(f,`${d}.ts`),y=Oo.replaceAll("{{TYPE_NAME}}",n);await Bun.write(g,y);let E=_o.replace(/{{NAME}}/g,t),A=O(c,"tests","controllers"),N=O(process.cwd(),A),R=O(N,`${t}Controller.spec.ts`);await Bun.write(R,E);let _=s?Ge(s):Ge(ll(process.cwd())),Se=O(process.cwd(),c,"src",`${_}Module.ts`);if(await Bun.file(Se).exists())await this.addToModule(Se,t);let ee=new cl;ee.success(`${O(u,t)}Controller.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),ee.success(`${O(h,d)}.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),ee.success(`${O(A,t)}Controller.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/controller"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}ye=b([x.command()],ye);import{join as P}from"path";import{TerminalLogger as gl}from"@ooneex/logger";import{toKebabCase as bl,toPascalCase as xl}from"@ooneex/utils";var Do=`import type { ModuleType } from "@ooneex/module";
|
|
1504
1504
|
|
|
1505
1505
|
export const {{NAME}}Module: ModuleType = {
|
|
1506
1506
|
controllers: [],
|
|
@@ -1559,7 +1559,7 @@ describe("{{NAME}}Module", () => {
|
|
|
1559
1559
|
${a},`:`
|
|
1560
1560
|
${a},`;s=s.replace(r,`$1${n}
|
|
1561
1561
|
$3`),await Bun.write(e,s)}}}async addPathAlias(e,t){let s=await Bun.file(e).text(),r=JSON.parse(s);r.compilerOptions??={},r.compilerOptions.paths??={},r.compilerOptions.paths[`@${t}/*`]=[`../${t}/src/*`],await Bun.write(e,`${JSON.stringify(r,null,2)}
|
|
1562
|
-
`)}async run(e){let{cwd:t=process.cwd(),silent:s=!1,skipMigrations:r=!1,skipSeeds:o=!1}=e,{name:i}=e;if(!i)i=await v({message:"Enter module name"});let a=xl(i).replace(/Module$/,""),n=bl(a),d=P(t,"modules",n),l=P(d,"src"),c=P(d,"tests"),u=Do.replace(/{{NAME}}/g,a),p=Bo.replace(/{{NAME}}/g,n),m=Po.replace(/{{NAME}}/g,a);if(await Bun.write(P(l,`${a}Module.ts`),u),!r)await Bun.write(P(l,"migrations","migrations.ts"),"");if(!o)await Bun.write(P(l,"seeds","seeds.ts"),"");if(await Bun.write(P(d,"package.json"),p),await Bun.write(P(d,"tsconfig.json"),Lo),await Bun.write(P(c,`${a}Module.spec.ts`),m),n!=="app"){let g=P(t,"modules","app","src","AppModule.ts");if(await Bun.file(g).exists())await this.addToAppModule(g,a,n);let y=P(t,"modules","app","tsconfig.json");if(await Bun.file(y).exists())await this.addPathAlias(y,n)}let h=P(t,".commitlintrc.ts");if(await Bun.file(h).exists())await this.addModuleScope(h,n);if(!s)new gl().success(`modules/${n} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});await Bun.spawn(["bun","add","@ooneex/module"],{cwd:process.cwd(),stdout:"
|
|
1562
|
+
`)}async run(e){let{cwd:t=process.cwd(),silent:s=!1,skipMigrations:r=!1,skipSeeds:o=!1}=e,{name:i}=e;if(!i)i=await v({message:"Enter module name"});let a=xl(i).replace(/Module$/,""),n=bl(a),d=P(t,"modules",n),l=P(d,"src"),c=P(d,"tests"),u=Do.replace(/{{NAME}}/g,a),p=Bo.replace(/{{NAME}}/g,n),m=Po.replace(/{{NAME}}/g,a);if(await Bun.write(P(l,`${a}Module.ts`),u),!r)await Bun.write(P(l,"migrations","migrations.ts"),"");if(!o)await Bun.write(P(l,"seeds","seeds.ts"),"");if(await Bun.write(P(d,"package.json"),p),await Bun.write(P(d,"tsconfig.json"),Lo),await Bun.write(P(c,`${a}Module.spec.ts`),m),n!=="app"){let g=P(t,"modules","app","src","AppModule.ts");if(await Bun.file(g).exists())await this.addToAppModule(g,a,n);let y=P(t,"modules","app","tsconfig.json");if(await Bun.file(y).exists())await this.addPathAlias(y,n)}let h=P(t,".commitlintrc.ts");if(await Bun.file(h).exists())await this.addModuleScope(h,n);if(!s)new gl().success(`modules/${n} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0});await Bun.spawn(["bun","add","@ooneex/module"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}ge=b([x.command()],ge);class ke{getName(){return"make:app"}getDescription(){return"Generate a new application"}async run(e){let{name:t,destination:s}=e;if(!t)t=await v({message:"Enter application name"});let r=El(t);if(!s)s=await no({message:"Enter destination path",initial:r});let o=bo.replace(/{{NAME}}/g,r);await Bun.write(T(s,".commitlintrc.ts"),lo),await Bun.write(T(s,".gitignore"),co),await Bun.write(T(s,"biome.jsonc"),po),await Bun.write(T(s,"bunfig.toml"),uo),await Bun.write(T(s,"nx.json"),go),await Bun.write(T(s,"package.json"),o),await Bun.write(T(s,"README.md"),xo.replace(/{{NAME}}/g,r)),await Bun.write(T(s,"tsconfig.json"),wo),await Bun.write(T(s,".zed","settings.json"),Eo),await new ge().run({name:"app",cwd:s,silent:!0,skipMigrations:!0,skipSeeds:!0});let a=T(s,"modules","app","package.json"),n=await Bun.file(a).json();n.scripts.dev="docker compose up -d && bun --hot run ./src/index.ts",n.scripts.build="bun build ./src/index.ts --outdir ./dist --target bun",await Bun.write(a,JSON.stringify(n,null,2));let d=Ot.replace(/^DATABASE_URL=/m,'DATABASE_URL="postgresql://ooneex:ooneex@localhost:5432/ooneex"').replace(/^CACHE_REDIS_URL=/m,'CACHE_REDIS_URL="redis://localhost:6379"').replace(/^PUBSUB_REDIS_URL=/m,'PUBSUB_REDIS_URL="redis://localhost:6379"').replace(/^RATE_LIMIT_REDIS_URL=/m,'RATE_LIMIT_REDIS_URL="redis://localhost:6379"').replace(/^DATABASE_REDIS_URL=/m,'DATABASE_REDIS_URL="redis://localhost:6379"');await Bun.write(T(s,"modules","app",".env"),d),await Bun.write(T(s,"modules","app",".env.example"),Ot),await Bun.write(T(s,"modules","app","src","databases","AppDatabase.ts"),mo),await Bun.write(T(s,"modules","app","src","index.ts"),yo);let l=Al(t),c=fo.replace(/{{NAME}}/g,l);await Bun.write(T(s,"modules","app","docker-compose.yml"),c);let u=ho.replace(/{{NAME}}/g,l);await Bun.write(T(s,"modules","app","Dockerfile"),u),await Bun.write(T(s,"modules","app","var",".gitkeep"),""),await new ye().run({name:"HealthCheck",isSocket:!1,module:"app",route:{name:"api.health.check",path:"/healthcheck",method:"GET"}}),await Bun.spawn(["git","init"],{cwd:s,stdout:"ignore",stderr:"inherit"}).exited,await Bun.spawn(["bun","add","@ooneex/analytics","@ooneex/app","@ooneex/app-env","@ooneex/auth","@ooneex/cache","@ooneex/container","@ooneex/database","@ooneex/logger","@ooneex/mailer","@ooneex/middleware","@ooneex/module","@ooneex/rate-limit","@ooneex/role","@ooneex/routing","@ooneex/storage","@ooneex/translation","@ooneex/types","@ooneex/user","@ooneex/utils","@ooneex/validation","@ooneex/controller","pg","apache-arrow","reflect-metadata","typeorm"],{cwd:s,stdout:"ignore",stderr:"inherit"}).exited,await Bun.spawn(["bun","add","-D","@biomejs/biome","@commitlint/cli","@commitlint/config-conventional","@commitlint/prompt-cli","@commitlint/types","@nx/js","@nx/workspace","@swc-node/register","@swc/core","@swc/helpers","@types/bun","@types/node","@typescript/native-preview","husky","lint-staged","nx","typescript","undici-types"],{cwd:s,stdout:"ignore",stderr:"inherit"}).exited,await Bun.spawn(["bunx","husky","init"],{cwd:s,stdout:"ignore",stderr:"inherit"}).exited,await Bun.write(T(s,".husky","pre-commit"),"lint-staged"),await Bun.write(T(s,".husky","commit-msg"),'bunx commitlint --edit "$1"'),new wl().success(`${r} created successfully at ${s}`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0})}}ke=b([x.command()],ke);import{join as V}from"path";import{TerminalLogger as Sl}from"@ooneex/logger";import{toPascalCase as Tl}from"@ooneex/utils";var Uo=`import { describe, expect, test } from "bun:test";
|
|
1563
1563
|
import { {{NAME}}Cache } from "@/cache/{{NAME}}Cache";
|
|
1564
1564
|
|
|
1565
1565
|
describe("{{NAME}}Cache", () => {
|
|
@@ -1608,7 +1608,7 @@ export class {{NAME}}Cache implements ICache {
|
|
|
1608
1608
|
throw new CacheException(\`Failed to check if key "\${key}" exists: Not implemented\`);
|
|
1609
1609
|
}
|
|
1610
1610
|
}
|
|
1611
|
-
`;class $e{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter cache name"});t=Tl(t).replace(/Cache$/,"");let r=Go.replace(/{{NAME}}/g,t),o=s?V("modules",s):".",i=V(o,"src","cache"),a=V(process.cwd(),i),n=V(a,`${t}Cache.ts`);await Bun.write(n,r);let d=Uo.replace(/{{NAME}}/g,t),l=V(o,"tests","cache"),c=V(process.cwd(),l),u=V(c,`${t}Cache.spec.ts`);await Bun.write(u,d);let p=new Sl;p.success(`${V(i,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${V(l,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/cache"],{cwd:process.cwd(),stdout:"
|
|
1611
|
+
`;class $e{getName(){return"make:cache"}getDescription(){return"Generate a new cache class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter cache name"});t=Tl(t).replace(/Cache$/,"");let r=Go.replace(/{{NAME}}/g,t),o=s?V("modules",s):".",i=V(o,"src","cache"),a=V(process.cwd(),i),n=V(a,`${t}Cache.ts`);await Bun.write(n,r);let d=Uo.replace(/{{NAME}}/g,t),l=V(o,"tests","cache"),c=V(process.cwd(),l),u=V(c,`${t}Cache.spec.ts`);await Bun.write(u,d);let p=new Sl;p.success(`${V(i,t)}Cache.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${V(l,t)}Cache.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/cache"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}$e=b([x.command()],$e);import{join as We}from"path";import{TerminalLogger as Yl}from"@ooneex/logger";var ko=`---
|
|
1612
1612
|
name: commit
|
|
1613
1613
|
description: Create commit messages grouped by module. Analyzes git changes, groups files under modules/ by module name, and creates separate commits following commitlint conventions. Uses common scope for non-module changes.
|
|
1614
1614
|
---
|
|
@@ -1940,7 +1940,7 @@ export class {{NAME}}Cron extends Cron {
|
|
|
1940
1940
|
}
|
|
1941
1941
|
`;class Ke{getName(){return"make:cron"}getDescription(){return"Generate a new cron class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Cron`,o=`import { ${r} } from "./cron/${r}";
|
|
1942
1942
|
`,i=s.lastIndexOf("import "),a=s.indexOf(`
|
|
1943
|
-
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(cronJobs:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter cron name"});t=Lt(t).replace(/Cron$/,"");let r=ai.replace(/{{NAME}}/g,t),o=s?G("modules",s):".",i=G(o,"src","cron"),a=G(process.cwd(),i),n=G(a,`${t}Cron.ts`);await Bun.write(n,r);let d=ii.replace(/{{NAME}}/g,t),l=G(o,"tests","cron"),c=G(process.cwd(),l),u=G(c,`${t}Cron.spec.ts`);await Bun.write(u,d);let p=s?Lt(s):Lt(Xl(process.cwd())),m=G(process.cwd(),o,"src",`${p}Module.ts`);if(await Bun.file(m).exists())await this.addToModule(m,t);let h=new Jl;h.success(`${G(i,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${G(l,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/cron"],{cwd:process.cwd(),stdout:"
|
|
1943
|
+
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(cronJobs:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter cron name"});t=Lt(t).replace(/Cron$/,"");let r=ai.replace(/{{NAME}}/g,t),o=s?G("modules",s):".",i=G(o,"src","cron"),a=G(process.cwd(),i),n=G(a,`${t}Cron.ts`);await Bun.write(n,r);let d=ii.replace(/{{NAME}}/g,t),l=G(o,"tests","cron"),c=G(process.cwd(),l),u=G(c,`${t}Cron.spec.ts`);await Bun.write(u,d);let p=s?Lt(s):Lt(Xl(process.cwd())),m=G(process.cwd(),o,"src",`${p}Module.ts`);if(await Bun.file(m).exists())await this.addToModule(m,t);let h=new Jl;h.success(`${G(i,t)}Cron.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),h.success(`${G(l,t)}Cron.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/cron"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Ke=b([x.command()],Ke);import{join as Y}from"path";import{TerminalLogger as tc}from"@ooneex/logger";import{toPascalCase as sc}from"@ooneex/utils";var ni=`import { describe, expect, test } from "bun:test";
|
|
1944
1944
|
import { {{NAME}}Database } from "@/databases/{{NAME}}Database";
|
|
1945
1945
|
|
|
1946
1946
|
describe("{{NAME}}Database", () => {
|
|
@@ -1976,7 +1976,7 @@ export class {{NAME}}Database extends TypeormDatabase {
|
|
|
1976
1976
|
return this.source;
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
1979
|
-
`;class He{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter database name"});t=sc(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let r=di.replace(/{{NAME}}/g,t),o=s?Y("modules",s):".",i=Y(o,"src","databases"),a=Y(process.cwd(),i),n=Y(a,`${t}Database.ts`);await Bun.write(n,r);let d=ni.replace(/{{NAME}}/g,t),l=Y(o,"tests","databases"),c=Y(process.cwd(),l),u=Y(c,`${t}Database.spec.ts`);await Bun.write(u,d);let p=new tc;p.success(`${Y(i,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Y(l,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/database"],{cwd:process.cwd(),stdout:"
|
|
1979
|
+
`;class He{getName(){return"make:database"}getDescription(){return"Generate a new database class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter database name"});t=sc(t).replace(/DatabaseAdapter$/,"").replace(/Database$/,"");let r=di.replace(/{{NAME}}/g,t),o=s?Y("modules",s):".",i=Y(o,"src","databases"),a=Y(process.cwd(),i),n=Y(a,`${t}Database.ts`);await Bun.write(n,r);let d=ni.replace(/{{NAME}}/g,t),l=Y(o,"tests","databases"),c=Y(process.cwd(),l),u=Y(c,`${t}Database.spec.ts`);await Bun.write(u,d);let p=new tc;p.success(`${Y(i,t)}Database.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Y(l,t)}Database.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/database"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}He=b([x.command()],He);import{join as Oi}from"path";import{TerminalLogger as Ac}from"@ooneex/logger";var{YAML:Di}=globalThis.Bun;var ci=te(ae(),1),li=["clickhouse","elasticsearch","grafana","jaeger","keycloak","libretranslate","maildev","memcached","minio","mongodb","mysql","nats","postgres","prometheus","rabbitmq","redis","temporal","vault"],mi=async(e)=>{return(await ci.prompt({type:"autocomplete",name:"service",message:e.message,initial:e.initial,choices:li.map((s)=>s),validate:(s)=>{if(!li.includes(s))return"Docker service is invalid";return!0}})).service};var pi=`services:
|
|
1980
1980
|
# ClickHouse - Column-oriented OLAP database for analytics
|
|
1981
1981
|
# Docs: https://clickhouse.com/docs
|
|
1982
1982
|
# HTTP API: http://localhost:8123
|
|
@@ -2517,7 +2517,7 @@ export class {{NAME}}Logger implements ILogger {
|
|
|
2517
2517
|
// Handle error logging
|
|
2518
2518
|
}
|
|
2519
2519
|
}
|
|
2520
|
-
`;class Ye{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter logger name"});t=Dc(t).replace(/Logger$/,"");let r=ki.replace(/{{NAME}}/g,t),o=s?z("modules",s):".",i=z(o,"src","loggers"),a=z(process.cwd(),i),n=z(a,`${t}Logger.ts`);await Bun.write(n,r);let d=Gi.replace(/{{NAME}}/g,t),l=z(o,"tests","loggers"),c=z(process.cwd(),l),u=z(c,`${t}Logger.spec.ts`);await Bun.write(u,d);let p=new Oc;p.success(`${z(i,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${z(l,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/logger"],{cwd:process.cwd(),stdout:"
|
|
2520
|
+
`;class Ye{getName(){return"make:logger"}getDescription(){return"Generate a new logger class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter logger name"});t=Dc(t).replace(/Logger$/,"");let r=ki.replace(/{{NAME}}/g,t),o=s?z("modules",s):".",i=z(o,"src","loggers"),a=z(process.cwd(),i),n=z(a,`${t}Logger.ts`);await Bun.write(n,r);let d=Gi.replace(/{{NAME}}/g,t),l=z(o,"tests","loggers"),c=z(process.cwd(),l),u=z(c,`${t}Logger.spec.ts`);await Bun.write(u,d);let p=new Oc;p.success(`${z(i,t)}Logger.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${z(l,t)}Logger.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/logger"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Ye=b([x.command()],Ye);import{join as D}from"path";import{TerminalLogger as Gc}from"@ooneex/logger";import{toPascalCase as kc}from"@ooneex/utils";var $i=`import { describe, expect, test } from "bun:test";
|
|
2521
2521
|
import { {{NAME}}Mailer } from "@/mailers/{{NAME}}Mailer";
|
|
2522
2522
|
|
|
2523
2523
|
describe("{{NAME}}Mailer", () => {
|
|
@@ -2581,7 +2581,7 @@ export const {{NAME}}MailerTemplate = (props?: {{NAME}}MailerPropsType) => (
|
|
|
2581
2581
|
<MailerLayout.Footer />
|
|
2582
2582
|
</MailerLayout>
|
|
2583
2583
|
);
|
|
2584
|
-
`;class ze{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter mailer name"});t=kc(t).replace(/Mailer$/,"");let r=Wi.replace(/{{NAME}}/g,t),o=Ki.replace(/{{NAME}}/g,t),i=s?D("modules",s):".",a=D(i,"src","mailers"),n=D(process.cwd(),a),d=D(n,`${t}Mailer.ts`),l=D(n,`${t}MailerTemplate.tsx`);await Bun.write(d,r),await Bun.write(l,o);let c=$i.replace(/{{NAME}}/g,t),u=qi.replace(/{{NAME}}/g,t),p=D(i,"tests","mailers"),m=D(process.cwd(),p),h=D(m,`${t}Mailer.spec.ts`),f=D(m,`${t}MailerTemplate.spec.ts`);await Bun.write(h,c),await Bun.write(f,u);let g=new Gc;g.success(`${D(a,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${D(a,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${D(p,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${D(p,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/mailer"],{cwd:process.cwd(),stdout:"
|
|
2584
|
+
`;class ze{getName(){return"make:mailer"}getDescription(){return"Generate a new mailer class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter mailer name"});t=kc(t).replace(/Mailer$/,"");let r=Wi.replace(/{{NAME}}/g,t),o=Ki.replace(/{{NAME}}/g,t),i=s?D("modules",s):".",a=D(i,"src","mailers"),n=D(process.cwd(),a),d=D(n,`${t}Mailer.ts`),l=D(n,`${t}MailerTemplate.tsx`);await Bun.write(d,r),await Bun.write(l,o);let c=$i.replace(/{{NAME}}/g,t),u=qi.replace(/{{NAME}}/g,t),p=D(i,"tests","mailers"),m=D(process.cwd(),p),h=D(m,`${t}Mailer.spec.ts`),f=D(m,`${t}MailerTemplate.spec.ts`);await Bun.write(h,c),await Bun.write(f,u);let g=new Gc;g.success(`${D(a,t)}Mailer.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${D(a,t)}MailerTemplate.tsx created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${D(p,t)}Mailer.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${D(p,t)}MailerTemplate.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/mailer"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}ze=b([x.command()],ze);import{basename as Kc,join as $}from"path";import{TerminalLogger as Hc}from"@ooneex/logger";import{toPascalCase as $t}from"@ooneex/utils";var Hi=`import type { ContextType } from "@ooneex/socket";
|
|
2585
2585
|
import { decorator, type IMiddleware } from "@ooneex/middleware";
|
|
2586
2586
|
|
|
2587
2587
|
@decorator.middleware()
|
|
@@ -2620,7 +2620,7 @@ export class {{NAME}}Middleware implements IMiddleware {
|
|
|
2620
2620
|
}
|
|
2621
2621
|
`;class Ze{getName(){return"make:middleware"}getDescription(){return"Generate a new middleware class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Middleware`,o=`import { ${r} } from "./middlewares/${r}";
|
|
2622
2622
|
`,i=s.lastIndexOf("import "),a=s.indexOf(`
|
|
2623
|
-
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(middlewares:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,isSocket:r}=e;if(!t)t=await v({message:"Enter middleware name"});if(r===void 0)r=await fe({message:"Is this a socket middleware?"});t=$t(t).replace(/Middleware$/,"");let i=(r?Hi:Vi).replace(/{{NAME}}/g,t),a=s?$("modules",s):".",n=$(a,"src","middlewares"),d=$(process.cwd(),n),l=$(d,`${t}Middleware.ts`);await Bun.write(l,i);let c=Fi.replace(/{{NAME}}/g,t),u=$(a,"tests","middlewares"),p=$(process.cwd(),u),m=$(p,`${t}Middleware.spec.ts`);await Bun.write(m,c);let h=s?$t(s):$t(Kc(process.cwd())),f=$(process.cwd(),a,"src",`${h}Module.ts`);if(await Bun.file(f).exists())await this.addToModule(f,t);let g=new Hc;g.success(`${$(n,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${$(u,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/middleware"],{cwd:process.cwd(),stdout:"
|
|
2623
|
+
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(middlewares:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,isSocket:r}=e;if(!t)t=await v({message:"Enter middleware name"});if(r===void 0)r=await fe({message:"Is this a socket middleware?"});t=$t(t).replace(/Middleware$/,"");let i=(r?Hi:Vi).replace(/{{NAME}}/g,t),a=s?$("modules",s):".",n=$(a,"src","middlewares"),d=$(process.cwd(),n),l=$(d,`${t}Middleware.ts`);await Bun.write(l,i);let c=Fi.replace(/{{NAME}}/g,t),u=$(a,"tests","middlewares"),p=$(process.cwd(),u),m=$(p,`${t}Middleware.spec.ts`);await Bun.write(m,c);let h=s?$t(s):$t(Kc(process.cwd())),f=$(process.cwd(),a,"src",`${h}Module.ts`);if(await Bun.file(f).exists())await this.addToModule(f,t);let g=new Hc;g.success(`${$(n,t)}Middleware.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),g.success(`${$(u,t)}Middleware.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/middleware"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Ze=b([x.command()],Ze);import{join as Qe}from"path";import{TerminalLogger as Vc}from"@ooneex/logger";import{migrationCreate as Yc}from"@ooneex/migrations";var Yi=`#!/usr/bin/env bun
|
|
2624
2624
|
|
|
2625
2625
|
import { migrationUp } from "@ooneex/migrations";
|
|
2626
2626
|
import "@/migrations/migrations";
|
|
@@ -2629,7 +2629,7 @@ await migrationUp({
|
|
|
2629
2629
|
databaseUrl: Bun.env.DATABASE_URL || ":memory:",
|
|
2630
2630
|
tableName: "migrations",
|
|
2631
2631
|
});
|
|
2632
|
-
`;class Xe{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(e){let{module:t}=e,s=t?Qe("modules",t):".",r=await Yc({dir:Qe(s,"src/migrations")}),o=Qe(process.cwd(),s,"bin","migration","up.ts");if(!await Bun.file(o).exists())await Bun.write(o,Yi);let a=Qe(process.cwd(),"package.json"),n=Bun.file(a);if(await n.exists()){let c=await n.json();c.scripts=c.scripts||{},c.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(a,JSON.stringify(c,null,2))}let d=new Vc;d.success(`${r} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1}),await Bun.spawn(["bun","add","--dev","@ooneex/migrations"],{cwd:process.cwd(),stdout:"
|
|
2632
|
+
`;class Xe{getName(){return"make:migration"}getDescription(){return"Generate a new migration file"}async run(e){let{module:t}=e,s=t?Qe("modules",t):".",r=await Yc({dir:Qe(s,"src/migrations")}),o=Qe(process.cwd(),s,"bin","migration","up.ts");if(!await Bun.file(o).exists())await Bun.write(o,Yi);let a=Qe(process.cwd(),"package.json"),n=Bun.file(a);if(await n.exists()){let c=await n.json();c.scripts=c.scripts||{},c.scripts["migration:up"]="bun ./bin/migration/up.ts",await Bun.write(a,JSON.stringify(c,null,2))}let d=new Vc;d.success(`${r} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),d.info("Run 'bun run migration:up' to execute migrations",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1}),await Bun.spawn(["bun","add","--dev","@ooneex/migrations"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Xe=b([x.command()],Xe);import{join as Z}from"path";import{TerminalLogger as Qc}from"@ooneex/logger";import{toPascalCase as Xc}from"@ooneex/utils";var zi=`import { describe, expect, test } from "bun:test";
|
|
2633
2633
|
import { Permission } from "@ooneex/permission";
|
|
2634
2634
|
import { {{NAME}}Permission } from "@/permissions/{{NAME}}Permission";
|
|
2635
2635
|
|
|
@@ -2693,7 +2693,7 @@ export class {{NAME}}Permission extends Permission {
|
|
|
2693
2693
|
return this;
|
|
2694
2694
|
}
|
|
2695
2695
|
}
|
|
2696
|
-
`;class Je{getName(){return"make:permission"}getDescription(){return"Generate a new permission class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter permission name"});t=Xc(t).replace(/Permission$/,"");let r=Zi.replace(/{{NAME}}/g,t),o=s?Z("modules",s):".",i=Z(o,"src","permissions"),a=Z(process.cwd(),i),n=Z(a,`${t}Permission.ts`);await Bun.write(n,r);let d=zi.replace(/{{NAME}}/g,t),l=Z(o,"tests","permissions"),c=Z(process.cwd(),l),u=Z(c,`${t}Permission.spec.ts`);await Bun.write(u,d);let p=new Qc;p.success(`${Z(i,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Z(l,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/permission"],{cwd:process.cwd(),stdout:"
|
|
2696
|
+
`;class Je{getName(){return"make:permission"}getDescription(){return"Generate a new permission class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter permission name"});t=Xc(t).replace(/Permission$/,"");let r=Zi.replace(/{{NAME}}/g,t),o=s?Z("modules",s):".",i=Z(o,"src","permissions"),a=Z(process.cwd(),i),n=Z(a,`${t}Permission.ts`);await Bun.write(n,r);let d=zi.replace(/{{NAME}}/g,t),l=Z(o,"tests","permissions"),c=Z(process.cwd(),l),u=Z(c,`${t}Permission.spec.ts`);await Bun.write(u,d);let p=new Qc;p.success(`${Z(i,t)}Permission.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Z(l,t)}Permission.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/permission"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}Je=b([x.command()],Je);import{basename as em,join as W}from"path";import{TerminalLogger as tm}from"@ooneex/logger";import{toKebabCase as sm,toPascalCase as Wt}from"@ooneex/utils";var Qi=`import { describe, expect, test } from "bun:test";
|
|
2697
2697
|
import { {{NAME}}PubSub } from "@/pubsub/{{NAME}}PubSub";
|
|
2698
2698
|
|
|
2699
2699
|
describe("{{NAME}}PubSub", () => {
|
|
@@ -2755,7 +2755,7 @@ export class {{NAME}}Event<Data extends Record<string, ScalarType> = Record<stri
|
|
|
2755
2755
|
}
|
|
2756
2756
|
`;class je{getName(){return"make:pubsub"}getDescription(){return"Generate a new PubSub event class"}async addToModule(e,t){let s=await Bun.file(e).text(),r=`${t}Event`,o=`import { ${r} } from "./events/${r}";
|
|
2757
2757
|
`,i=s.lastIndexOf("import "),a=s.indexOf(`
|
|
2758
|
-
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(events:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,channel:r}=e;if(!t)t=await v({message:"Enter name"});if(t=Wt(t).replace(/PubSub$/,""),!r)r=sm(t);let o=Xi.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,r),i=s?W("modules",s):".",a=W(i,"src","events"),n=W(process.cwd(),a),d=W(n,`${t}Event.ts`);await Bun.write(d,o);let l=Qi.replace(/{{NAME}}/g,t),c=W(i,"tests","events"),u=W(process.cwd(),c),p=W(u,`${t}Event.spec.ts`);await Bun.write(p,l);let m=s?Wt(s):Wt(em(process.cwd())),h=W(process.cwd(),i,"src",`${m}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let f=new tm;f.success(`${W(a,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),f.success(`${W(c,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/pub-sub"],{cwd:process.cwd(),stdout:"
|
|
2758
|
+
`,i);s=`${s.slice(0,a+1)}${o}${s.slice(a+1)}`;let n=/(events:\s*\[)([^\]]*)/s,d=s.match(n);if(d){let l=d[2]?.trim(),c=l?`${l}, ${r}`:r;s=s.replace(n,`$1${c}`)}await Bun.write(e,s)}async run(e){let{name:t,module:s,channel:r}=e;if(!t)t=await v({message:"Enter name"});if(t=Wt(t).replace(/PubSub$/,""),!r)r=sm(t);let o=Xi.replace(/{{NAME}}/g,t).replace(/{{CHANNEL}}/g,r),i=s?W("modules",s):".",a=W(i,"src","events"),n=W(process.cwd(),a),d=W(n,`${t}Event.ts`);await Bun.write(d,o);let l=Qi.replace(/{{NAME}}/g,t),c=W(i,"tests","events"),u=W(process.cwd(),c),p=W(u,`${t}Event.spec.ts`);await Bun.write(p,l);let m=s?Wt(s):Wt(em(process.cwd())),h=W(process.cwd(),i,"src",`${m}Module.ts`);if(await Bun.file(h).exists())await this.addToModule(h,t);let f=new tm;f.success(`${W(a,t)}Event.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),f.success(`${W(c,t)}Event.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/pub-sub"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}je=b([x.command()],je);import{readdir as rm}from"fs/promises";import{join as ce}from"path";import{TerminalLogger as om}from"@ooneex/logger";var{$:me}=globalThis.Bun;var im={feat:"Added",fix:"Fixed",refactor:"Changed",perf:"Changed",style:"Changed",docs:"Changed",build:"Changed",ci:"Changed",chore:"Changed",revert:"Removed"};class et{getName(){return"make:release"}getDescription(){return"Release packages with version bump, changelog, and git tag"}async run(){let e=new om,t=process.cwd(),s=[];for(let{name:a,type:n}of[{name:"packages",type:"package"},{name:"modules",type:"module"}])try{let d=await rm(ce(t,a),{withFileTypes:!0});s.push(...d.filter((l)=>l.isDirectory()).map((l)=>({base:ce(a,l.name),type:n})))}catch{}let r={showTimestamp:!1,showArrow:!1,useSymbol:!0};if(s.length===0){e.error("No packages or modules found",void 0,r);return}let o=0;for(let a of s){let n=ce(t,a.base),d=ce(n,"package.json"),l=Bun.file(d);if(!await l.exists())continue;let c=await l.json(),u=await this.getLastTag(c.name),p=await this.getCommitsSinceTag(u,a.base);if(p.length===0)continue;let m=this.determineBumpType(p),h=this.bumpVersion(c.version,m);c.version=h;let f=`${c.name}@${h}`;await Bun.write(d,`${JSON.stringify(c,null,2)}
|
|
2759
2759
|
`),await this.updateChangelog(n,h,f,p),await this.gitAdd(ce(a.base,"package.json"),ce(a.base,"CHANGELOG.md")),await this.gitCommit(`chore(release): ${c.name}@${h}`),await this.gitTag(f,`chore(release): ${c.name}@${h}`),e.success(`${c.name}@${h} released (${m} bump, ${p.length} commit(s))`,void 0,r),o++}if(o===0){e.info(`No packages have unreleased commits
|
|
2760
2760
|
`,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1,useSymbol:!1});return}if(e.success(`${o} package(s) released`,void 0,r),await fe({message:"Push commits and tags to remote?"}))try{await me`git push && git push --tags`,e.success("Pushed commits and tags to remote",void 0,r)}catch{e.error("Failed to push to remote",void 0,r)}}async getLastTag(e){try{let s=(await me`git --no-pager tag --list "${e}@*" --sort=-v:refname`.quiet()).text().trim();if(!s)return null;return s.split(`
|
|
2761
2761
|
`)[0]??null}catch{return null}}async getCommitsSinceTag(e,t){let s=e?`${e}..HEAD`:"HEAD",r="%H|%an|%s";try{let i=(await me`git --no-pager log ${s} --format=${"%H|%an|%s"} -- ${t}`.quiet()).text().trim();if(!i)return[];let a=[],n=/^([a-z]+)\(([^)]+)\):\s*(.+)$/;for(let d of i.split(`
|
|
@@ -2958,13 +2958,13 @@ export class {{NAME}}Repository {
|
|
|
2958
2958
|
return await repository.count(criteria ? { where: criteria } : {});
|
|
2959
2959
|
}
|
|
2960
2960
|
}
|
|
2961
|
-
`;class tt{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter repository name"});t=lm(t).replace(/Repository$/,"");let r=ji.replace(/{{NAME}}/g,t),o=s?Q("modules",s):".",i=Q(o,"src","repositories"),a=Q(process.cwd(),i),n=Q(a,`${t}Repository.ts`);await Bun.write(n,r);let d=Ji.replace(/{{NAME}}/g,t),l=Q(o,"tests","repositories"),c=Q(process.cwd(),l),u=Q(c,`${t}Repository.spec.ts`);await Bun.write(u,d);let p=new dm;p.success(`${Q(i,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Q(l,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/repository"],{cwd:process.cwd(),stdout:"
|
|
2961
|
+
`;class tt{getName(){return"make:repository"}getDescription(){return"Generate a new repository class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter repository name"});t=lm(t).replace(/Repository$/,"");let r=ji.replace(/{{NAME}}/g,t),o=s?Q("modules",s):".",i=Q(o,"src","repositories"),a=Q(process.cwd(),i),n=Q(a,`${t}Repository.ts`);await Bun.write(n,r);let d=Ji.replace(/{{NAME}}/g,t),l=Q(o,"tests","repositories"),c=Q(process.cwd(),l),u=Q(c,`${t}Repository.spec.ts`);await Bun.write(u,d);let p=new dm;p.success(`${Q(i,t)}Repository.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${Q(l,t)}Repository.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/repository"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}tt=b([x.command()],tt);import{join as st}from"path";import{TerminalLogger as mm}from"@ooneex/logger";import{seedCreate as pm}from"@ooneex/seeds";var ea=`#!/usr/bin/env bun
|
|
2962
2962
|
|
|
2963
2963
|
import { seedRun } from "@ooneex/seeds";
|
|
2964
2964
|
import "@/seeds/seeds";
|
|
2965
2965
|
|
|
2966
2966
|
await seedRun();
|
|
2967
|
-
`;class rt{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter seed name"});let r=s?st("modules",s):".",o=await pm({name:t,dir:st(r,"src/seeds")}),i=st(process.cwd(),r,"bin","seed","run.ts");if(!await Bun.file(i).exists())await Bun.write(i,ea);let n=st(process.cwd(),"package.json"),d=Bun.file(n);if(await d.exists()){let u=await d.json();u.scripts=u.scripts||{},u.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(n,JSON.stringify(u,null,2))}let l=new mm;l.success(`${o} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1}),await Bun.spawn(["bun","add","--dev","@ooneex/seeds"],{cwd:process.cwd(),stdout:"
|
|
2967
|
+
`;class rt{getName(){return"make:seed"}getDescription(){return"Generate a new seed file"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter seed name"});let r=s?st("modules",s):".",o=await pm({name:t,dir:st(r,"src/seeds")}),i=st(process.cwd(),r,"bin","seed","run.ts");if(!await Bun.file(i).exists())await Bun.write(i,ea);let n=st(process.cwd(),"package.json"),d=Bun.file(n);if(await d.exists()){let u=await d.json();u.scripts=u.scripts||{},u.scripts["seed:run"]="bun ./bin/seed/run.ts",await Bun.write(n,JSON.stringify(u,null,2))}let l=new mm;l.success(`${o} created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),l.info("Run 'bun run seed:run' to execute seeds",void 0,{showTimestamp:!1,showArrow:!0,showLevel:!1}),await Bun.spawn(["bun","add","--dev","@ooneex/seeds"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}rt=b([x.command()],rt);import{join as X}from"path";import{TerminalLogger as fm}from"@ooneex/logger";import{toPascalCase as ym}from"@ooneex/utils";var ta=`import { describe, expect, test } from "bun:test";
|
|
2968
2968
|
import { {{NAME}}Service } from "@/services/{{NAME}}Service";
|
|
2969
2969
|
|
|
2970
2970
|
describe("{{NAME}}Service", () => {
|
|
@@ -2988,7 +2988,7 @@ export class {{NAME}}Service<T extends ServiceDataType = ServiceDataType> implem
|
|
|
2988
2988
|
// TODO: Implement service logic
|
|
2989
2989
|
}
|
|
2990
2990
|
}
|
|
2991
|
-
`;class ot{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter service name"});t=ym(t).replace(/Service$/,"");let r=sa.replace(/{{NAME}}/g,t),o=s?X("modules",s):".",i=X(o,"src","services"),a=X(process.cwd(),i),n=X(a,`${t}Service.ts`);await Bun.write(n,r);let d=ta.replace(/{{NAME}}/g,t),l=X(o,"tests","services"),c=X(process.cwd(),l),u=X(c,`${t}Service.spec.ts`);await Bun.write(u,d);let p=new fm;p.success(`${X(i,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${X(l,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/service"],{cwd:process.cwd(),stdout:"
|
|
2991
|
+
`;class ot{getName(){return"make:service"}getDescription(){return"Generate a new service class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter service name"});t=ym(t).replace(/Service$/,"");let r=sa.replace(/{{NAME}}/g,t),o=s?X("modules",s):".",i=X(o,"src","services"),a=X(process.cwd(),i),n=X(a,`${t}Service.ts`);await Bun.write(n,r);let d=ta.replace(/{{NAME}}/g,t),l=X(o,"tests","services"),c=X(process.cwd(),l),u=X(c,`${t}Service.spec.ts`);await Bun.write(u,d);let p=new fm;p.success(`${X(i,t)}Service.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${X(l,t)}Service.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/service"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}ot=b([x.command()],ot);import{join as J}from"path";import{TerminalLogger as xm}from"@ooneex/logger";import{toPascalCase as wm,toSnakeCase as Em}from"@ooneex/utils";var ra=`import { describe, expect, test } from "bun:test";
|
|
2992
2992
|
import { {{NAME}}StorageAdapter } from "@/storage/{{NAME}}StorageAdapter";
|
|
2993
2993
|
|
|
2994
2994
|
describe("{{NAME}}StorageAdapter", () => {
|
|
@@ -3060,7 +3060,7 @@ export class {{NAME}}Storage extends Storage {
|
|
|
3060
3060
|
};
|
|
3061
3061
|
}
|
|
3062
3062
|
}
|
|
3063
|
-
`;class it{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter storage name"});t=wm(t).replace(/Storage$/,"");let r=Em(t).toUpperCase(),o=oa.replace(/{{NAME}}/g,t).replace(/{{NAME_UPPER}}/g,r),i=s?J("modules",s):".",a=J(i,"src","storage"),n=J(process.cwd(),a),d=J(n,`${t}Storage.ts`);await Bun.write(d,o);let l=ra.replace(/{{NAME}}/g,t),c=J(i,"tests","storage"),u=J(process.cwd(),c),p=J(u,`${t}Storage.spec.ts`);await Bun.write(p,l);let m=new xm;m.success(`${J(a,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${J(c,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/storage"],{cwd:process.cwd(),stdout:"
|
|
3063
|
+
`;class it{getName(){return"make:storage"}getDescription(){return"Generate a new storage class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter storage name"});t=wm(t).replace(/Storage$/,"");let r=Em(t).toUpperCase(),o=oa.replace(/{{NAME}}/g,t).replace(/{{NAME_UPPER}}/g,r),i=s?J("modules",s):".",a=J(i,"src","storage"),n=J(process.cwd(),a),d=J(n,`${t}Storage.ts`);await Bun.write(d,o);let l=ra.replace(/{{NAME}}/g,t),c=J(i,"tests","storage"),u=J(process.cwd(),c),p=J(u,`${t}Storage.spec.ts`);await Bun.write(p,l);let m=new xm;m.success(`${J(a,t)}Storage.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),m.success(`${J(c,t)}Storage.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/storage"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}it=b([x.command()],it);import{join as j}from"path";import{TerminalLogger as Nm}from"@ooneex/logger";import{toPascalCase as Sm}from"@ooneex/utils";var ia=`import { describe, expect, test } from "bun:test";
|
|
3064
3064
|
import { {{NAME}}VectorDatabase } from "@/databases/{{NAME}}VectorDatabase";
|
|
3065
3065
|
|
|
3066
3066
|
describe("{{NAME}}VectorDatabase", () => {
|
|
@@ -3107,8 +3107,8 @@ export class {{NAME}}VectorDatabase extends VectorDatabase<DataType> {
|
|
|
3107
3107
|
};
|
|
3108
3108
|
}
|
|
3109
3109
|
}
|
|
3110
|
-
`;class at{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter vector database name"});t=Sm(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let r=aa.replace(/{{NAME}}/g,t),o=s?j("modules",s):".",i=j(o,"src","databases"),a=j(process.cwd(),i),n=j(a,`${t}VectorDatabase.ts`);await Bun.write(n,r);let d=ia.replace(/{{NAME}}/g,t),l=j(o,"tests","databases"),c=j(process.cwd(),l),u=j(c,`${t}VectorDatabase.spec.ts`);await Bun.write(u,d);let p=new Nm;p.success(`${j(i,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${j(l,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/rag"],{cwd:process.cwd(),stdout:"
|
|
3110
|
+
`;class at{getName(){return"make:vector-database"}getDescription(){return"Generate a new vector database class"}async run(e){let{name:t,module:s}=e;if(!t)t=await v({message:"Enter vector database name"});t=Sm(t).replace(/VectorDatabase$/,"").replace(/Database$/,"");let r=aa.replace(/{{NAME}}/g,t),o=s?j("modules",s):".",i=j(o,"src","databases"),a=j(process.cwd(),i),n=j(a,`${t}VectorDatabase.ts`);await Bun.write(n,r);let d=ia.replace(/{{NAME}}/g,t),l=j(o,"tests","databases"),c=j(process.cwd(),l),u=j(c,`${t}VectorDatabase.spec.ts`);await Bun.write(u,d);let p=new Nm;p.success(`${j(i,t)}VectorDatabase.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),p.success(`${j(l,t)}VectorDatabase.spec.ts created successfully`,void 0,{showTimestamp:!1,showArrow:!1,useSymbol:!0}),await Bun.spawn(["bun","add","@ooneex/rag"],{cwd:process.cwd(),stdout:"ignore",stderr:"inherit"}).exited}}at=b([x.command()],at);var{values:q,positionals:Mm}=Tm({args:Bun.argv,options:{name:{type:"string"},"route-name":{type:"string"},"route-path":{type:"string"},"route-method":{type:"string"},"is-socket":{type:"boolean"},dir:{type:"string"},channel:{type:"string"},"table-name":{type:"string"},module:{type:"string"},destination:{type:"string"}},strict:!1,allowPositionals:!0}),qt=new Rm,da=Mm[2];if(!da)qt.error(`Command name is required
|
|
3111
3111
|
`),process.exit(1);var la=Ft(da);if(!la)qt.info(`No commands found
|
|
3112
3112
|
`),process.exit(1);var Cm={name:q.name,dir:q.dir,channel:q.channel,isSocket:q["is-socket"],tableName:q["table-name"],module:q.module,destination:q.destination,route:{name:q["route-name"],path:q["route-path"],method:q["route-method"]}};try{await la.run(Cm)}catch(e){let t=e instanceof na?e:new na(e instanceof Error?e:String(e));qt.error(t,void 0,{showArrow:!1,showTimestamp:!1,showLevel:!1}),process.exit(1)}
|
|
3113
3113
|
|
|
3114
|
-
//# debugId=
|
|
3114
|
+
//# debugId=5702C0E87621042464756E2164756E21
|