@anthonylzq/simba.js 4.2.0 → 4.3.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.
@@ -1387,10 +1387,11 @@ export { applyRoutes }
1387
1387
  file: `${projectName}/src/network/router.ts`
1388
1388
  },
1389
1389
  server: {
1390
- content: `import Fastify, { FastifyInstance } from 'fastify'
1390
+ content: `import fastify, { FastifyInstance } from 'fastify'
1391
1391
  import mongoose from 'mongoose'
1392
1392
 
1393
1393
  import { applyRoutes } from './router'
1394
+ import { validatorCompiler } from './utils'
1394
1395
 
1395
1396
  const PORT = process.env.PORT ?? '1996'
1396
1397
 
@@ -1399,7 +1400,7 @@ class Server {
1399
1400
  #connection: mongoose.Connection | undefined
1400
1401
 
1401
1402
  constructor() {
1402
- this.#app = Fastify({ logger: true })
1403
+ this.#app = fastify({ logger: { prettyPrint: true } })
1403
1404
  this.#config()
1404
1405
  }
1405
1406
 
@@ -1414,6 +1415,7 @@ class Server {
1414
1415
  )
1415
1416
  done()
1416
1417
  })
1418
+ this.#app.setValidatorCompiler(validatorCompiler)
1417
1419
  applyRoutes(this.#app)
1418
1420
  }
1419
1421
 
@@ -1549,7 +1551,6 @@ import {
1549
1551
  StoreUser
1550
1552
  } from 'schemas'
1551
1553
  import { UserService } from 'services'
1552
- import { validatorCompiler } from './utils'
1553
1554
 
1554
1555
  const User = (app: FastifyInstance, prefix = '/api'): void => {
1555
1556
  app
@@ -1567,8 +1568,7 @@ const User = (app: FastifyInstance, prefix = '/api'): void => {
1567
1568
  }
1568
1569
  },
1569
1570
  tags: ['user']
1570
- },
1571
- validatorCompiler
1571
+ }
1572
1572
  },
1573
1573
  async (request, reply) => {
1574
1574
  const {
@@ -1659,8 +1659,7 @@ const User = (app: FastifyInstance, prefix = '/api'): void => {
1659
1659
  }
1660
1660
  },
1661
1661
  tags: ['user']
1662
- },
1663
- validatorCompiler
1662
+ }
1664
1663
  },
1665
1664
  async (request, reply) => {
1666
1665
  const {
@@ -1754,7 +1753,7 @@ export { User }
1754
1753
  file: `${projectName}/src/network/routes/user.ts`
1755
1754
  }
1756
1755
  },
1757
- 'network/routes/utils': {
1756
+ 'network/utils': {
1758
1757
  index: {
1759
1758
  content: `/* eslint-disable @typescript-eslint/no-explicit-any */
1760
1759
  import {
@@ -1792,13 +1791,16 @@ const validatorCompiler = ({
1792
1791
 
1793
1792
  export { validatorCompiler }
1794
1793
  `,
1795
- file: `${projectName}/src/network/routes/utils/index.ts`
1794
+ file: `${projectName}/src/network/utils/index.ts`
1796
1795
  }
1797
1796
  }
1798
1797
  }
1799
1798
 
1800
1799
  const expressFolders = `${projectName}/src/utils \
1801
- ${projectName}/src/@types/custom`
1800
+ ${projectName}/src/@types/custom \
1801
+ ${projectName}/src/network/routes/utils`
1802
+
1803
+ const fastifyFolders = `${projectName}/src/network/utils`
1802
1804
 
1803
1805
  const createFoldersCommands = `mkdir ${projectName}/src \
1804
1806
  ${projectName}/src/@types \
@@ -1809,12 +1811,11 @@ ${projectName}/src/database/mongo/models \
1809
1811
  ${projectName}/src/database/mongo/queries \
1810
1812
  ${projectName}/src/network \
1811
1813
  ${projectName}/src/network/routes \
1812
- ${projectName}/src/network/routes/utils \
1813
1814
  ${projectName}/src/schemas \
1814
1815
  ${projectName}/src/services \
1815
1816
  ${projectName}/src/services/utils \
1816
1817
  ${projectName}/src/services/utils/messages \
1817
- ${fastify ? '' : `${expressFolders}`}
1818
+ ${fastify ? `${fastifyFolders}` : `${expressFolders}`}
1818
1819
  `
1819
1820
 
1820
1821
  if (os.platform() === 'win32')
@@ -1924,8 +1925,8 @@ ${fastify ? '' : `${expressFolders}`}
1924
1925
 
1925
1926
  // /network/routes/utils
1926
1927
  await writeFile(
1927
- fastifyData['network/routes/utils'].index.file,
1928
- fastifyData['network/routes/utils'].index.content
1928
+ fastifyData['network/utils'].index.file,
1929
+ fastifyData['network/utils'].index.content
1929
1930
  )
1930
1931
  } else {
1931
1932
  // /@types/custom
package/lib/src/index.js CHANGED
@@ -58,7 +58,7 @@ module.exports = async ({
58
58
  )
59
59
 
60
60
  const expressProdPackages = 'express morgan swagger-ui-express cors'
61
- const fastifyProdPackages = 'fastify fastify-swagger fastify-cors'
61
+ const fastifyProdPackages = 'fastify fastify-swagger fastify-cors pino-pretty'
62
62
  const prodPackages = `${manager} http-errors mongoose @sinclair/typebox ajv@^6 ${
63
63
  fastify ? fastifyProdPackages : expressProdPackages
64
64
  }`
@@ -12,5 +12,5 @@ module.exports = projectName => {
12
12
  if (index !== array.length - 1) title += ' '
13
13
  })
14
14
 
15
- return title
15
+ return title.trim()
16
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthonylzq/simba.js",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "set up a modern backend app by running one command",
5
5
  "main": "lib/index.js",
6
6
  "directories": {
@@ -41,16 +41,18 @@
41
41
  "colors": "^1.4.0",
42
42
  "readline-sync": "^1.4.10",
43
43
  "underscore": "^1.13.2",
44
- "yargs": "^17.3.1"
44
+ "yargs": "^17.4.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "dotenv": "^16.0.0",
48
- "eslint": "^8.10.0",
48
+ "eslint": "^8.13.0",
49
49
  "eslint-config-prettier": "^8.5.0",
50
50
  "eslint-config-standard": "^16.0.3",
51
- "eslint-plugin-import": "^2.25.4",
51
+ "eslint-plugin-import": "^2.26.0",
52
52
  "eslint-plugin-node": "^11.1.0",
53
53
  "eslint-plugin-prettier": "^4.0.0",
54
+ "eslint-plugin-promise": "^6.0.0",
55
+ "prettier": "^2.6.2",
54
56
  "standard-version": "^9.3.2"
55
57
  },
56
58
  "repository": {