Skip to content

Commit

Permalink
contes generator modified
Browse files Browse the repository at this point in the history
  • Loading branch information
a4arpon committed Nov 16, 2024
1 parent 4022dfe commit bbef97c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion jsr.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@a4arpon/hotshot",
"version": "0.5.9",
"version": "0.6.0",
"exports": {
".":"./src/hot-shot.ts",
"./cli": "./build/main.js"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@a4arpon/hotshot",
"version": "0.5.9",
"version": "0.6.0",
"module": "./build/main.js",
"type": "module",
"repository": "https://github.com/a4arpon/hot-shot.git",
Expand Down
60 changes: 30 additions & 30 deletions src/mods-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,20 @@ export class ${middlewareClassName} implements UseGuard {
export function generateWorkerFile(workerName: string): string {
const workerClassName = `${nameFixer(workerName, true)}Queue`


console.log(`
------------------------------------------------------------------------
Queue Name: ${nameFixer(workerName, false)}Queue
Important Note: You must create a Bull Queue with the same name as
the queue name ${nameFixer(workerName, false)}Queue in your
#libs/conn file.
------------------------------------------------------------------------
`);

return `
import { type Job, Worker } from "bullmq"
import { ${nameFixer(workerName, false)}Queue, redis } from "#libs/conn"
/*
*
* Queue Name: ${nameFixer(workerName, false)}Queue
* Important Note: You must create a Bull Queue with the same name as
* the queue name ${nameFixer(workerName, false)}Queue in your
* #libs/conn file. After creating the queue, you can remove this
* comment.
*
*/
export class ${workerClassName}Worker {
public readonly worker: Worker
Expand Down Expand Up @@ -239,6 +239,26 @@ export class ${cacheDriverClassName} {
export function generateOpenApiSpecContent(specName: string): string {
const openAPISpecClassName = `${nameFixer(specName, true)}OpenApiSpecs`

console.log(`
------------------------------------------------------------------------
Open API Specs
\n
Some Key Points -
1. To use path params, you need to use the path param syntax in the path
and the path param name in the pathParams array.
Example: path: "/author/{authorSlug}", pathParams: ["authorSlug"]
Second brackets {} are used to define the path param syntax.
\n
2. To define a request body, you need to define it as a ZodSchema and
pass it to the requestBody property.
Example: requestBody: z.object({ title: z.string() })\n
Tips: In this project we are using Drizzle-ORM, so we can easily inherit
the ZodSchema from the drizzle-orm.
Doc Link: https://orm.drizzle.team/docs/zod\n
------------------------------------------------------------------------
`);

return `
import type { ApiSpecs, UseOpenApi } from "#libs/open-api"
import { z } from "zod"
Expand All @@ -257,25 +277,5 @@ export function generateOpenApiSpecContent(specName: string): string {
]
}
}
/*
* ------------------------------------------------------------------------
* Open API Specs
*
* Some Key Points -
* 1. To use path params, you need to use the path param syntax in the path
* and the path param name in the pathParams array.
* Example: path: "/author/{authorSlug}", pathParams: ["authorSlug"]
* Second brackets {} are used to define the path param syntax.
*
* 2. To define a request body, you need to define it as a ZodSchema and
* pass it to the requestBody property.
* Example: requestBody: z.object({ title: z.string() })
*
* Tips: In this project we are using Drizzle-ORM, so we can easilty inherit
* the ZodSchema from the drizzle-orm.
* Doc Link: https://orm.drizzle.team/docs/zod
* ------------------------------------------------------------------------
*/
`
}

0 comments on commit bbef97c

Please sign in to comment.