@anthonylzq/simba.js 8.1.0 → 9.0.1
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/README.md +6 -14
- package/lib/src/functions/api/database.js +4 -4
- package/lib/src/functions/api/express.js +17 -19
- package/lib/src/functions/api/fastify.js +10 -10
- package/lib/src/functions/api/index.js +4 -44
- package/lib/src/functions/api/schemas.js +4 -5
- package/lib/src/functions/api/services.js +4 -4
- package/lib/src/functions/api/types.js +3 -3
- package/lib/src/functions/api/utils.js +4 -4
- package/lib/src/functions/biome.js +130 -0
- package/lib/src/functions/ghat.js +63 -49
- package/lib/src/functions/index.js +1 -1
- package/lib/src/functions/license.js +4 -2
- package/lib/src/functions/packageJson.js +1 -1
- package/lib/src/functions/tests.js +3 -3
- package/lib/src/functions/tsconfig.js +16 -21
- package/lib/src/index.js +11 -20
- package/lib/src/utils/writeFile.js +1 -1
- package/package.json +11 -17
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@anthonylzq/simba.js)
|
|
8
8
|
[](https://github.com/AnthonyLzq/simba.js/blob/master/LICENSE)
|
|
9
|
-
[](https://biomejs.dev)
|
|
10
10
|
[](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)
|
|
11
11
|
[](https://github.com/AnthonyLzq/TypeScriptProjectGenerator/actions/workflows/publish.yml)
|
|
12
12
|
|
|
@@ -164,6 +164,7 @@ Also, if you are interested in the folder structure of each case, please take a
|
|
|
164
164
|
|
|
165
165
|
### Some considerations
|
|
166
166
|
|
|
167
|
+
- **Prisma v6**: Generated projects use Prisma v6 (pinned). Prisma v7 is **not** used because it does not support MongoDB. When Prisma v7 adds MongoDB support, Simba.js will be updated accordingly.
|
|
167
168
|
- You are able to run a server that has one main route, `home` (`/`), `user` (`api/user` or `api/user/:id`) and `docs` (`api/docs`), in case you are not using GraphQL.
|
|
168
169
|
- In case you are using GraphQL, there are 3 mutations (`store`, `update`, and `deleteById`) and 1 query available (`getById`), you can find them in the playground under the route `/api`.
|
|
169
170
|
- To connect your server with your database, you need to provide your database url in the `.env`, except if you choose `sqlite`. By default, Simba will try to connect to a local database. The content of the `.env` file is:
|
|
@@ -248,28 +249,17 @@ Here is the list of the packages that are being installed, as `dependencies`:
|
|
|
248
249
|
|
|
249
250
|
As `devDependencies`:
|
|
250
251
|
|
|
252
|
+
- [`@biomejs/biome`](https://www.npmjs.com/package/@biomejs/biome)
|
|
251
253
|
- [`@jest/types`](https://www.npmjs.com/package/@jest/types)
|
|
252
254
|
- [`@types/debug`](https://www.npmjs.com/package/@types/debug)
|
|
253
255
|
- [`@types/http-errors`](https://www.npmjs.com/package/@types/http-errors)
|
|
254
256
|
- [`@types/jest`](https://www.npmjs.com/package/@types/jest)
|
|
255
257
|
- [`@types/node`](https://www.npmjs.com/package/@types/node)
|
|
256
|
-
- [`@typescript-eslint/eslint-plugin`](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)
|
|
257
|
-
- [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
|
|
258
258
|
- [`axios`](https://www.npmjs.com/package/axios)
|
|
259
259
|
- [`dotenv`](https://www.npmjs.com/package/dotenv)
|
|
260
|
-
- [`eslint`](https://www.npmjs.com/package/eslint)
|
|
261
|
-
- [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier)
|
|
262
|
-
- [`eslint-config-standard`](https://www.npmjs.com/package/eslint-config-standard)
|
|
263
|
-
- [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import)
|
|
264
|
-
- [`eslint-plugin-jest`](https://www.npmjs.com/package/eslint-plugin-jest)
|
|
265
|
-
- [`eslint-plugin-n`](https://www.npmjs.com/package/eslint-plugin-n) (in case you are using yarn as package manager)
|
|
266
|
-
- [`eslint-plugin-node`](https://www.npmjs.com/package/eslint-plugin-node)
|
|
267
|
-
- [`eslint-plugin-prettier`](https://www.npmjs.com/package/eslint-plugin-prettier)
|
|
268
|
-
- [`eslint-plugin-promise`](https://www.npmjs.com/package/eslint-plugin-promise)
|
|
269
260
|
- [`jest`](https://www.npmjs.com/package/jest)
|
|
270
261
|
- [`jest-unit`](https://www.npmjs.com/package/jest-unit)
|
|
271
262
|
- [`nodemon`](https://www.npmjs.com/package/nodemon)
|
|
272
|
-
- [`prettier`](https://www.npmjs.com/package/prettier)
|
|
273
263
|
- [`prisma`](https://www.npmjs.com/package/prisma)
|
|
274
264
|
- [`standard-version`](https://www.npmjs.com/package/standard-version)
|
|
275
265
|
- [`ts-loader`](https://www.npmjs.com/package/ts-loader)
|
|
@@ -284,13 +274,15 @@ As `dependencies`:
|
|
|
284
274
|
- [`@apollo/server`](https://www.npmjs.com/package/@apollo/server)
|
|
285
275
|
- [`class-validator`](https://www.npmjs.com/package/class-validator)
|
|
286
276
|
- [`graphql`](https://www.npmjs.com/package/graphql)
|
|
277
|
+
- [`graphql-scalars`](https://www.npmjs.com/package/graphql-scalars)
|
|
287
278
|
- [`reflect-metadata`](https://www.npmjs.com/package/reflect-metadata)
|
|
288
|
-
- [`type-graphql`](https://www.npmjs.com/package/type-graphql/v/2.0.0-
|
|
279
|
+
- [`type-graphql`](https://www.npmjs.com/package/type-graphql/v/2.0.0-rc.3)
|
|
289
280
|
|
|
290
281
|
### Express case
|
|
291
282
|
|
|
292
283
|
As `dependencies`:
|
|
293
284
|
|
|
285
|
+
- [`@as-integrations/express5`](https://www.npmjs.com/package/@as-integrations/express5) (only when using GraphQL)
|
|
294
286
|
- [`cors`](https://www.npmjs.com/package/cors)
|
|
295
287
|
- [`express`](https://www.npmjs.com/package/express)
|
|
296
288
|
- [`swagger-ui-express`](https://www.npmjs.com/package/swagger-ui-express)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
const writeFile = require('../../utils/writeFile')
|
|
5
5
|
|
|
6
6
|
const dbPrismaName = {
|
|
@@ -76,7 +76,7 @@ export * from './queries'\n`,
|
|
|
76
76
|
},
|
|
77
77
|
connection: {
|
|
78
78
|
content: `import { PrismaClient } from '@prisma/client'
|
|
79
|
-
import { Debugger } from 'debug'
|
|
79
|
+
import { type Debugger } from 'debug'
|
|
80
80
|
|
|
81
81
|
let dbConnected = false
|
|
82
82
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
|
|
5
5
|
const db = require('./database')
|
|
6
6
|
const schemas = require('./schemas')
|
|
@@ -11,10 +11,9 @@ const utils = require('./utils')
|
|
|
11
11
|
/**
|
|
12
12
|
* @param {Object} args
|
|
13
13
|
* @param {String} args.projectName
|
|
14
|
-
* @param {Boolean} args.graphQL
|
|
15
14
|
* @param {Boolean} args.dbIsSQL
|
|
16
15
|
*/
|
|
17
|
-
const types = async ({ projectName,
|
|
16
|
+
const types = async ({ projectName, dbIsSQL }) => {
|
|
18
17
|
const createFoldersCommand = `mkdir ${projectName}/src/@types \
|
|
19
18
|
${!dbIsSQL ? ` ${projectName}/src/@types/models` : ''}`
|
|
20
19
|
|
|
@@ -100,13 +99,13 @@ const applyRoutes = (app: Application): void => {
|
|
|
100
99
|
routers.forEach((router: Router): Application => app.use('/api', router))
|
|
101
100
|
|
|
102
101
|
// Handling 404 error
|
|
103
|
-
app.use((
|
|
102
|
+
app.use((_req, _res, next) => {
|
|
104
103
|
next(new httpErrors.NotFound('This route does not exists'))
|
|
105
104
|
})
|
|
106
105
|
app.use(
|
|
107
106
|
(
|
|
108
107
|
error: httpErrors.HttpError,
|
|
109
|
-
|
|
108
|
+
_req: Request,
|
|
110
109
|
res: Response,
|
|
111
110
|
next: NextFunction
|
|
112
111
|
) => {
|
|
@@ -127,18 +126,17 @@ export { applyRoutes }
|
|
|
127
126
|
},
|
|
128
127
|
server: {
|
|
129
128
|
content: graphQL
|
|
130
|
-
? `import { Server as HttpServer } from 'http'
|
|
129
|
+
? `import type { Server as HttpServer } from 'node:http'
|
|
131
130
|
import express from 'express'
|
|
132
131
|
import cors from 'cors'
|
|
133
132
|
import debug from 'debug'
|
|
134
133
|
import { ApolloServer } from '@apollo/server'
|
|
135
|
-
|
|
136
|
-
import { expressMiddleware } from '@apollo/server/express4'
|
|
134
|
+
import { expressMiddleware } from '@as-integrations/express5'
|
|
137
135
|
|
|
138
136
|
import { dbConnection } from 'database'
|
|
139
137
|
import { applyRoutes } from './router'
|
|
140
138
|
import { buildSchemas } from './resolvers'
|
|
141
|
-
import { Log } from 'utils'
|
|
139
|
+
import { type Log } from 'utils'
|
|
142
140
|
|
|
143
141
|
const d = debug('App:Network:Server')
|
|
144
142
|
const PORT = (process.env.PORT as string) || 1996
|
|
@@ -161,7 +159,7 @@ class Server implements Log {
|
|
|
161
159
|
this.#app.use(express.urlencoded({ extended: false }))
|
|
162
160
|
this.#app.use(
|
|
163
161
|
(
|
|
164
|
-
|
|
162
|
+
_req: express.Request,
|
|
165
163
|
res: express.Response,
|
|
166
164
|
next: express.NextFunction
|
|
167
165
|
) => {
|
|
@@ -241,14 +239,14 @@ class Server implements Log {
|
|
|
241
239
|
const server = new Server()
|
|
242
240
|
|
|
243
241
|
export { server as Server }\n`
|
|
244
|
-
: `import { Server as HttpServer } from 'http'
|
|
242
|
+
: `import type { Server as HttpServer } from 'node:http'
|
|
245
243
|
import express from 'express'
|
|
246
244
|
import cors from 'cors'
|
|
247
245
|
import debug from 'debug'
|
|
248
246
|
|
|
249
247
|
import { dbConnection } from 'database'
|
|
250
248
|
import { applyRoutes } from './router'
|
|
251
|
-
import { Log } from 'utils'
|
|
249
|
+
import { type Log } from 'utils'
|
|
252
250
|
|
|
253
251
|
const d = debug('App:Network:Server')
|
|
254
252
|
const PORT = (process.env.PORT as string) || 1996
|
|
@@ -269,7 +267,7 @@ class Server implements Log {
|
|
|
269
267
|
this.#app.use(express.urlencoded({ extended: false }))
|
|
270
268
|
this.#app.use(
|
|
271
269
|
(
|
|
272
|
-
|
|
270
|
+
_req: express.Request,
|
|
273
271
|
res: express.Response,
|
|
274
272
|
next: express.NextFunction
|
|
275
273
|
) => {
|
|
@@ -345,7 +343,7 @@ import { response } from 'network/response'
|
|
|
345
343
|
|
|
346
344
|
const Home = Router()
|
|
347
345
|
|
|
348
|
-
Home.route('').get((
|
|
346
|
+
Home.route('').get((_req: Request, res: Response) => {
|
|
349
347
|
response({
|
|
350
348
|
error: false,
|
|
351
349
|
message: 'Welcome to your Express Backend!',
|
|
@@ -487,7 +485,7 @@ const validatorCompiler = (
|
|
|
487
485
|
schema: ZodType,
|
|
488
486
|
value: 'body' | 'params'
|
|
489
487
|
): Middleware => {
|
|
490
|
-
return (req: Request,
|
|
488
|
+
return (req: Request, _res: Response, next: NextFunction) => {
|
|
491
489
|
const result = schema.safeParse(req[value])
|
|
492
490
|
|
|
493
491
|
if (result.success) return next()
|
|
@@ -654,9 +652,9 @@ const main = async ({
|
|
|
654
652
|
graphQL,
|
|
655
653
|
dbIsSQL
|
|
656
654
|
})
|
|
657
|
-
await types({ projectName,
|
|
655
|
+
await types({ projectName, dbIsSQL })
|
|
658
656
|
await network({ projectName, graphQL, dbIsSQL })
|
|
659
|
-
await schemas({ projectName, dbIsSQL
|
|
657
|
+
await schemas({ projectName, dbIsSQL })
|
|
660
658
|
await services({ projectName, dbIsSQL })
|
|
661
659
|
await db({ projectName, database })
|
|
662
660
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
|
|
5
5
|
const db = require('./database')
|
|
6
6
|
const schemas = require('./schemas')
|
|
@@ -134,7 +134,7 @@ const applyRoutes = async (app: FastifyInstance) => {
|
|
|
134
134
|
await Docs(app)
|
|
135
135
|
|
|
136
136
|
// Handling 404 error
|
|
137
|
-
app.setNotFoundHandler((
|
|
137
|
+
app.setNotFoundHandler((_request, reply) => {
|
|
138
138
|
response({
|
|
139
139
|
error: true,
|
|
140
140
|
message: 'This route does not exists',
|
|
@@ -142,7 +142,7 @@ const applyRoutes = async (app: FastifyInstance) => {
|
|
|
142
142
|
status: 404
|
|
143
143
|
})
|
|
144
144
|
})
|
|
145
|
-
app.setErrorHandler<HttpError>((error,
|
|
145
|
+
app.setErrorHandler<HttpError>((error, _request, reply) => {
|
|
146
146
|
response({
|
|
147
147
|
error: true,
|
|
148
148
|
message: error.message,
|
|
@@ -189,7 +189,7 @@ class Server implements Log {
|
|
|
189
189
|
async #config() {
|
|
190
190
|
await this.#apolloConfig()
|
|
191
191
|
this.#app.register(require('@fastify/cors'), {})
|
|
192
|
-
this.#app.addHook('preHandler', (
|
|
192
|
+
this.#app.addHook('preHandler', (_request, reply, done) => {
|
|
193
193
|
reply.header('Access-Control-Allow-Methods', 'GET, POST, PATCH, DELETE')
|
|
194
194
|
reply.header('Access-Control-Allow-Origin', '*')
|
|
195
195
|
reply.header(
|
|
@@ -264,7 +264,7 @@ class Server implements Log {
|
|
|
264
264
|
const server = new Server()
|
|
265
265
|
|
|
266
266
|
export { server as Server }\n`
|
|
267
|
-
: `import fastify, { FastifyInstance } from 'fastify'
|
|
267
|
+
: `import fastify, { type FastifyInstance } from 'fastify'
|
|
268
268
|
import debug from 'debug'
|
|
269
269
|
import {
|
|
270
270
|
serializerCompiler,
|
|
@@ -272,7 +272,7 @@ import {
|
|
|
272
272
|
} from 'fastify-type-provider-zod'
|
|
273
273
|
|
|
274
274
|
import { dbConnection } from 'database'
|
|
275
|
-
import { Log } from 'utils'
|
|
275
|
+
import type { Log } from 'utils'
|
|
276
276
|
import { applyRoutes } from './router'
|
|
277
277
|
|
|
278
278
|
const d = debug('App:Network:Server')
|
|
@@ -289,7 +289,7 @@ class Server implements Log {
|
|
|
289
289
|
|
|
290
290
|
async #config() {
|
|
291
291
|
this.#app.register(require('@fastify/cors'), {})
|
|
292
|
-
this.#app.addHook('preHandler', (
|
|
292
|
+
this.#app.addHook('preHandler', (_req, reply, done) => {
|
|
293
293
|
reply.header('Access-Control-Allow-Methods', 'GET, POST, PATCH, DELETE')
|
|
294
294
|
reply.header('Access-Control-Allow-Origin', '*')
|
|
295
295
|
reply.header(
|
|
@@ -404,7 +404,7 @@ export { Docs }\n`,
|
|
|
404
404
|
import { response } from 'network/response'
|
|
405
405
|
|
|
406
406
|
const Home = (app: FastifyInstance, prefix = '/') => {
|
|
407
|
-
app.get(\`\${prefix}\`, (
|
|
407
|
+
app.get(\`\${prefix}\`, (_request, reply) => {
|
|
408
408
|
response({
|
|
409
409
|
error: false,
|
|
410
410
|
message: 'Welcome to your Fastify Backend!',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const os = require('os')
|
|
2
|
-
const util = require('util')
|
|
3
|
-
const exec = util.promisify(require('child_process').exec)
|
|
1
|
+
const os = require('node:os')
|
|
2
|
+
const util = require('node:util')
|
|
3
|
+
const exec = util.promisify(require('node:child_process').exec)
|
|
4
4
|
|
|
5
5
|
const express = require('./express')
|
|
6
6
|
const fastifyF = require('./fastify')
|
|
@@ -34,39 +34,6 @@ module.exports = async ({
|
|
|
34
34
|
}) => {
|
|
35
35
|
const dbIsSQL = database !== 'mongo'
|
|
36
36
|
const data = {
|
|
37
|
-
test: {
|
|
38
|
-
index: {
|
|
39
|
-
content: `### Testing store a user
|
|
40
|
-
POST http://localhost:1996/api/users
|
|
41
|
-
Content-Type: application/json
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
"args": {
|
|
45
|
-
"lastName": "Lzq",
|
|
46
|
-
"name": "Anthony"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
### Testing getOne user
|
|
51
|
-
GET http://localhost:1996/api/user/60e7e3b93b01c1a7aa74cd6b
|
|
52
|
-
|
|
53
|
-
### Testing update user
|
|
54
|
-
PATCH http://localhost:1996/api/user/60e7e3b93b01c1a7aa74cd6b
|
|
55
|
-
Content-Type: application/json
|
|
56
|
-
|
|
57
|
-
{
|
|
58
|
-
"args": {
|
|
59
|
-
"name": "Anthony",
|
|
60
|
-
"lastName": "Luzquiños"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
### Testing delete user
|
|
65
|
-
DELETE http://localhost:1996/api/user/60e7e3b93b01c1a7aa74cd6b
|
|
66
|
-
`,
|
|
67
|
-
file: `${projectName}/index.http`
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
37
|
'.env': {
|
|
71
38
|
content:
|
|
72
39
|
dbIsSQL && database !== 'sqlite'
|
|
@@ -103,8 +70,7 @@ Server.start()
|
|
|
103
70
|
// .env
|
|
104
71
|
writeFile(data['.env'].file, data['.env'].content),
|
|
105
72
|
// index
|
|
106
|
-
writeFile(data.index.file, data.index.content)
|
|
107
|
-
writeFile(data.test.index.file, data.test.index.content)
|
|
73
|
+
writeFile(data.index.file, data.index.content)
|
|
108
74
|
]
|
|
109
75
|
|
|
110
76
|
if (fastify)
|
|
@@ -128,11 +94,5 @@ Server.start()
|
|
|
128
94
|
})
|
|
129
95
|
])
|
|
130
96
|
|
|
131
|
-
if (!graphql)
|
|
132
|
-
processes.push(
|
|
133
|
-
// /test
|
|
134
|
-
writeFile(data.test.index.file, data.test.index.content)
|
|
135
|
-
)
|
|
136
|
-
|
|
137
97
|
await Promise.all(processes)
|
|
138
98
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
const writeFile = require('../../utils/writeFile')
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @param {Object} args
|
|
8
8
|
* @param {String} args.projectName
|
|
9
9
|
* @param {Boolean} args.dbIsSQL
|
|
10
|
-
* @param {Boolean} args.graphql
|
|
11
10
|
*/
|
|
12
|
-
module.exports = async ({ projectName, dbIsSQL
|
|
11
|
+
module.exports = async ({ projectName, dbIsSQL }) => {
|
|
13
12
|
const createFoldersCommand = `mkdir ${projectName}/src/schemas`
|
|
14
13
|
|
|
15
14
|
if (platform() === 'win32')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
|
|
5
5
|
const writeFile = require('../../utils/writeFile')
|
|
6
6
|
|
|
@@ -23,7 +23,7 @@ ${projectName}/src/services/utils/messages`
|
|
|
23
23
|
file: `${projectName}/src/services/index.ts`
|
|
24
24
|
},
|
|
25
25
|
base: {
|
|
26
|
-
content: `import { Debugger } from 'debug'
|
|
26
|
+
content: `import { type Debugger } from 'debug'
|
|
27
27
|
import httpErrors, {
|
|
28
28
|
HttpErrorConstructor,
|
|
29
29
|
NamedConstructors
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
const writeFile = require('../../utils/writeFile')
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
const writeFile = require('../../utils/writeFile')
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -32,7 +32,7 @@ module.exports = async ({
|
|
|
32
32
|
file: `${projectName}/src/utils/index.ts`
|
|
33
33
|
},
|
|
34
34
|
logger: {
|
|
35
|
-
content: `import { Debugger } from 'debug'
|
|
35
|
+
content: `import { type Debugger } from 'debug'
|
|
36
36
|
|
|
37
37
|
export interface Log {
|
|
38
38
|
log({
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
const writeFile = require('../utils/writeFile')
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @param {Object} args
|
|
5
|
+
* @param {String} args.projectName
|
|
6
|
+
* @returns {Promise<void>}
|
|
7
|
+
*/
|
|
8
|
+
module.exports = async ({ projectName }) => {
|
|
9
|
+
const biomeConfig = {
|
|
10
|
+
$schema: 'https://biomejs.dev/schemas/2.4.4/schema.json',
|
|
11
|
+
vcs: {
|
|
12
|
+
enabled: false,
|
|
13
|
+
clientKind: 'git',
|
|
14
|
+
useIgnoreFile: false
|
|
15
|
+
},
|
|
16
|
+
files: {
|
|
17
|
+
ignoreUnknown: false
|
|
18
|
+
},
|
|
19
|
+
formatter: {
|
|
20
|
+
enabled: true,
|
|
21
|
+
useEditorconfig: true,
|
|
22
|
+
formatWithErrors: false,
|
|
23
|
+
indentStyle: 'space',
|
|
24
|
+
indentWidth: 2,
|
|
25
|
+
lineEnding: 'lf',
|
|
26
|
+
lineWidth: 80,
|
|
27
|
+
attributePosition: 'auto',
|
|
28
|
+
bracketSpacing: true
|
|
29
|
+
},
|
|
30
|
+
linter: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
rules: {
|
|
33
|
+
recommended: true,
|
|
34
|
+
correctness: {
|
|
35
|
+
noUnusedVariables: 'error'
|
|
36
|
+
},
|
|
37
|
+
style: {
|
|
38
|
+
useConst: 'error',
|
|
39
|
+
useTemplate: 'error'
|
|
40
|
+
},
|
|
41
|
+
suspicious: {
|
|
42
|
+
noDebugger: 'error',
|
|
43
|
+
noDoubleEquals: 'error',
|
|
44
|
+
noExplicitAny: 'off'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
javascript: {
|
|
49
|
+
parser: {
|
|
50
|
+
unsafeParameterDecoratorsEnabled: true
|
|
51
|
+
},
|
|
52
|
+
formatter: {
|
|
53
|
+
jsxQuoteStyle: 'double',
|
|
54
|
+
quoteProperties: 'asNeeded',
|
|
55
|
+
trailingCommas: 'none',
|
|
56
|
+
semicolons: 'asNeeded',
|
|
57
|
+
arrowParentheses: 'asNeeded',
|
|
58
|
+
bracketSameLine: false,
|
|
59
|
+
bracketSpacing: true,
|
|
60
|
+
quoteStyle: 'single'
|
|
61
|
+
},
|
|
62
|
+
globals: [
|
|
63
|
+
'console',
|
|
64
|
+
'process',
|
|
65
|
+
'Buffer',
|
|
66
|
+
'__dirname',
|
|
67
|
+
'__filename',
|
|
68
|
+
'global',
|
|
69
|
+
'module',
|
|
70
|
+
'require',
|
|
71
|
+
'exports'
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// En Biome 2.1.3, los decoradores de TypeScript se configuran diferente
|
|
77
|
+
// Si necesitas decoradores para GraphQL, se pueden habilitar via tsconfig.json
|
|
78
|
+
|
|
79
|
+
// Configuración específica para Jest (equivalente al env jest: true)
|
|
80
|
+
biomeConfig.overrides = [
|
|
81
|
+
{
|
|
82
|
+
includes: [
|
|
83
|
+
'**/*.test.ts',
|
|
84
|
+
'**/*.test.js',
|
|
85
|
+
'**/*.spec.ts',
|
|
86
|
+
'**/*.spec.js'
|
|
87
|
+
],
|
|
88
|
+
javascript: {
|
|
89
|
+
globals: [
|
|
90
|
+
'describe',
|
|
91
|
+
'it',
|
|
92
|
+
'test',
|
|
93
|
+
'expect',
|
|
94
|
+
'beforeAll',
|
|
95
|
+
'afterAll',
|
|
96
|
+
'beforeEach',
|
|
97
|
+
'afterEach',
|
|
98
|
+
'jest'
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
const biomeConfigContent = JSON.stringify(biomeConfig, null, 2)
|
|
105
|
+
|
|
106
|
+
const biomeignoreContent = `# Build outputs
|
|
107
|
+
dist/
|
|
108
|
+
build/
|
|
109
|
+
|
|
110
|
+
# Dependencies
|
|
111
|
+
node_modules/
|
|
112
|
+
|
|
113
|
+
# Test coverage
|
|
114
|
+
coverage/
|
|
115
|
+
|
|
116
|
+
# Environment files
|
|
117
|
+
.env*
|
|
118
|
+
|
|
119
|
+
# Logs
|
|
120
|
+
*.log
|
|
121
|
+
|
|
122
|
+
# Database
|
|
123
|
+
prisma/migrations/
|
|
124
|
+
`
|
|
125
|
+
|
|
126
|
+
await Promise.all([
|
|
127
|
+
writeFile(`${projectName}/biome.json`, biomeConfigContent),
|
|
128
|
+
writeFile(`${projectName}/.biomeignore`, biomeignoreContent)
|
|
129
|
+
])
|
|
130
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
const writeFile = require('../utils/writeFile')
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -11,12 +11,37 @@ const writeFile = require('../utils/writeFile')
|
|
|
11
11
|
module.exports = async (projectName, manager) => {
|
|
12
12
|
const createFoldersCommand = `mkdir ${projectName}/.github \
|
|
13
13
|
${projectName}/.github/workflows`
|
|
14
|
-
const managerName = manager.split()[0]
|
|
14
|
+
const managerName = manager.split(' ')[0]
|
|
15
15
|
|
|
16
16
|
if (platform() === 'win32')
|
|
17
17
|
await exec(createFoldersCommand.replaceAll('/', '\\'))
|
|
18
18
|
else await exec(createFoldersCommand)
|
|
19
19
|
|
|
20
|
+
const installCmd =
|
|
21
|
+
managerName === 'yarn'
|
|
22
|
+
? 'yarn install --frozen-lockfile'
|
|
23
|
+
: managerName === 'pnpm'
|
|
24
|
+
? 'pnpm i --frozen-lockfile'
|
|
25
|
+
: 'npm ci'
|
|
26
|
+
|
|
27
|
+
const lockFile =
|
|
28
|
+
managerName === 'yarn'
|
|
29
|
+
? 'yarn.lock'
|
|
30
|
+
: managerName === 'pnpm'
|
|
31
|
+
? 'pnpm-lock.yaml'
|
|
32
|
+
: 'package-lock.json'
|
|
33
|
+
|
|
34
|
+
const runCmd = managerName === 'yarn' ? 'yarn' : `${managerName} run`
|
|
35
|
+
|
|
36
|
+
const pnpmSetup =
|
|
37
|
+
managerName === 'pnpm'
|
|
38
|
+
? `
|
|
39
|
+
- name: Setup pnpm
|
|
40
|
+
uses: pnpm/action-setup@v4
|
|
41
|
+
with:
|
|
42
|
+
version: 9.x.x\n`
|
|
43
|
+
: ''
|
|
44
|
+
|
|
20
45
|
const data = {
|
|
21
46
|
linting: {
|
|
22
47
|
content: `name: Lint - ${projectName}
|
|
@@ -30,38 +55,41 @@ jobs:
|
|
|
30
55
|
|
|
31
56
|
steps:
|
|
32
57
|
- name: Check out Git repository
|
|
33
|
-
uses: actions/checkout@
|
|
58
|
+
uses: actions/checkout@v4
|
|
34
59
|
with:
|
|
35
60
|
fetch-depth: 0
|
|
36
61
|
|
|
37
62
|
- name: Set up Node.js
|
|
38
|
-
uses: actions/setup-node@
|
|
39
|
-
with:
|
|
40
|
-
node-version: 18.x
|
|
41
|
-
${
|
|
42
|
-
managerName === 'pnpm'
|
|
43
|
-
? `
|
|
44
|
-
- name: Setup pnpm
|
|
45
|
-
uses: pnpm/action-setup@v2
|
|
63
|
+
uses: actions/setup-node@v4
|
|
46
64
|
with:
|
|
47
|
-
version:
|
|
48
|
-
|
|
49
|
-
}
|
|
65
|
+
node-version: 20.x
|
|
66
|
+
${pnpmSetup}
|
|
50
67
|
- name: Install Node.js dependencies
|
|
51
|
-
run: ${
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
- name:
|
|
60
|
-
|
|
68
|
+
run: ${installCmd}
|
|
69
|
+
|
|
70
|
+
- name: Revert changes into the ${lockFile} file
|
|
71
|
+
run: git checkout -- ${lockFile}
|
|
72
|
+
|
|
73
|
+
- name: Run lint
|
|
74
|
+
run: ${runCmd} lint
|
|
75
|
+
|
|
76
|
+
- name: Check for changes
|
|
77
|
+
id: verify-changed-files
|
|
78
|
+
run: |
|
|
79
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
80
|
+
echo "changed=true" >> $GITHUB_OUTPUT
|
|
81
|
+
echo "✅ Changes detected after linting, preparing to commit..."
|
|
82
|
+
else
|
|
83
|
+
echo "changed=false" >> $GITHUB_OUTPUT
|
|
84
|
+
echo "ℹ️ No changes after linting, nothing to do, skipping commit"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
- name: Commit lint fixes
|
|
88
|
+
if: steps.verify-changed-files.outputs.changed == 'true'
|
|
89
|
+
uses: stefanzweifel/git-auto-commit-action@v6
|
|
61
90
|
with:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
eslint_extensions: js\n`,
|
|
91
|
+
commit_message: 'feat: automated lint with biome'
|
|
92
|
+
file_pattern: '.'`,
|
|
65
93
|
file: `${projectName}/.github/workflows/lint.yml`
|
|
66
94
|
},
|
|
67
95
|
test: {
|
|
@@ -77,34 +105,20 @@ jobs:
|
|
|
77
105
|
|
|
78
106
|
steps:
|
|
79
107
|
- name: Check out Git repository
|
|
80
|
-
uses: actions/checkout@
|
|
108
|
+
uses: actions/checkout@v4
|
|
81
109
|
with:
|
|
82
110
|
fetch-depth: 0
|
|
83
111
|
|
|
84
112
|
- name: Set up Node.js
|
|
85
|
-
uses: actions/setup-node@
|
|
86
|
-
with:
|
|
87
|
-
node-version: 18.x
|
|
88
|
-
${
|
|
89
|
-
managerName === 'pnpm'
|
|
90
|
-
? `
|
|
91
|
-
- name: Setup pnpm
|
|
92
|
-
uses: pnpm/action-setup@v2
|
|
113
|
+
uses: actions/setup-node@v4
|
|
93
114
|
with:
|
|
94
|
-
version:
|
|
95
|
-
|
|
96
|
-
}
|
|
115
|
+
node-version: 20.x
|
|
116
|
+
${pnpmSetup}
|
|
97
117
|
- name: Install Node.js dependencies
|
|
98
|
-
run: ${
|
|
99
|
-
managerName === 'yarn'
|
|
100
|
-
? 'yarn install --frozen-lockfile'
|
|
101
|
-
: managerName
|
|
102
|
-
? 'pnpm i --frozen-lockfile'
|
|
103
|
-
: 'npm ci'
|
|
104
|
-
}
|
|
118
|
+
run: ${installCmd}
|
|
105
119
|
|
|
106
120
|
- name: Run test
|
|
107
|
-
run: ${
|
|
121
|
+
run: ${runCmd} test:ci
|
|
108
122
|
env:
|
|
109
123
|
DATABASE_URL: \${{ secrets.DATABASE_URL }}
|
|
110
124
|
NODE_ENV: ci
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
api: require('./api'),
|
|
3
|
+
biome: require('./biome'),
|
|
3
4
|
changelog: require('./changelog'),
|
|
4
5
|
docker: require('./docker'),
|
|
5
|
-
eslint: require('./eslint'),
|
|
6
6
|
ghat: require('./ghat'),
|
|
7
7
|
gitignore: require('./gitignore'),
|
|
8
8
|
licenseF: require('./license'),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const https = require('https')
|
|
1
|
+
const https = require('node:https')
|
|
2
2
|
const _ = require('underscore')
|
|
3
3
|
const writeFile = require('../utils/writeFile')
|
|
4
4
|
|
|
@@ -11,7 +11,9 @@ const getLicense = ({ author, license, year, projectDescription }) => {
|
|
|
11
11
|
https.get(`https://choosealicense.com/licenses/${license}/`, res => {
|
|
12
12
|
let result = ''
|
|
13
13
|
res.setEncoding('utf8')
|
|
14
|
-
res.on('data', chunk =>
|
|
14
|
+
res.on('data', chunk => {
|
|
15
|
+
result += chunk
|
|
16
|
+
})
|
|
15
17
|
res.on('end', () => {
|
|
16
18
|
const begin = result.indexOf('id="license-text"')
|
|
17
19
|
const end = result.indexOf('</pre>')
|
|
@@ -22,7 +22,7 @@ module.exports = async ({
|
|
|
22
22
|
"main": "${mainFile}",
|
|
23
23
|
"description": "${projectDescription}",
|
|
24
24
|
"scripts": {
|
|
25
|
-
"lint": "
|
|
25
|
+
"lint": "biome check --write src/",
|
|
26
26
|
"service": "nodemon",
|
|
27
27
|
"start": "ts-node src/index.ts",
|
|
28
28
|
"release": "standard-version",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const { platform } = require('os')
|
|
2
|
-
const { promisify } = require('util')
|
|
3
|
-
const exec = promisify(require('child_process').exec)
|
|
1
|
+
const { platform } = require('node:os')
|
|
2
|
+
const { promisify } = require('node:util')
|
|
3
|
+
const exec = promisify(require('node:child_process').exec)
|
|
4
4
|
const writeFile = require('../utils/writeFile')
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -2,10 +2,9 @@ const writeFile = require('../utils/writeFile')
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @param {String} projectName
|
|
5
|
-
* @param {Boolean} graphQL
|
|
6
5
|
* @returns {Promise<void>}
|
|
7
6
|
*/
|
|
8
|
-
module.exports = async
|
|
7
|
+
module.exports = async projectName => {
|
|
9
8
|
const data = {
|
|
10
9
|
base: {
|
|
11
10
|
content: `{
|
|
@@ -18,13 +17,9 @@ module.exports = async (projectName, graphQL) => {
|
|
|
18
17
|
|
|
19
18
|
/* Basic Options */
|
|
20
19
|
// "incremental": true, /* Enable incremental compilation */
|
|
21
|
-
"target": "
|
|
22
|
-
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
|
|
23
|
-
|
|
24
|
-
graphQL
|
|
25
|
-
? '"lib": ["es2018", "esnext.asynciterable"],/* Specify library files to be included in the compilation. */'
|
|
26
|
-
: '// "lib": [], /* Specify library files to be included in the compilation. */'
|
|
27
|
-
}
|
|
20
|
+
"target": "ES2022" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2022', or 'ESNEXT'. */,
|
|
21
|
+
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', 'ES2022', or 'ESNext'. */,
|
|
22
|
+
"lib": ["es2022", "esnext.asynciterable"], /* Specify library files to be included in the compilation. */
|
|
28
23
|
"allowJs": true /* Allow javascript files to be compiled. */,
|
|
29
24
|
// "checkJs": true, /* Report errors in .js files. */
|
|
30
25
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
@@ -44,27 +39,27 @@ module.exports = async (projectName, graphQL) => {
|
|
|
44
39
|
/* Strict Type-Checking Options */
|
|
45
40
|
"strict": true /* Enable all strict type-checking options. */,
|
|
46
41
|
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
"strictNullChecks": true, /* Enable strict null checks. */
|
|
43
|
+
"strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
44
|
+
"strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
|
45
|
+
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
46
|
+
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
47
|
+
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
53
48
|
|
|
54
49
|
/* Additional Checks */
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
50
|
+
"noUnusedLocals": true, /* Report errors on unused locals. */
|
|
51
|
+
"noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
52
|
+
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
53
|
+
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
59
54
|
|
|
60
55
|
/* Module Resolution Options */
|
|
61
|
-
"moduleResolution": "node" /* Specify module resolution strategy: 'node'
|
|
56
|
+
"moduleResolution": "node" /* Specify module resolution strategy: 'node', 'classic', or 'bundler' (modern). */,
|
|
62
57
|
"baseUrl": "src", /* Base directory to resolve non-absolute module names. */
|
|
63
58
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
64
59
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
65
60
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
66
61
|
// "types": [], /* Type declaration files to be included in compilation. */
|
|
67
|
-
|
|
62
|
+
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
68
63
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
|
69
64
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
70
65
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
package/lib/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const cliProgress = require('cli-progress')
|
|
2
2
|
const colors = require('colors')
|
|
3
|
-
const util = require('util')
|
|
4
|
-
const exec = util.promisify(require('child_process').exec)
|
|
3
|
+
const util = require('node:util')
|
|
4
|
+
const exec = util.promisify(require('node:child_process').exec)
|
|
5
5
|
|
|
6
6
|
const {
|
|
7
7
|
packageJson,
|
|
@@ -10,7 +10,7 @@ const {
|
|
|
10
10
|
licenseF,
|
|
11
11
|
gitignore,
|
|
12
12
|
tsconfig,
|
|
13
|
-
|
|
13
|
+
biome,
|
|
14
14
|
docker,
|
|
15
15
|
api,
|
|
16
16
|
testsF,
|
|
@@ -62,9 +62,9 @@ module.exports = async ({
|
|
|
62
62
|
const fastifyProdPackages = `fastify @fastify/swagger @fastify/swagger-ui @fastify/cors fastify-type-provider-zod ${
|
|
63
63
|
graphql ? '@as-integrations/fastify' : ''
|
|
64
64
|
}`
|
|
65
|
-
let prodPackages = `${manager} debug zod http-errors @prisma/client ${
|
|
65
|
+
let prodPackages = `${manager} debug zod http-errors @prisma/client@6 ${
|
|
66
66
|
graphql
|
|
67
|
-
?
|
|
67
|
+
? `@apollo/server ${!fastify ? '@as-integrations/express5' : ''} class-validator graphql graphql-scalars reflect-metadata type-graphql@2.0.0-rc.3`
|
|
68
68
|
: ''
|
|
69
69
|
} ${fastify ? fastifyProdPackages : expressProdPackages}`
|
|
70
70
|
|
|
@@ -91,21 +91,12 @@ module.exports = async ({
|
|
|
91
91
|
throw new Error('Database not supported')
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
let devPackages = `${manager} -D prisma @types/debug @types/http-errors \
|
|
94
|
+
let devPackages = `${manager} -D prisma@6 @types/debug @types/http-errors \
|
|
95
95
|
@types/node \
|
|
96
|
-
@
|
|
97
|
-
@typescript-eslint/parser \
|
|
96
|
+
@biomejs/biome \
|
|
98
97
|
axios \
|
|
99
98
|
dotenv \
|
|
100
|
-
eslint@^8 \
|
|
101
|
-
eslint-config-prettier@^8 \
|
|
102
|
-
eslint-config-standard \
|
|
103
|
-
eslint-plugin-import \
|
|
104
|
-
eslint-plugin-node \
|
|
105
|
-
eslint-plugin-prettier \
|
|
106
|
-
eslint-plugin-promise \
|
|
107
99
|
nodemon \
|
|
108
|
-
prettier \
|
|
109
100
|
standard-version \
|
|
110
101
|
ts-loader \
|
|
111
102
|
ts-node \
|
|
@@ -118,9 +109,9 @@ typescript`
|
|
|
118
109
|
|
|
119
110
|
devPackages += ` ${
|
|
120
111
|
fastify ? fastifyDevPackages : expressDevPackages
|
|
121
|
-
} @jest/types @types/jest
|
|
112
|
+
} @jest/types @types/jest jest jest-unit ts-jest`
|
|
122
113
|
|
|
123
|
-
|
|
114
|
+
// Biome no necesita plugins adicionales de Jest como ESLint
|
|
124
115
|
|
|
125
116
|
bar.start(process, i)
|
|
126
117
|
|
|
@@ -141,8 +132,8 @@ typescript`
|
|
|
141
132
|
readme(projectName, projectDescription),
|
|
142
133
|
changelog(projectName),
|
|
143
134
|
gitignore(projectName),
|
|
144
|
-
tsconfig(projectName
|
|
145
|
-
|
|
135
|
+
tsconfig(projectName),
|
|
136
|
+
biome({ projectName }),
|
|
146
137
|
docker({ projectName, manager }),
|
|
147
138
|
api({ projectName, version, email, fastify, graphql, database }),
|
|
148
139
|
testsF({ projectName, graphql, dbIsSQL }),
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthonylzq/simba.js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "set up a modern backend app by running one command",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"service": "node ./bin",
|
|
8
8
|
"service:q": "node ./bin -q",
|
|
9
9
|
"help": "node ./bin -h",
|
|
10
|
-
"lint": "
|
|
10
|
+
"lint": "biome check --write lib/",
|
|
11
|
+
"lint:ci": "biome check lib/",
|
|
11
12
|
"db:create": "node ./scripts/db/sql/create.mjs && node ./scripts/db/mongo/create.mjs",
|
|
12
13
|
"db:create:mongo": "node ./scripts/db/mongo/create.mjs",
|
|
13
14
|
"db:create:sql": "node ./scripts/db/sql/create.mjs",
|
|
@@ -108,24 +109,17 @@
|
|
|
108
109
|
"cli-progress": "3.12.0",
|
|
109
110
|
"colors": "1.4.0",
|
|
110
111
|
"prompts": "2.4.2",
|
|
111
|
-
"underscore": "1.13.
|
|
112
|
+
"underscore": "1.13.8",
|
|
112
113
|
"yargs": "17.7.2"
|
|
113
114
|
},
|
|
114
115
|
"devDependencies": {
|
|
115
|
-
"@
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"eslint-config-standard": "17.1.0",
|
|
120
|
-
"eslint-plugin-import": "2.29.1",
|
|
121
|
-
"eslint-plugin-node": "11.1.0",
|
|
122
|
-
"eslint-plugin-prettier": "5.2.1",
|
|
123
|
-
"eslint-plugin-promise": "^6",
|
|
124
|
-
"jest": "29.7.0",
|
|
116
|
+
"@biomejs/biome": "^2.4.4",
|
|
117
|
+
"@types/jest": "30.0.0",
|
|
118
|
+
"dotenv": "17.3.1",
|
|
119
|
+
"jest": "30.2.0",
|
|
125
120
|
"knex": "3.1.0",
|
|
126
|
-
"mongodb": "
|
|
127
|
-
"pg": "8.
|
|
128
|
-
"prettier": "3.3.3",
|
|
121
|
+
"mongodb": "7.1.0",
|
|
122
|
+
"pg": "8.18.0",
|
|
129
123
|
"standard-version": "9.5.0"
|
|
130
124
|
},
|
|
131
125
|
"repository": {
|
|
@@ -149,6 +143,6 @@
|
|
|
149
143
|
},
|
|
150
144
|
"engines": {
|
|
151
145
|
"npm": ">=8.0.0",
|
|
152
|
-
"node": ">=
|
|
146
|
+
"node": ">=20.0.0"
|
|
153
147
|
}
|
|
154
148
|
}
|