@anthonylzq/simba.js 9.0.0 → 9.1.0

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 (106) hide show
  1. package/README.md +65 -44
  2. package/lib/index.js +42 -5
  3. package/lib/src/functions/api/database.js +40 -218
  4. package/lib/src/functions/api/express.js +100 -604
  5. package/lib/src/functions/api/fastify.js +93 -645
  6. package/lib/src/functions/api/hono.js +157 -0
  7. package/lib/src/functions/api/index.js +37 -59
  8. package/lib/src/functions/api/schemas.js +20 -84
  9. package/lib/src/functions/api/services.js +28 -210
  10. package/lib/src/functions/api/utils.js +10 -432
  11. package/lib/src/functions/biome.js +3 -2
  12. package/lib/src/functions/changelog.js +5 -5
  13. package/lib/src/functions/docker.js +7 -39
  14. package/lib/src/functions/ghat.js +12 -94
  15. package/lib/src/functions/gitignore.js +3 -134
  16. package/lib/src/functions/index.js +1 -2
  17. package/lib/src/functions/license.js +10 -2
  18. package/lib/src/functions/packageJson.js +13 -37
  19. package/lib/src/functions/readme.js +6 -5
  20. package/lib/src/functions/tests.js +17 -320
  21. package/lib/src/functions/tsconfig.js +13 -114
  22. package/lib/src/index.js +45 -21
  23. package/lib/src/utils/entity.js +115 -0
  24. package/lib/src/utils/index.js +2 -0
  25. package/lib/src/utils/mkdirs.js +9 -0
  26. package/lib/src/utils/renderTemplate.js +22 -0
  27. package/lib/src/utils/titleCase.js +5 -10
  28. package/lib/src/utils/writeFile.js +3 -10
  29. package/lib/templates/api/database/connection.ts.ejs +40 -0
  30. package/lib/templates/api/database/db-index.ts.ejs +2 -0
  31. package/lib/templates/api/database/index.ts.ejs +1 -0
  32. package/lib/templates/api/database/queries-entity.ts.ejs +98 -0
  33. package/lib/templates/api/database/queries-index.ts.ejs +1 -0
  34. package/lib/templates/api/database/schema.prisma.ejs +25 -0
  35. package/lib/templates/api/express/network/index.ts.ejs +2 -0
  36. package/lib/templates/api/express/network/models/entity.ts.ejs +21 -0
  37. package/lib/templates/api/express/network/models/index.ts.ejs +1 -0
  38. package/lib/templates/api/express/network/resolvers/entity.ts.ejs +41 -0
  39. package/lib/templates/api/express/network/resolvers/index.ts.ejs +13 -0
  40. package/lib/templates/api/express/network/response.ts.ejs +17 -0
  41. package/lib/templates/api/express/network/router.ts.ejs +39 -0
  42. package/lib/templates/api/express/network/routes/docs.ts.ejs +43 -0
  43. package/lib/templates/api/express/network/routes/entity.ts.ejs +165 -0
  44. package/lib/templates/api/express/network/routes/home.ts.ejs +16 -0
  45. package/lib/templates/api/express/network/routes/index.ts.ejs +5 -0
  46. package/lib/templates/api/express/network/server.ts.ejs +139 -0
  47. package/lib/templates/api/express/network/utils/index.ts.ejs +45 -0
  48. package/lib/templates/api/express/types/graphQL/context.d.ts.ejs +3 -0
  49. package/lib/templates/api/express/types/index.d.ts.ejs +4 -0
  50. package/lib/templates/api/fastify/network/index.ts.ejs +2 -0
  51. package/lib/templates/api/fastify/network/models/entity.ts.ejs +21 -0
  52. package/lib/templates/api/fastify/network/models/index.ts.ejs +1 -0
  53. package/lib/templates/api/fastify/network/resolvers/entity.ts.ejs +41 -0
  54. package/lib/templates/api/fastify/network/resolvers/index.ts.ejs +13 -0
  55. package/lib/templates/api/fastify/network/response.ts.ejs +17 -0
  56. package/lib/templates/api/fastify/network/router.ts.ejs +36 -0
  57. package/lib/templates/api/fastify/network/routes/docs.ts.ejs +41 -0
  58. package/lib/templates/api/fastify/network/routes/entity.ts.ejs +116 -0
  59. package/lib/templates/api/fastify/network/routes/home.ts.ejs +15 -0
  60. package/lib/templates/api/fastify/network/routes/index.ts.ejs +5 -0
  61. package/lib/templates/api/fastify/network/server.ts.ejs +129 -0
  62. package/lib/templates/api/fastify/types/graphQL/context.d.ts.ejs +3 -0
  63. package/lib/templates/api/fastify/types/index.d.ts.ejs +4 -0
  64. package/lib/templates/api/hono/network/index.ts.ejs +2 -0
  65. package/lib/templates/api/hono/network/models/entity.ts.ejs +21 -0
  66. package/lib/templates/api/hono/network/models/index.ts.ejs +1 -0
  67. package/lib/templates/api/hono/network/resolvers/entity.ts.ejs +41 -0
  68. package/lib/templates/api/hono/network/resolvers/index.ts.ejs +13 -0
  69. package/lib/templates/api/hono/network/response.ts.ejs +18 -0
  70. package/lib/templates/api/hono/network/router.ts.ejs +45 -0
  71. package/lib/templates/api/hono/network/routes/docs.ts.ejs +39 -0
  72. package/lib/templates/api/hono/network/routes/entity.ts.ejs +104 -0
  73. package/lib/templates/api/hono/network/routes/home.ts.ejs +15 -0
  74. package/lib/templates/api/hono/network/routes/index.ts.ejs +5 -0
  75. package/lib/templates/api/hono/network/server.ts.ejs +160 -0
  76. package/lib/templates/api/hono/network/utils/index.ts.ejs +23 -0
  77. package/lib/templates/api/hono/types/graphQL/context.d.ts.ejs +3 -0
  78. package/lib/templates/api/hono/types/index.d.ts.ejs +4 -0
  79. package/lib/templates/api/schemas/entity.ts.ejs +43 -0
  80. package/lib/templates/api/schemas/id.ts.ejs +11 -0
  81. package/lib/templates/api/schemas/index.ts.ejs +2 -0
  82. package/lib/templates/api/services/BaseHttp.ts.ejs +73 -0
  83. package/lib/templates/api/services/entity.ts.ejs +75 -0
  84. package/lib/templates/api/services/index.ts.ejs +1 -0
  85. package/lib/templates/api/services/utils/index.ts.ejs +1 -0
  86. package/lib/templates/api/services/utils/messages/entity.ts.ejs +11 -0
  87. package/lib/templates/api/services/utils/messages/index.ts.ejs +6 -0
  88. package/lib/templates/api/utils/Logger.ts.ejs +41 -0
  89. package/lib/templates/api/utils/index.ts.ejs +1 -0
  90. package/lib/templates/config/.dockerignore.ejs +20 -0
  91. package/lib/templates/config/.env.ejs +3 -0
  92. package/lib/templates/config/.gitignore.ejs +129 -0
  93. package/lib/templates/config/CHANGELOG.md.ejs +1 -0
  94. package/lib/templates/config/Dockerfile.ejs +13 -0
  95. package/lib/templates/config/README.md.ejs +3 -0
  96. package/lib/templates/config/ghat/lint.yml.ejs +46 -0
  97. package/lib/templates/config/ghat/test.yml.ejs +29 -0
  98. package/lib/templates/config/index.ts.ejs +3 -0
  99. package/lib/templates/config/package.json.ejs +30 -0
  100. package/lib/templates/config/test/index.test.ts.ejs +260 -0
  101. package/lib/templates/config/tsconfig.base.json.ejs +43 -0
  102. package/lib/templates/config/tsconfig.json.ejs +16 -0
  103. package/lib/templates/config/vitest.config.ts.ejs +19 -0
  104. package/package.json +45 -17
  105. package/lib/src/functions/api/types.js +0 -108
  106. package/lib/src/functions/eslint.js +0 -125
@@ -0,0 +1,29 @@
1
+ name: Tests - <%- projectName %>
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ test:
7
+ environment: Test
8
+ name: Testing Simba.js API
9
+ runs-on: ubuntu-latest
10
+
11
+ steps:
12
+ - name: Check out Git repository
13
+ uses: actions/checkout@v4
14
+ with:
15
+ fetch-depth: 0
16
+
17
+ - name: Set up Node.js
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: 20.x
21
+ <%- pnpmSetup %>
22
+ - name: Install Node.js dependencies
23
+ run: <%- installCmd %>
24
+
25
+ - name: Run test
26
+ run: <%- runCmd %> test:ci
27
+ env:
28
+ DATABASE_URL: ${{ secrets.DATABASE_URL }}
29
+ NODE_ENV: ci
@@ -0,0 +1,3 @@
1
+ import { Server } from './network'
2
+
3
+ Server.start()
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "<%- sanitizedName %>",
3
+ "version": "<%- projectVersion %>",
4
+ "main": "<%- mainFile %>",
5
+ "description": "<%- projectDescription %>",
6
+ "scripts": {
7
+ "lint": "biome check --write src/",
8
+ "service": "nodemon",
9
+ "start": "tsx src/index.ts",
10
+ "release": "commit-and-tag-version",
11
+ "test:ci": "vitest run",
12
+ "test:local": "NODE_ENV=local vitest run"
13
+ },
14
+ "author": "<%- author %>",<% if (license !== 'unlicensed') { %>
15
+ "license": "<%- license.toUpperCase() %>",
16
+ <% } %>
17
+ "dependencies": {},
18
+ "devDependencies": {},
19
+ "nodemonConfig": {
20
+ "watch": [
21
+ ".env",
22
+ "src"
23
+ ],
24
+ "ext": "ts",
25
+ "ignore": [
26
+ "src/**/*.test.ts"
27
+ ],
28
+ "exec": "DEBUG=App:* npx tsx -r dotenv/config ./src/index"
29
+ }
30
+ }
@@ -0,0 +1,260 @@
1
+ import axios from 'axios'
2
+ import { afterAll, beforeAll, describe, expect, it } from 'vitest'
3
+ import z from 'zod'
4
+
5
+ import { Server } from '../src/network'
6
+ import { <%- entity %>Dto } from '../src/schemas'
7
+
8
+ const BASE_URL = `http://localhost:${process.env.PORT || 1996}`
9
+ const baseResponseDto = z.object({
10
+ error: z.boolean(),
11
+ message: z.string()
12
+ })
13
+
14
+ type BaseResponseDTO = z.infer<typeof baseResponseDto>
15
+
16
+ describe('Simba.js tests', () => {
17
+ beforeAll(async () => {
18
+ await Server.start()
19
+ })
20
+
21
+ describe('API endpoints tests', () => {
22
+ let <%- entity %>ID = <%- dbIsSQL ? '0' : "''" %>
23
+
24
+ <% if (graphql) { -%>
25
+ describe('API: GET /', () => {
26
+ it('Should return 200 with a successful operation', async () => {
27
+ const result = await axios.get<BaseResponseDTO>(BASE_URL)
28
+
29
+ expect(result.status).toBe(200)
30
+ expect(result.data.error).toBe(false)
31
+ expect(baseResponseDto.parse(result.data).error).toBe(false)
32
+ })
33
+ })
34
+
35
+ describe('API: store<%- Entity %> mutation', () => {
36
+ const store<%- Entity %>Response = z.object({
37
+ data: z.object({
38
+ <%- entity %>: <%- entity %>Dto
39
+ })
40
+ })
41
+
42
+ type Store<%- Entity %>DTO = z.infer<typeof store<%- Entity %>Response>
43
+
44
+ it('Should create a <%- entity %> successfully', async () => {
45
+ const result = await axios.post<Store<%- Entity %>DTO>(`${BASE_URL}/graphql`, {
46
+ query: `mutation store($<%- entity %>: <%- Entity %>Input!) {
47
+ <%- entity %>: store(<%- entity %>: $<%- entity %>) {
48
+ id
49
+ <% entityFields.forEach(function(f) { -%>
50
+ <%- f.name %>
51
+ <% }) -%>
52
+ createdAt
53
+ updatedAt
54
+ }
55
+ }`,
56
+ variables: {
57
+ <%- entity %>: {
58
+ <% const sampleEntries1 = Object.entries(sampleData); sampleEntries1.forEach(function([key, val], i) { -%>
59
+ <%- key %>: <%- val %><%= i < sampleEntries1.length - 1 ? ',' : '' %>
60
+ <% }) -%>
61
+ }
62
+ }
63
+ })
64
+
65
+ <%- entity %>ID = result.data.data.<%- entity %>.id ?? <%- entity %>ID
66
+ expect(<%- entity %>ID).toBeTruthy()
67
+ expect(result.status).toBe(200)
68
+ expect(store<%- Entity %>Response.safeParse(result.data).success).toBe(true)
69
+ })
70
+ })
71
+
72
+ describe('API: get<%- Entity %> query', () => {
73
+ const get<%- Entity %>Response = z.object({
74
+ data: z.object({
75
+ <%- entity %>: <%- entity %>Dto
76
+ })
77
+ })
78
+
79
+ type GetOne<%- Entity %>DTO = z.infer<typeof get<%- Entity %>Response>
80
+
81
+ it('Should return a <%- entity %>', async () => {
82
+ const result = await axios.post<GetOne<%- Entity %>DTO>(`${BASE_URL}/graphql`, {
83
+ query: `query getById($id: <%- dbIsSQL ? 'Float' : 'String' %>!) {
84
+ <%- entity %>: getById(id: $id) {
85
+ id
86
+ <% entityFields.forEach(function(f) { -%>
87
+ <%- f.name %>
88
+ <% }) -%>
89
+ createdAt
90
+ updatedAt
91
+ }
92
+ }`,
93
+ variables: {
94
+ id: <%- entity %>ID
95
+ }
96
+ })
97
+
98
+ expect(result.status).toBe(200)
99
+ expect(get<%- Entity %>Response.safeParse(result.data).success).toBe(true)
100
+ })
101
+ })
102
+
103
+ describe('API: update<%- Entity %> mutation', () => {
104
+ const update<%- Entity %>Response = z.object({
105
+ data: z.object({
106
+ <%- entity %>: <%- entity %>Dto
107
+ })
108
+ })
109
+
110
+ type Update<%- Entity %>DTO = z.infer<typeof update<%- Entity %>Response>
111
+
112
+ it('Should update a <%- entity %> successfully', async () => {
113
+ const result = await axios.post<Update<%- Entity %>DTO>(`${BASE_URL}/graphql`, {
114
+ query: `mutation update($id: <%- dbIsSQL ? 'Float' : 'String' %>!, $<%- entity %>: <%- Entity %>Input!) {
115
+ <%- entity %>: update(id: $id, <%- entity %>: $<%- entity %>) {
116
+ id
117
+ <% entityFields.forEach(function(f) { -%>
118
+ <%- f.name %>
119
+ <% }) -%>
120
+ createdAt
121
+ updatedAt
122
+ }
123
+ }`,
124
+ variables: {
125
+ id: <%- entity %>ID,
126
+ <%- entity %>: {
127
+ <% const updateEntries1 = Object.entries(updateData); updateEntries1.forEach(function([key, val], i) { -%>
128
+ <%- key %>: <%- val %><%= i < updateEntries1.length - 1 ? ',' : '' %>
129
+ <% }) -%>
130
+ }
131
+ }
132
+ })
133
+
134
+ expect(result.status).toBe(200)
135
+ expect(update<%- Entity %>Response.safeParse(result.data).success).toBe(true)
136
+ })
137
+ })
138
+
139
+ describe('API: delete<%- Entity %> mutation', () => {
140
+ const delete<%- Entity %>Response = z.object({
141
+ data: z.object({
142
+ result: z.string()
143
+ })
144
+ })
145
+
146
+ type Delete<%- Entity %>DTO = z.infer<typeof delete<%- Entity %>Response>
147
+
148
+ it('Should delete the created <%- entity %>', async () => {
149
+ const result = await axios.post<Delete<%- Entity %>DTO>(`${BASE_URL}/graphql`, {
150
+ query: `mutation deleteById($id: <%- dbIsSQL ? 'Float' : 'String' %>!) {
151
+ result: deleteById(id: $id)
152
+ }`,
153
+ variables: {
154
+ id: <%- entity %>ID
155
+ }
156
+ })
157
+
158
+ expect(result.status).toBe(200)
159
+ expect(delete<%- Entity %>Response.safeParse(result.data).success).toBe(true)
160
+ })
161
+ })
162
+ <% } else { -%>
163
+ describe('API: GET /', () => {
164
+ it('Should return 200 with a successful operation', async () => {
165
+ const result = await axios.get<BaseResponseDTO>(BASE_URL)
166
+
167
+ expect(result.status).toBe(200)
168
+ expect(result.data.error).toBe(false)
169
+ expect(baseResponseDto.parse(result.data).error).toBe(false)
170
+ })
171
+ })
172
+
173
+ describe('API: POST /api/<%- entities %>', () => {
174
+ const store<%- Entity %>Response = z.object({
175
+ error: z.boolean(),
176
+ message: <%- entity %>Dto
177
+ })
178
+
179
+ type Store<%- Entity %>DTO = z.infer<typeof store<%- Entity %>Response>
180
+
181
+ it('Should create a <%- entity %> successfully', async () => {
182
+ const result = await axios.post<Store<%- Entity %>DTO>(`${BASE_URL}/api/<%- entities %>`, {
183
+ args: {
184
+ <% const sampleEntries2 = Object.entries(sampleData); sampleEntries2.forEach(function([key, val], i) { -%>
185
+ <%- key %>: <%- val %><%= i < sampleEntries2.length - 1 ? ',' : '' %>
186
+ <% }) -%>
187
+ }
188
+ })
189
+
190
+ <%- entity %>ID = result.data.message.id ?? <%- entity %>ID
191
+ expect(<%- entity %>ID).toBeTruthy()
192
+ expect(result.status).toBe(201)
193
+ expect(result.data.error).toBe(false)
194
+ expect(store<%- Entity %>Response.parse(result.data).error).toBe(false)
195
+ })
196
+ })
197
+
198
+ describe('API: GET /api/<%- entity %>/:id', () => {
199
+ const getOne<%- Entity %>Response = z.object({
200
+ error: z.boolean(),
201
+ message: <%- entity %>Dto
202
+ })
203
+
204
+ type GetOne<%- Entity %>DTO = z.infer<typeof getOne<%- Entity %>Response>
205
+
206
+ it('Should return a <%- entity %>', async () => {
207
+ const result = await axios.get<GetOne<%- Entity %>DTO>(
208
+ `${BASE_URL}/api/<%- entity %>/${<%- entity %>ID}`
209
+ )
210
+
211
+ expect(result.status).toBe(200)
212
+ expect(result.data.error).toBe(false)
213
+ expect(getOne<%- Entity %>Response.parse(result.data).error).toBe(false)
214
+ })
215
+ })
216
+
217
+ describe('API: PATCH /api/<%- entity %>/:id', () => {
218
+ const update<%- Entity %>Response = z.object({
219
+ error: z.boolean(),
220
+ message: <%- entity %>Dto
221
+ })
222
+
223
+ type Update<%- Entity %>DTO = z.infer<typeof update<%- Entity %>Response>
224
+
225
+ it('Should update a <%- entity %> successfully', async () => {
226
+ const result = await axios.patch<Update<%- Entity %>DTO>(
227
+ `${BASE_URL}/api/<%- entity %>/${<%- entity %>ID}`,
228
+ {
229
+ args: {
230
+ <% const updateEntries2 = Object.entries(updateData); updateEntries2.forEach(function([key, val], i) { -%>
231
+ <%- key %>: <%- val %><%= i < updateEntries2.length - 1 ? ',' : '' %>
232
+ <% }) -%>
233
+ }
234
+ }
235
+ )
236
+
237
+ expect(result.status).toBe(200)
238
+ expect(result.data.error).toBe(false)
239
+ expect(update<%- Entity %>Response.parse(result.data).error).toBe(false)
240
+ })
241
+ })
242
+
243
+ describe('API: DELETE /api/<%- entity %>/:id', () => {
244
+ it('Should delete the created <%- entity %>', async () => {
245
+ const result = await axios.delete<BaseResponseDTO>(
246
+ `${BASE_URL}/api/<%- entity %>/${<%- entity %>ID}`
247
+ )
248
+
249
+ expect(result.status).toBe(200)
250
+ expect(result.data.error).toBe(false)
251
+ expect(baseResponseDto.parse(result.data).error).toBe(false)
252
+ })
253
+ })
254
+ <% } -%>
255
+ })
256
+
257
+ afterAll(async () => {
258
+ await Server.stop()
259
+ })
260
+ })
@@ -0,0 +1,43 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "commonjs",
5
+ "lib": ["es2022", "esnext.asynciterable"],
6
+ "allowJs": true,
7
+ "outDir": "dist",
8
+ "rootDir": "src",
9
+ "downlevelIteration": true,
10
+
11
+ "strict": true,
12
+ "noImplicitAny": true,
13
+ "strictNullChecks": true,
14
+ "strictFunctionTypes": true,
15
+ "strictBindCallApply": true,
16
+ "strictPropertyInitialization": true,
17
+ "noImplicitThis": true,
18
+ "alwaysStrict": true,
19
+
20
+ "noUnusedLocals": true,
21
+ "noUnusedParameters": true,
22
+ "noImplicitReturns": true,
23
+ "noFallthroughCasesInSwitch": true,
24
+
25
+ "moduleResolution": "node",
26
+ "baseUrl": "src",
27
+ "allowSyntheticDefaultImports": true,
28
+ "esModuleInterop": true,
29
+ "resolveJsonModule": true,
30
+
31
+ "sourceMap": false,
32
+ <% if (graphQL) { -%>
33
+
34
+ "experimentalDecorators": true,
35
+ "emitDecoratorMetadata": true,
36
+ <% } -%>
37
+
38
+ "skipLibCheck": true,
39
+ "forceConsistentCasingInFileNames": true
40
+ },
41
+ "include": ["src", "test"],
42
+ "exclude": ["node_modules"]
43
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src"
4
+ },
5
+ "extends": "./tsconfig.base.json",
6
+ "exclude": [
7
+ "node_modules",
8
+ "test",
9
+ "tests",
10
+ "__test__",
11
+ "dist"
12
+ ],
13
+ "include": [
14
+ "src"
15
+ ]
16
+ }
@@ -0,0 +1,19 @@
1
+ import { defineConfig } from 'vitest/config'
2
+ import tsconfigPaths from 'vite-tsconfig-paths'
3
+ <% if (graphql) { -%>
4
+ import swc from 'unplugin-swc'
5
+ <% } -%>
6
+
7
+ export default defineConfig({
8
+ plugins: [
9
+ tsconfigPaths()<% if (graphql) { %>,
10
+ swc.vite({
11
+ module: { type: 'es6' }
12
+ })<% } %>
13
+ ],
14
+ test: {
15
+ testTimeout: 60_000,
16
+ fileParallelism: false,
17
+ setupFiles: ['dotenv/config']
18
+ }
19
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthonylzq/simba.js",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "description": "set up a modern backend app by running one command",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -16,9 +16,9 @@
16
16
  "db:restore:mongo": "node ./scripts/db/mongo/restore.mjs",
17
17
  "db:restore:sql": "node ./scripts/db/sql/restore.mjs",
18
18
  "example": "node -r dotenv/config ./bin -N local-example -D 'This is a test using fastify' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -F",
19
- "build": "npm run build:express:all && npm run build:fastify:all",
20
- "build:mongo": "npm run rm:mongo && npm run db:create:mongo && npm run build:express:mongo && npm run build:fastify:mongo && npm run build:express:mongo:graphql && npm run build:fastify:mongo:graphql",
21
- "build:sql": "npm run rm:sql && npm run db:create:sql && npm run build:express && npm run build:fastify && npm run build:express:graphql && npm run build:fastify:graphql",
19
+ "build": "npm run build:express:all && npm run build:fastify:all && npm run build:hono:all",
20
+ "build:mongo": "npm run rm:mongo && npm run db:create:mongo && npm run build:express:mongo && npm run build:fastify:mongo && npm run build:hono:mongo && npm run build:express:mongo:graphql && npm run build:fastify:mongo:graphql && npm run build:hono:mongo:graphql",
21
+ "build:sql": "npm run rm:sql && npm run db:create:sql && npm run build:express && npm run build:fastify && npm run build:hono && npm run build:express:graphql && npm run build:fastify:graphql && npm run build:hono:graphql",
22
22
  "build:express:all": "npm run db:create && npm run build:express && npm run build:express:mongo && npm run build:express:graphql && npm run build:express:mongo:graphql",
23
23
  "build:fastify:all": "npm run db:create && npm run build:fastify && npm run build:fastify:mongo && npm run build:fastify:graphql && npm run build:fastify:mongo:graphql",
24
24
  "build:express": "npm run db:create:sql && npm run rm:express && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express -D 'This is a test using Express with Prisma and PostgreSQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -d postgres && npm run rm:git:express:mongo",
@@ -29,16 +29,23 @@
29
29
  "build:express:mongo:graphql": "npm run db:create:mongo && npm run rm:express:mongo:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express-mongo-graphql -D 'This is a test using Express with GraphQL with Prisma and MongoDB' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat && npm run rm:git:express:mongo:graphql",
30
30
  "build:fastify:graphql": "npm run db:create:sql && npm run rm:fastify:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify-graphql -D 'This is a test using Fastify with GraphQL with Prisma and PostgreSQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat -d postgres -F && npm run rm:git:fastify:graphql",
31
31
  "build:fastify:mongo:graphql": "npm run db:create:mongo && npm run rm:fastify:mongo:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify-mongo-graphql -D 'This is a test using Fastify with GraphQL with Prisma and MongoDB' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat -F && npm run rm:git:fastify:mongo:graphql",
32
+ "build:hono:all": "npm run db:create && npm run build:hono && npm run build:hono:mongo && npm run build:hono:graphql && npm run build:hono:mongo:graphql",
33
+ "build:hono": "npm run db:create:sql && npm run rm:hono && npm run cd:mv:example && node -r dotenv/config ./bin -N example/hono -D 'This is a test using Hono with Prisma and PostgreSQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -d postgres -O && npm run rm:git:hono",
34
+ "build:hono:mongo": "npm run db:create:mongo && npm run rm:hono:mongo && npm run cd:mv:example && node -r dotenv/config ./bin -N example/hono-mongo -D 'This is a test using Hono with Prisma and MongoDB' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -O && npm run rm:git:hono:mongo",
35
+ "build:hono:graphql": "npm run db:create:sql && npm run rm:hono:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/hono-graphql -D 'This is a test using Hono with GraphQL with Prisma and PostgreSQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat -d postgres -O && npm run rm:git:hono:graphql",
36
+ "build:hono:mongo:graphql": "npm run db:create:mongo && npm run rm:hono:mongo:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/hono-mongo-graphql -D 'This is a test using Hono with GraphQL with Prisma and MongoDB' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat -O && npm run rm:git:hono:mongo:graphql",
32
37
  "build:and:test:only": "npm run build && npm run test:only",
33
38
  "test": "npm run test:without:restore && git restore .",
39
+ "test:unit": "jest --config jest.unit.config.js",
34
40
  "test:local": "npm run test:without:restore",
35
41
  "test:integration": "node --experimental-vm-modules node_modules/jest/bin/jest.js --config jest.integration.config.js --testPathPattern=test/integration",
36
- "test:without:restore": "npm run db:create && npm run build && npm run test:express:local && npm run test:express:mongo:local && npm run test:express:graphql:local && npm run test:express:mongo:graphql:local && npm run test:fastify:local && npm run test:fastify:mongo:local && npm run test:fastify:graphql:local && npm run test:fastify:mongo:graphql:local",
37
- "test:mongo:ci": "npm run build:mongo && npm run test:express:mongo:ci && npm run test:fastify:mongo:ci && npm run test:express:mongo:graphql:ci && npm run test:fastify:mongo:graphql:ci",
38
- "test:sql:ci": "npm run build:sql && npm run test:express:ci && npm run test:fastify:ci && npm run test:express:graphql:ci && npm run test:fastify:graphql:ci",
39
- "test:only": "npm run test:express:only && npm run test:fastify:only",
42
+ "test:without:restore": "npm run db:create && npm run build && npm run test:express:local && npm run test:express:mongo:local && npm run test:express:graphql:local && npm run test:express:mongo:graphql:local && npm run test:fastify:local && npm run test:fastify:mongo:local && npm run test:fastify:graphql:local && npm run test:fastify:mongo:graphql:local && npm run test:hono:local && npm run test:hono:mongo:local && npm run test:hono:graphql:local && npm run test:hono:mongo:graphql:local",
43
+ "test:mongo:ci": "npm run build:mongo && npm run test:express:mongo:ci && npm run test:fastify:mongo:ci && npm run test:hono:mongo:ci && npm run test:express:mongo:graphql:ci && npm run test:fastify:mongo:graphql:ci && npm run test:hono:mongo:graphql:ci",
44
+ "test:sql:ci": "npm run build:sql && npm run test:express:ci && npm run test:fastify:ci && npm run test:hono:ci && npm run test:express:graphql:ci && npm run test:fastify:graphql:ci && npm run test:hono:graphql:ci",
45
+ "test:only": "npm run test:express:only && npm run test:fastify:only && npm run test:hono:only",
40
46
  "test:express:only": "npm run test:express:local && npm run test:express:mongo:local && npm run test:express:graphql:local && npm run test:express:mongo:graphql:local",
41
47
  "test:fastify:only": "npm run test:fastify:local && npm run test:fastify:mongo:local && npm run test:fastify:graphql:local && npm run test:fastify:mongo:graphql:local",
48
+ "test:hono:only": "npm run test:hono:local && npm run test:hono:mongo:local && npm run test:hono:graphql:local && npm run test:hono:mongo:graphql:local",
42
49
  "test:express:local": "if [ -d \"example/express/node_modules\" ]; then npm run test:local --prefix example/express; else echo 'Can not run the test for express api because the dependencies are not installed'; fi",
43
50
  "test:express:mongo:local": "if [ -d \"example/express-mongo/node_modules\" ]; then npm run test:local --prefix example/express-mongo; else echo 'Can not run the test for express-mongo api because the dependencies are not installed'; fi",
44
51
  "test:fastify:local": "if [ -d \"example/fastify/node_modules\" ]; then npm run test:local --prefix example/fastify; else echo 'Can not run the test for fastify api because the dependencies are not installed'; fi",
@@ -47,6 +54,10 @@
47
54
  "test:express:mongo:graphql:local": "if [ -d \"example/express-mongo-graphql/node_modules\" ]; then npm run test:local --prefix example/express-mongo-graphql; else echo 'Can not run the test for express-mongo-graphql api because the dependencies are not installed'; fi",
48
55
  "test:fastify:graphql:local": "if [ -d \"example/fastify-graphql/node_modules\" ]; then npm run test:local --prefix example/fastify-graphql; else echo 'Can not run the test for fastify-graphql api because the dependencies are not installed'; fi",
49
56
  "test:fastify:mongo:graphql:local": "if [ -d \"example/fastify-mongo-graphql/node_modules\" ]; then npm run test:local --prefix example/fastify-mongo-graphql; else echo 'Can not run the test for fastify-mongo-graphql api because the dependencies are not installed'; fi",
57
+ "test:hono:local": "if [ -d \"example/hono/node_modules\" ]; then npm run test:local --prefix example/hono; else echo 'Can not run the test for hono api because the dependencies are not installed'; fi",
58
+ "test:hono:mongo:local": "if [ -d \"example/hono-mongo/node_modules\" ]; then npm run test:local --prefix example/hono-mongo; else echo 'Can not run the test for hono-mongo api because the dependencies are not installed'; fi",
59
+ "test:hono:graphql:local": "if [ -d \"example/hono-graphql/node_modules\" ]; then npm run test:local --prefix example/hono-graphql; else echo 'Can not run the test for hono-graphql api because the dependencies are not installed'; fi",
60
+ "test:hono:mongo:graphql:local": "if [ -d \"example/hono-mongo-graphql/node_modules\" ]; then npm run test:local --prefix example/hono-mongo-graphql; else echo 'Can not run the test for hono-mongo-graphql api because the dependencies are not installed'; fi",
50
61
  "test:express:ci": "if [ -d \"example/express/node_modules\" ]; then npm run test:ci --prefix example/express; else echo 'Can not run the test for express api because the dependencies are not installed'; fi",
51
62
  "test:express:mongo:ci": "if [ -d \"example/express-mongo/node_modules\" ]; then npm run test:ci --prefix example/express-mongo; else echo 'Can not run the test for express-mongo api because the dependencies are not installed'; fi",
52
63
  "test:fastify:ci": "if [ -d \"example/fastify/node_modules\" ]; then npm run test:ci --prefix example/fastify; else echo 'Can not run the test for fastify api because the dependencies are not installed'; fi",
@@ -55,6 +66,10 @@
55
66
  "test:express:mongo:graphql:ci": "if [ -d \"example/express-mongo-graphql/node_modules\" ]; then npm run test:ci --prefix example/express-mongo-graphql; else echo 'Can not run the test for express-mongo-graphql api because the dependencies are not installed'; fi",
56
67
  "test:fastify:graphql:ci": "if [ -d \"example/fastify-graphql/node_modules\" ]; then npm run test:ci --prefix example/fastify-graphql; else echo 'Can not run the test for fastify-graphql api because the dependencies are not installed'; fi",
57
68
  "test:fastify:mongo:graphql:ci": "if [ -d \"example/fastify-mongo-graphql/node_modules\" ]; then npm run test:ci --prefix example/fastify-mongo-graphql; else echo 'Can not run the test for fastify-mongo-graphql api because the dependencies are not installed'; fi",
69
+ "test:hono:ci": "if [ -d \"example/hono/node_modules\" ]; then npm run test:ci --prefix example/hono; else echo 'Can not run the test for hono api because the dependencies are not installed'; fi",
70
+ "test:hono:mongo:ci": "if [ -d \"example/hono-mongo/node_modules\" ]; then npm run test:ci --prefix example/hono-mongo; else echo 'Can not run the test for hono-mongo api because the dependencies are not installed'; fi",
71
+ "test:hono:graphql:ci": "if [ -d \"example/hono-graphql/node_modules\" ]; then npm run test:ci --prefix example/hono-graphql; else echo 'Can not run the test for hono-graphql api because the dependencies are not installed'; fi",
72
+ "test:hono:mongo:graphql:ci": "if [ -d \"example/hono-mongo-graphql/node_modules\" ]; then npm run test:ci --prefix example/hono-mongo-graphql; else echo 'Can not run the test for hono-mongo-graphql api because the dependencies are not installed'; fi",
58
73
  "list:directory:tree:express": "if [ -f \"projectStructureExamples/express.txt\" ]; then rm projectStructureExamples/express.txt; fi && tree example/express -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express.txt",
59
74
  "list:directory:tree:express:mongo": "if [ -f \"projectStructureExamples/express-mongo.txt\" ]; then rm projectStructureExamples/express-mongo.txt; fi && tree example/express-mongo -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express-mongo.txt",
60
75
  "list:directory:tree:fastify": "if [ -f \"projectStructureExamples/fastify.txt\" ]; then rm projectStructureExamples/fastify.txt; fi && tree example/fastify -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/fastify.txt",
@@ -63,10 +78,14 @@
63
78
  "list:directory:tree:express:mongo:graphql": "if [ -f \"projectStructureExamples/express-mongo-graphql.txt\" ]; then rm projectStructureExamples/express-mongo-graphql.txt; fi && tree example/express-mongo-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express-mongo-graphql.txt",
64
79
  "list:directory:tree:fastify:graphql": "if [ -f \"projectStructureExamples/fastify-graphql.txt\" ]; then rm projectStructureExamples/fastify-graphql.txt; fi && tree example/fastify-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/fastify-graphql.txt",
65
80
  "list:directory:tree:fastify:mongo:graphql": "if [ -f \"projectStructureExamples/fastify-mongo-graphql.txt\" ]; then rm projectStructureExamples/fastify-mongo-graphql.txt; fi && tree example/fastify-mongo-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/fastify-mongo-graphql.txt",
66
- "list:directory:tree:examples": "npm run rm:project:structures && npm run list:directory:tree:express && npm run list:directory:tree:express:mongo && npm run list:directory:tree:fastify && npm run list:directory:tree:fastify:mongo && npm run list:directory:tree:express:graphql && npm run list:directory:tree:express:mongo:graphql && npm run list:directory:tree:fastify:graphql && npm run list:directory:tree:fastify:mongo:graphql",
81
+ "list:directory:tree:hono": "if [ -f \"projectStructureExamples/hono.txt\" ]; then rm projectStructureExamples/hono.txt; fi && tree example/hono -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/hono.txt",
82
+ "list:directory:tree:hono:mongo": "if [ -f \"projectStructureExamples/hono-mongo.txt\" ]; then rm projectStructureExamples/hono-mongo.txt; fi && tree example/hono-mongo -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/hono-mongo.txt",
83
+ "list:directory:tree:hono:graphql": "if [ -f \"projectStructureExamples/hono-graphql.txt\" ]; then rm projectStructureExamples/hono-graphql.txt; fi && tree example/hono-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/hono-graphql.txt",
84
+ "list:directory:tree:hono:mongo:graphql": "if [ -f \"projectStructureExamples/hono-mongo-graphql.txt\" ]; then rm projectStructureExamples/hono-mongo-graphql.txt; fi && tree example/hono-mongo-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/hono-mongo-graphql.txt",
85
+ "list:directory:tree:examples": "npm run rm:project:structures && npm run list:directory:tree:express && npm run list:directory:tree:express:mongo && npm run list:directory:tree:fastify && npm run list:directory:tree:fastify:mongo && npm run list:directory:tree:hono && npm run list:directory:tree:hono:mongo && npm run list:directory:tree:express:graphql && npm run list:directory:tree:express:mongo:graphql && npm run list:directory:tree:fastify:graphql && npm run list:directory:tree:fastify:mongo:graphql && npm run list:directory:tree:hono:graphql && npm run list:directory:tree:hono:mongo:graphql",
67
86
  "rm": "if [ -d \"example\" ]; then rm -rf example; fi",
68
- "rm:mongo": "if [ -d \"example/express-mongo\" ]; then rm -rf example/express-mongo; fi && if [ -d \"example/express-mongo-graphql\" ]; then rm -rf example/express-mongo-graphql; fi && if [ -d \"example/fastify-mongo\" ]; then rm -rf example/fastify-mongo; fi && if [ -d \"example/fastify-mongo-graphql\" ]; then rm -rf example/fastify-mongo-graphql; fi",
69
- "rm:sql": "if [ -d \"example/express\" ]; then rm -rf example/express; fi && if [ -d \"example/express-graphql\" ]; then rm -rf example/express-graphql; fi && if [ -d \"example/fastify\" ]; then rm -rf example/fastify; fi && if [ -d \"example/fastify-graphql\" ]; then rm -rf example/fastify-graphql; fi",
87
+ "rm:mongo": "if [ -d \"example/express-mongo\" ]; then rm -rf example/express-mongo; fi && if [ -d \"example/express-mongo-graphql\" ]; then rm -rf example/express-mongo-graphql; fi && if [ -d \"example/fastify-mongo\" ]; then rm -rf example/fastify-mongo; fi && if [ -d \"example/fastify-mongo-graphql\" ]; then rm -rf example/fastify-mongo-graphql; fi && if [ -d \"example/hono-mongo\" ]; then rm -rf example/hono-mongo; fi && if [ -d \"example/hono-mongo-graphql\" ]; then rm -rf example/hono-mongo-graphql; fi",
88
+ "rm:sql": "if [ -d \"example/express\" ]; then rm -rf example/express; fi && if [ -d \"example/express-graphql\" ]; then rm -rf example/express-graphql; fi && if [ -d \"example/fastify\" ]; then rm -rf example/fastify; fi && if [ -d \"example/fastify-graphql\" ]; then rm -rf example/fastify-graphql; fi && if [ -d \"example/hono\" ]; then rm -rf example/hono; fi && if [ -d \"example/hono-graphql\" ]; then rm -rf example/hono-graphql; fi",
70
89
  "rm:express": "if [ -d \"example/express\" ]; then rm -rf example/express; fi",
71
90
  "rm:express:mongo": "if [ -d \"example/express-mongo\" ]; then rm -rf example/express-mongo; fi",
72
91
  "rm:fastify": "if [ -d \"example/fastify\" ]; then rm -rf example/fastify; fi",
@@ -75,6 +94,10 @@
75
94
  "rm:fastify:graphql": "if [ -d \"example/fastify-graphql\" ]; then rm -rf example/fastify-graphql; fi",
76
95
  "rm:express:mongo:graphql": "if [ -d \"example/express-mongo-graphql\" ]; then rm -rf example/express-mongo-graphql; fi",
77
96
  "rm:fastify:mongo:graphql": "if [ -d \"example/fastify-mongo-graphql\" ]; then rm -rf example/fastify-mongo-graphql; fi",
97
+ "rm:hono": "if [ -d \"example/hono\" ]; then rm -rf example/hono; fi",
98
+ "rm:hono:mongo": "if [ -d \"example/hono-mongo\" ]; then rm -rf example/hono-mongo; fi",
99
+ "rm:hono:graphql": "if [ -d \"example/hono-graphql\" ]; then rm -rf example/hono-graphql; fi",
100
+ "rm:hono:mongo:graphql": "if [ -d \"example/hono-mongo-graphql\" ]; then rm -rf example/hono-mongo-graphql; fi",
78
101
  "rm:git:express": "if [ -d \"example/express/.git\" ]; then rm -rf example/express/.git; fi",
79
102
  "rm:git:express:mongo": "if [ -d \"example/express-mongo/.git\" ]; then rm -rf example/express-mongo/.git; fi",
80
103
  "rm:git:fastify": "if [ -d \"example/fastify/.git\" ]; then rm -rf example/fastify/.git; fi",
@@ -83,9 +106,13 @@
83
106
  "rm:git:express:mongo:graphql": "if [ -d \"example/express-mongo-graphql/.git\" ]; then rm -rf example/express-mongo-graphql/.git; fi",
84
107
  "rm:git:fastify:graphql": "if [ -d \"example/fastify-graphql/.git\" ]; then rm -rf example/fastify-graphql/.git; fi",
85
108
  "rm:git:fastify:mongo:graphql": "if [ -d \"example/fastify-mongo-graphql/.git\" ]; then rm -rf example/fastify-mongo-graphql/.git; fi",
109
+ "rm:git:hono": "if [ -d \"example/hono/.git\" ]; then rm -rf example/hono/.git; fi",
110
+ "rm:git:hono:mongo": "if [ -d \"example/hono-mongo/.git\" ]; then rm -rf example/hono-mongo/.git; fi",
111
+ "rm:git:hono:graphql": "if [ -d \"example/hono-graphql/.git\" ]; then rm -rf example/hono-graphql/.git; fi",
112
+ "rm:git:hono:mongo:graphql": "if [ -d \"example/hono-mongo-graphql/.git\" ]; then rm -rf example/hono-mongo-graphql/.git; fi",
86
113
  "rm:project:structures": "if [ -d \"projectStructureExamples\" ]; then rm -rf projectStructureExamples/*; fi",
87
114
  "cd:mv:example": "if [ ! -d \"example\" ]; then mkdir example && cd example; fi",
88
- "release": "standard-version",
115
+ "release": "commit-and-tag-version",
89
116
  "version": "npm run release && npm run list:directory:tree:examples && git add ."
90
117
  },
91
118
  "bin": {
@@ -107,20 +134,21 @@
107
134
  "license": "MIT",
108
135
  "dependencies": {
109
136
  "cli-progress": "3.12.0",
110
- "colors": "1.4.0",
137
+ "ejs": "^4.0.1",
138
+ "picocolors": "^1.1.1",
139
+ "pluralize": "^8.0.0",
111
140
  "prompts": "2.4.2",
112
- "underscore": "1.13.8",
113
141
  "yargs": "17.7.2"
114
142
  },
115
143
  "devDependencies": {
116
144
  "@biomejs/biome": "^2.4.4",
117
145
  "@types/jest": "30.0.0",
146
+ "commit-and-tag-version": "^12.6.1",
118
147
  "dotenv": "17.3.1",
119
148
  "jest": "30.2.0",
120
149
  "knex": "3.1.0",
121
150
  "mongodb": "7.1.0",
122
- "pg": "8.18.0",
123
- "standard-version": "9.5.0"
151
+ "pg": "8.18.0"
124
152
  },
125
153
  "repository": {
126
154
  "type": "git",
@@ -134,7 +162,7 @@
134
162
  "lib",
135
163
  "bin"
136
164
  ],
137
- "standard-version": {
165
+ "commit-and-tag-version": {
138
166
  "skip": {
139
167
  "tag": true,
140
168
  "commit": true,