@anthonylzq/simba.js 7.0.2 → 7.2.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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <h1 align="center">
2
2
  <!-- <p align="center">Simba.js</p> -->
3
- <a href="https://simbajs.notion.site/783092dc7d444067b4c56a25d671f658?v=31060f3d17524ca58870e86c2960a6df"><img src="https://i.ibb.co/QFX0WnH/simba-pink.png" alt="Simba.js"></a>
3
+ <a href="./static/simba.png"><img src="https://i.ibb.co/QFX0WnH/simba-pink.png" alt="Simba.js"></a>
4
4
  </h1>
5
5
 
6
6
 
@@ -155,9 +155,9 @@ Also, if you are interested in the folder structure of each case, please take a
155
155
  - [Express-GraphQL-Sequelize case](./projectStructureExamples/express-GraphQL-sequelize.txt)
156
156
  - [Express-Sequelize case](./projectStructureExamples/express-sequelize.txt)
157
157
  - [Fastify case](./projectStructureExamples/fastify.txt)
158
- - [Fastify-GraphQL case](./../projectStructureExamples/fastify-graphql.txt)
159
- - [Fastify-GraphQL-Sequelize case](./../projectStructureExamples/fastify-sequelize-graphql.txt)
160
- - [Fastify-Sequelize case](./../projectStructureExamples/fastify-sequelize-graphql.txt)
158
+ - [Fastify-GraphQL case](./projectStructureExamples/fastify-graphql.txt)
159
+ - [Fastify-GraphQL-Sequelize case](./projectStructureExamples/fastify-graphql-sequelize.txt)
160
+ - [Fastify-Sequelize case](./projectStructureExamples/fastify-sequelize.txt)
161
161
 
162
162
  ### Some considerations
163
163
 
@@ -124,7 +124,7 @@ import { HttpLogger } from 'express-pino-logger'
124
124
 
125
125
  const ENVIRONMENTS_WITHOUT_RECONNECTION = ['ci', 'local']
126
126
  const dbConnection = async (
127
- logger: HttpLogger['logger']
127
+ logger?: HttpLogger['logger']
128
128
  ): Promise<{
129
129
  connect: () => Promise<typeof import('mongoose')>
130
130
  disconnect: () => Promise<void>
@@ -136,10 +136,10 @@ const dbConnection = async (
136
136
  }
137
137
 
138
138
  connection.on('connected', () => {
139
- logger.info('Mongo connection established.')
139
+ logger?.info('Mongo connection established.')
140
140
  })
141
141
  connection.on('reconnected', () => {
142
- logger.info('Mongo connection reestablished')
142
+ logger?.info('Mongo connection reestablished')
143
143
  })
144
144
  connection.on('disconnected', () => {
145
145
  if (
@@ -147,7 +147,7 @@ const dbConnection = async (
147
147
  process.env.NODE_ENV as string
148
148
  )
149
149
  ) {
150
- logger.info(
150
+ logger?.info(
151
151
  'Mongo connection disconnected. Trying to reconnected to Mongo...'
152
152
  )
153
153
  setTimeout(() => {
@@ -160,11 +160,11 @@ const dbConnection = async (
160
160
  }
161
161
  })
162
162
  connection.on('close', () => {
163
- logger.info('Mongo connection closed')
163
+ logger?.info('Mongo connection closed')
164
164
  })
165
165
  connection.on('error', (e: Error) => {
166
- logger.info('Mongo connection error:')
167
- logger.error(e)
166
+ logger?.info('Mongo connection error:')
167
+ logger?.error(e)
168
168
  })
169
169
 
170
170
  return {
@@ -91,7 +91,7 @@ import { FastifyLoggerInstance } from 'fastify'
91
91
 
92
92
  const ENVIRONMENTS_WITHOUT_RECONNECTION = ['ci', 'local']
93
93
  const dbConnection = async (
94
- logger: FastifyLoggerInstance
94
+ logger?: FastifyLoggerInstance
95
95
  ): Promise<{
96
96
  connect: () => Promise<typeof import('mongoose')>
97
97
  disconnect: () => Promise<void>
@@ -103,10 +103,10 @@ const dbConnection = async (
103
103
  }
104
104
 
105
105
  connection.on('connected', () => {
106
- logger.info('Mongo connection established.')
106
+ logger?.info('Mongo connection established.')
107
107
  })
108
108
  connection.on('reconnected', () => {
109
- logger.info('Mongo connection reestablished')
109
+ logger?.info('Mongo connection reestablished')
110
110
  })
111
111
  connection.on('disconnected', () => {
112
112
  if (
@@ -114,7 +114,7 @@ const dbConnection = async (
114
114
  process.env.NODE_ENV as string
115
115
  )
116
116
  ) {
117
- logger.info(
117
+ logger?.info(
118
118
  'Mongo connection disconnected. Trying to reconnected to Mongo...'
119
119
  )
120
120
  setTimeout(() => {
@@ -127,11 +127,11 @@ const dbConnection = async (
127
127
  }
128
128
  })
129
129
  connection.on('close', () => {
130
- logger.info('Mongo connection closed')
130
+ logger?.info('Mongo connection closed')
131
131
  })
132
132
  connection.on('error', (e: Error) => {
133
- logger.info('Mongo connection error:')
134
- logger.error(e)
133
+ logger?.info('Mongo connection error:')
134
+ logger?.error(e)
135
135
  })
136
136
 
137
137
  return {
@@ -336,7 +336,7 @@ import * as models from './models'
336
336
  let sequelize: Sequelize
337
337
 
338
338
  const dbConnection = async (
339
- logger: FastifyLoggerInstance
339
+ logger?: FastifyLoggerInstance
340
340
  ): Promise<{
341
341
  connect: () => Promise<Sequelize>
342
342
  disconnect: () => Promise<void>
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ api: require('./api'),
3
+ changelog: require('./changelog'),
4
+ docker: require('./docker'),
5
+ eslint: require('./eslint'),
6
+ ghat: require('./ghat'),
7
+ gitignore: require('./gitignore'),
8
+ herokuF: require('./heroku'),
9
+ licenseF: require('./license'),
10
+ packageJson: require('./packageJson'),
11
+ readme: require('./readme'),
12
+ testsF: require('./tests'),
13
+ tsconfig: require('./tsconfig'),
14
+ ghatF: require('./ghat'),
15
+ webpack: require('./webpack')
16
+ }
@@ -47,7 +47,18 @@ module.exports = async ({
47
47
  : ''
48
48
  }
49
49
  "dependencies": {},
50
- "devDependencies": {}
50
+ "devDependencies": {},
51
+ "nodemonConfig": {
52
+ "watch": [
53
+ ".env",
54
+ "src"
55
+ ],
56
+ "ext": "ts",
57
+ "ignore": [
58
+ "src/**/*.test.ts"
59
+ ],
60
+ "exec": "npx ts-node -r dotenv/config ./src/index"
61
+ }
51
62
  }
52
63
  `
53
64
  await writeFile(`${projectName}/${data.file}`, data.content)
package/lib/src/index.js CHANGED
@@ -3,20 +3,21 @@ const colors = require('colors')
3
3
  const util = require('util')
4
4
  const exec = util.promisify(require('child_process').exec)
5
5
 
6
- const packageJson = require('./functions/packageJson')
7
- const readme = require('./functions/readme')
8
- const changelog = require('./functions/changelog')
9
- const licenseF = require('./functions/license')
10
- const gitignore = require('./functions/gitignore')
11
- const tsconfig = require('./functions/tsconfig')
12
- const nodemon = require('./functions/nodemon')
13
- const eslint = require('./functions/eslint')
14
- const webpack = require('./functions/webpack')
15
- const docker = require('./functions/docker')
16
- const herokuF = require('./functions/heroku')
17
- const api = require('./functions/api')
18
- const testsF = require('./functions/tests')
19
- const ghatF = require('./functions/ghat')
6
+ const {
7
+ packageJson,
8
+ readme,
9
+ changelog,
10
+ licenseF,
11
+ gitignore,
12
+ tsconfig,
13
+ eslint,
14
+ webpack,
15
+ docker,
16
+ herokuF,
17
+ api,
18
+ testsF,
19
+ ghatF
20
+ } = require('./functions')
20
21
 
21
22
  /**
22
23
  * @param {Number} process number of process
@@ -159,7 +160,6 @@ webpack-node-externals`
159
160
  changelog(projectName),
160
161
  gitignore(projectName),
161
162
  tsconfig(projectName, dbIsSQL),
162
- nodemon(projectName),
163
163
  eslint({ projectName, tests, dbIsSQL }),
164
164
  webpack(projectName),
165
165
  docker(projectName),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthonylzq/simba.js",
3
- "version": "7.0.2",
3
+ "version": "7.2.0",
4
4
  "description": "set up a modern backend app by running one command",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -101,18 +101,18 @@
101
101
  "cli-progress": "^3.11.2",
102
102
  "colors": "^1.4.0",
103
103
  "readline-sync": "^1.4.10",
104
- "underscore": "^1.13.4",
105
- "yargs": "^17.5.1"
104
+ "underscore": "^1.13.6",
105
+ "yargs": "^17.6.0"
106
106
  },
107
107
  "devDependencies": {
108
- "dotenv": "^16.0.2",
109
- "eslint": "^8.23.0",
108
+ "dotenv": "^16.0.3",
109
+ "eslint": "^8.26.0",
110
110
  "eslint-config-prettier": "^8.5.0",
111
111
  "eslint-config-standard": "^17.0.0",
112
112
  "eslint-plugin-import": "^2.26.0",
113
113
  "eslint-plugin-node": "^11.1.0",
114
114
  "eslint-plugin-prettier": "^4.2.1",
115
- "eslint-plugin-promise": "^6.0.1",
115
+ "eslint-plugin-promise": "^6.1.1",
116
116
  "prettier": "^2.7.1",
117
117
  "standard-version": "^9.5.0"
118
118
  },
@@ -1,25 +0,0 @@
1
- const writeFile = require('../utils/writeFile')
2
-
3
- /**
4
- * @param {String} projectName
5
- * @returns {Promise<void>}
6
- */
7
- module.exports = async projectName => {
8
- const data = {
9
- nodemonContent: `{
10
- "watch": [
11
- ".env",
12
- "src"
13
- ],
14
- "ext": "ts",
15
- "ignore": [
16
- "src/**/*.test.ts"
17
- ],
18
- "exec": "npx ts-node -r dotenv/config ./src/index"
19
- }
20
- `,
21
- nodemonFile: 'nodemon.json'
22
- }
23
-
24
- await writeFile(`${projectName}/${data.nodemonFile}`, data.nodemonContent)
25
- }