@anthonylzq/simba.js 7.2.0 → 8.0.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.
@@ -2,10 +2,10 @@ const writeFile = require('../utils/writeFile')
2
2
 
3
3
  /**
4
4
  * @param {String} projectName
5
- * @param {Boolean} dbIsSQL
5
+ * @param {Boolean} graphQL
6
6
  * @returns {Promise<void>}
7
7
  */
8
- module.exports = async (projectName, dbIsSQL) => {
8
+ module.exports = async (projectName, graphQL) => {
9
9
  const data = {
10
10
  base: {
11
11
  content: `{
@@ -20,7 +20,11 @@ module.exports = async (projectName, dbIsSQL) => {
20
20
  // "incremental": true, /* Enable incremental compilation */
21
21
  "target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
22
22
  "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
23
- // "lib": [], /* Specify library files to be included in the compilation. */
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
+ }
24
28
  "allowJs": true /* Allow javascript files to be compiled. */,
25
29
  // "checkJs": true, /* Report errors in .js files. */
26
30
  // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
@@ -74,12 +78,8 @@ module.exports = async (projectName, dbIsSQL) => {
74
78
  // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
75
79
 
76
80
  /* Experimental Options */
77
- ${
78
- dbIsSQL
79
- ? ' "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */'
80
- : ' // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */'
81
- }
82
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
81
+ "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
82
+ "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
83
83
 
84
84
  /* Advanced Options */
85
85
  "skipLibCheck": true /* Skip type checking of declaration files. */,
package/lib/src/index.js CHANGED
@@ -11,9 +11,7 @@ const {
11
11
  gitignore,
12
12
  tsconfig,
13
13
  eslint,
14
- webpack,
15
14
  docker,
16
- herokuF,
17
15
  api,
18
16
  testsF,
19
17
  ghatF
@@ -43,7 +41,6 @@ module.exports = async ({
43
41
  email,
44
42
  projectName,
45
43
  projectDescription,
46
- heroku,
47
44
  license,
48
45
  version,
49
46
  licenseYear,
@@ -51,62 +48,50 @@ module.exports = async ({
51
48
  mainFile,
52
49
  fastify,
53
50
  graphql,
54
- tests,
55
51
  ghat,
56
52
  database
57
53
  }) => {
58
- const process = 4
54
+ const process = 5
59
55
  let i = 0
60
56
  const options = setOptions(process)
61
57
  const bar = new cliProgress.SingleBar(
62
58
  options,
63
59
  cliProgress.Presets.shades_classic
64
60
  )
65
- const expressProdPackages = `express swagger-ui-express cors express-pino-logger ${
66
- graphql ? 'apollo-server-express' : ''
61
+ const expressProdPackages = 'express swagger-ui-express cors'
62
+ const fastifyProdPackages = `fastify @fastify/swagger @fastify/swagger-ui @fastify/cors fastify-type-provider-zod ${
63
+ graphql ? '@as-integrations/fastify' : ''
67
64
  }`
68
- const fastifyProdPackages = `fastify@^3 @fastify/swagger@^6 @fastify/cors@^7 ${
69
- graphql ? 'apollo-server-fastify apollo-server-plugin-base' : ''
70
- }`
71
- let prodPackages = `${manager} @sinclair/typebox http-errors pino-pretty ${
65
+ let prodPackages = `${manager} debug zod http-errors @prisma/client ${
72
66
  graphql
73
- ? '@graphql-tools/schema ajv ajv-formats apollo-server-core graphql'
74
- : 'ajv@^6'
67
+ ? '@apollo/server class-validator graphql reflect-metadata type-graphql@2.0.0-beta.1'
68
+ : ''
75
69
  } ${fastify ? fastifyProdPackages : expressProdPackages}`
76
70
 
77
71
  switch (database) {
78
72
  case 'mongo':
79
- prodPackages += ' mongoose'
73
+ prodPackages += ' mongodb '
80
74
  break
81
75
  case 'postgres':
82
- prodPackages +=
83
- ' sequelize sequelize-typescript sequelize-typescript-migration-lts pg pg-hstore'
76
+ prodPackages += ' pg pg-hstore '
84
77
  break
85
78
  case 'mysql':
86
- prodPackages +=
87
- ' sequelize sequelize-typescript sequelize-typescript-migration-lts mysql2'
79
+ prodPackages += ' mysql2 '
88
80
  break
89
81
  case 'mariadb':
90
- prodPackages +=
91
- ' sequelize sequelize-typescript sequelize-typescript-migration-lts mariadb'
82
+ prodPackages += ' mariadb '
92
83
  break
93
84
  case 'sqlite':
94
- prodPackages +=
95
- ' sequelize sequelize-typescript sequelize-typescript-migration-lts sqlite3'
85
+ prodPackages += ' sqlite3 '
96
86
  break
97
87
  case 'sqlServer':
98
- prodPackages +=
99
- ' sequelize sequelize-typescript sequelize-typescript-migration-lts tedious'
88
+ prodPackages += ' tedious '
100
89
  break
101
90
  default:
102
- throw new Error('Wrong database')
91
+ throw new Error('Database not supported')
103
92
  }
104
93
 
105
- const expressDevPackages =
106
- '@types/express @types/swagger-ui-express @types/cors @types/express-pino-logger'
107
- const fastifyDevPackages = ''
108
- let devPackages = `${manager} -D \
109
- @types/http-errors \
94
+ let devPackages = `${manager} -D prisma @types/debug @types/http-errors \
110
95
  @types/node \
111
96
  @typescript-eslint/eslint-plugin \
112
97
  @typescript-eslint/parser \
@@ -125,17 +110,15 @@ standard-version \
125
110
  ts-loader \
126
111
  ts-node \
127
112
  tsconfig-paths \
128
- tsconfig-paths-webpack-plugin \
129
- typescript \
130
- webpack \
131
- webpack-cli \
132
- webpack-node-externals`
113
+ typescript`
133
114
 
134
- devPackages += ` ${fastify ? fastifyDevPackages : expressDevPackages}`
115
+ const expressDevPackages =
116
+ '@types/express @types/swagger-ui-express @types/cors'
117
+ const fastifyDevPackages = ''
135
118
 
136
- if (tests)
137
- devPackages +=
138
- ' @jest/types @types/jest eslint-plugin-jest jest jest-unit ts-jest'
119
+ devPackages += ` ${
120
+ fastify ? fastifyDevPackages : expressDevPackages
121
+ } @jest/types @types/jest eslint-plugin-jest jest jest-unit ts-jest`
139
122
 
140
123
  if (manager === 'yarn add') devPackages += ' eslint-plugin-n'
141
124
 
@@ -153,17 +136,16 @@ webpack-node-externals`
153
136
  projectDescription,
154
137
  projectVersion: version,
155
138
  license,
156
- mainFile,
157
- tests
139
+ mainFile
158
140
  }),
159
141
  readme(projectName, projectDescription),
160
142
  changelog(projectName),
161
143
  gitignore(projectName),
162
- tsconfig(projectName, dbIsSQL),
163
- eslint({ projectName, tests, dbIsSQL }),
164
- webpack(projectName),
165
- docker(projectName),
144
+ tsconfig(projectName, graphql),
145
+ eslint({ projectName, dbIsSQL }),
146
+ docker({ projectName, manager }),
166
147
  api({ projectName, version, email, fastify, graphql, database }),
148
+ testsF({ projectName, graphql, dbIsSQL }),
167
149
  exec('git init', { cwd: `./${projectName}` })
168
150
  ]
169
151
 
@@ -178,10 +160,6 @@ webpack-node-externals`
178
160
  })
179
161
  )
180
162
 
181
- if (heroku) functions.push(herokuF(projectName))
182
-
183
- if (tests) functions.push(testsF({ projectName, graphql, dbIsSQL }))
184
-
185
163
  if (ghat) functions.push(ghatF(projectName, manager))
186
164
 
187
165
  await Promise.all(functions)
@@ -193,9 +171,12 @@ webpack-node-externals`
193
171
  await exec(devPackages, { cwd: `./${projectName}` })
194
172
  bar.update(++i)
195
173
 
174
+ await exec('npx prisma generate', { cwd: projectName })
175
+ bar.update(++i)
176
+
196
177
  bar.stop()
197
178
  } catch (e) {
198
- console.error('error', e)
179
+ console.error('\nerror', e)
199
180
  }
200
181
  }
201
182
 
@@ -1,3 +1,38 @@
1
1
  const ENVIRONMENTS_WITH_DB_URI = ['ci', 'local']
2
+ const PACKAGE_MANAGERS = ['npm', 'yarn', 'pnpm']
3
+ const ONE_CHARACTER_REGEX = /^\w/
4
+ const UNLICENSED = 'unlicensed'
5
+ const LICENSES = {
6
+ mit: 'MIT',
7
+ apache: 'Apache 2.0',
8
+ mpl: 'MPL 2.0',
9
+ lgpl: 'LGPL 3.0',
10
+ gpl: 'GPL 3.0',
11
+ agpl: 'AGPL 3.0'
12
+ }
13
+ const DATABASES = {
14
+ mongo: 'MongoDB',
15
+ postgres: 'PostgreSQL',
16
+ mysql: 'MySQL',
17
+ mariadb: 'MariaDB',
18
+ sqlite: 'Sqlite',
19
+ sqlServer: 'Microsoft SQL Server'
20
+ }
21
+ const YEAR_REGEX = /^\d{4}$/
22
+ const EMAIL_REGEX =
23
+ /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i
24
+ const PROJECT_VERSION = '0.1.0'
25
+ const MAIN_FILE = 'src/index.ts'
2
26
 
3
- module.exports = { ENVIRONMENTS_WITH_DB_URI }
27
+ module.exports = {
28
+ ENVIRONMENTS_WITH_DB_URI,
29
+ PACKAGE_MANAGERS,
30
+ ONE_CHARACTER_REGEX,
31
+ UNLICENSED,
32
+ LICENSES,
33
+ DATABASES,
34
+ YEAR_REGEX,
35
+ EMAIL_REGEX,
36
+ PROJECT_VERSION,
37
+ MAIN_FILE
38
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ constants: require('./constants'),
3
+ titleCase: require('./titleCase'),
4
+ writeFile: require('./writeFile')
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthonylzq/simba.js",
3
- "version": "7.2.0",
3
+ "version": "8.0.0",
4
4
  "description": "set up a modern backend app by running one command",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -11,74 +11,74 @@
11
11
  "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",
12
12
  "build": "npm run build:express:all && npm run build:fastify:all",
13
13
  "build:mongo": "npm run rm:mongo && npm run build:express && npm run build:fastify && npm run build:express:graphql && npm run build:fastify:graphql",
14
- "build:postgresql": "npm run rm:postgresql && npm run build:express:sequelize && npm run build:fastify:sequelize && npm run build:express:graphql:sequelize && npm run build:fastify:graphql:sequelize",
15
- "build:rest": "npm run build:express && npm run build:fastify && npm run build:express:sequelize && npm run build:fastify:sequelize",
16
- "build:graphql": "npm run build:express:graphql && npm run build:fastify:graphql && npm run build:express:graphql:sequelize && npm run build:fastify:graphql:sequelize",
17
- "build:express:all": "npm run build:express && npm run build:express:graphql && npm run build:express:sequelize && npm run build:express:graphql:sequelize",
18
- "build:fastify:all": "npm run build:fastify && npm run build:fastify:graphql && npm run build:fastify:sequelize && npm run build:fastify:graphql:sequelize",
19
- "build:express": "npm run rm:express && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express -D 'This is a test using express' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat && npm run rm:git:express",
20
- "build:fastify": "npm run rm:fastify && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify -D 'This is a test using fastify' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -F --tests --ghat && npm run rm:git:fastify",
21
- "build:express:graphql": "npm run rm:express:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express-graphql -D 'This is a test using express with GraphQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g && npm run rm:git:express:graphql",
22
- "build:fastify:graphql": "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' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -F -g && npm run rm:git:fastify:graphql",
23
- "build:express:sequelize": "npm run rm:express:sequelize && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express-sequelize -D 'This is a test using express with sequelize' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -d postgres && npm run rm:git:express:sequelize",
24
- "build:fastify:sequelize": "npm run rm:fastify:sequelize && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify-sequelize -D 'This is a test using fastify with sequelize' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -F --tests --ghat -d postgres && npm run rm:git:fastify:sequelize",
25
- "build:express:graphql:sequelize": "npm run rm:express:graphql:sequelize && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express-graphql-sequelize -D 'This is a test using express with graphql and sequelize' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat -d postgres && npm run rm:git:express:graphql:sequelize",
26
- "build:fastify:graphql:sequelize": "npm run rm:fastify:graphql:sequelize && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify-graphql-sequelize -D 'This is a test using fastify with graphql and sequelize' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -F -g --tests --ghat -d postgres && npm run rm:git:fastify:graphql:sequelize",
14
+ "build:sql": "npm run rm:sql && npm run build:express && npm run build:fastify && npm run build:express:graphql && npm run build:fastify:graphql",
15
+ "build:express:all": "npm run build:express && npm run build:express:mongo && npm run build:express:graphql && npm run build:express:mongo:graphql",
16
+ "build:fastify:all": "npm run build:fastify && npm run build:fastify:mongo && npm run build:fastify:graphql && npm run build:fastify:mongo:graphql",
17
+ "build:express": "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",
18
+ "build:express:mongo": "npm run rm:express:mongo && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express-mongo -D 'This is a test using Express with Prisma and MongoDB' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat && npm run rm:git:express",
19
+ "build:fastify": "npm run rm:fastify && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify -D 'This is a test using Fastify with Prisma and PostgreSQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H--tests --ghat -d postgres -F && npm run rm:git:fastify",
20
+ "build:fastify:mongo": "npm run rm:fastify:mongo && npm run cd:mv:example && node -r dotenv/config ./bin -N example/fastify-mongo -D 'This is a test using Fastify with Prisma and MongoDB' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H --tests --ghat -F && npm run rm:git:fastify:mongo",
21
+ "build:express:graphql": "npm run rm:express:graphql && npm run cd:mv:example && node -r dotenv/config ./bin -N example/express-graphql -D 'This is a test using Express with GraphQL with Prisma and PostgreSQL' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H -g --tests --ghat -d postgres && npm run rm:git:express:graphql",
22
+ "build:express:mongo:graphql": "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",
23
+ "build:fastify:graphql": "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",
24
+ "build:fastify:mongo:graphql": "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",
27
25
  "build:and:test:only": "npm run build && npm run test:only",
28
26
  "test": "npm run test:without:restore && git restore .",
29
27
  "test:local": "npm run test:without:restore && git restore .",
30
- "test:without:restore": "npm run build && npm run test:express:local && npm run test:fastify:local && npm run test:express:graphql:local && npm run test:fastify:graphql:local && npm run test:express:graphql:sequelize:local && test:fastify:graphql:sequelize:local && npm run test:express:sequelize:local && test:fastify:sequelize:local",
31
- "test:ci:mongo": "npm run build:mongo && npm run test:express:ci && npm run test:fastify:ci && npm run test:express:graphql:ci && npm run test:fastify:graphql:ci",
32
- "test:ci:postgresql": "npm run build:postgresql && npm run test:express:sequelize:ci && npm run test:fastify:sequelize:ci",
28
+ "test:integration": "jest --testPathPattern=test/integration",
29
+ "test:without:restore": "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",
30
+ "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",
31
+ "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",
33
32
  "test:only": "npm run test:express:only && npm run test:fastify:only",
34
- "test:express:only": "npm run test:express:local && npm run test:express:graphql:local && npm run test:express:graphql:sequelize:local && npm run test:express:sequelize:local",
35
- "test:fastify:only": "npm run test:fastify:local && npm run test:fastify:graphql:local && npm run test:fastify:graphql:sequelize:local && npm run test:fastify:graphql:sequelize:local",
33
+ "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",
34
+ "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",
36
35
  "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",
36
+ "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",
37
37
  "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",
38
- "test:express:graphql:local": "if [ -d \"example/express-graphql/node_modules\" ]; then npm run test:local --prefix example/express-graphql; else echo 'Can not run the test for express api because the dependencies are not installed'; fi",
38
+ "test:fastify:mongo:local": "if [ -d \"example/fastify-mongo/node_modules\" ]; then npm run test:local --prefix example/fastify-mongo; else echo 'Can not run the test for fastify-mongo api because the dependencies are not installed'; fi",
39
+ "test:express:graphql:local": "if [ -d \"example/express-graphql/node_modules\" ]; then npm run test:local --prefix example/express-graphql; else echo 'Can not run the test for express-graphql api because the dependencies are not installed'; fi",
40
+ "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",
39
41
  "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",
40
- "test:express:sequelize:local": "if [ -d \"example/express-sequelize/node_modules\" ]; then npm run test:local --prefix example/express-sequelize; else echo 'Can not run the test for express-sequelize api because the dependencies are not installed'; fi",
41
- "test:fastify:sequelize:local": "if [ -d \"example/fastify-sequelize/node_modules\" ]; then npm run test:local --prefix example/fastify-sequelize; else echo 'Can not run the test for fastify-sequelize api because the dependencies are not installed'; fi",
42
- "test:express:graphql:sequelize:local": "if [ -d \"example/express-graphql-sequelize/node_modules\" ]; then npm run test:local --prefix example/express-graphql-sequelize; else echo 'Can not run the test for express-graphql-sequelize api because the dependencies are not installed'; fi",
43
- "test:fastify:graphql:sequelize:local": "if [ -d \"example/fastify-graphql-sequelize/node_modules\" ]; then npm run test:local --prefix example/fastify-graphql-sequelize; else echo 'Can not run the test for fastify-graphql-sequelize api because the dependencies are not installed'; fi",
42
+ "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",
44
43
  "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",
44
+ "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",
45
45
  "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",
46
- "test:express:graphql:ci": "if [ -d \"example/express-graphql/node_modules\" ]; then npm run test:ci --prefix example/express-graphql; else echo 'Can not run the test for express api because the dependencies are not installed'; fi",
47
- "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 api because the dependencies are not installed'; fi",
48
- "test:express:sequelize:ci": "if [ -d \"example/express-sequelize/node_modules\" ]; then npm run test:ci --prefix example/express-sequelize; else echo 'Can not run the test for express api because the dependencies are not installed'; fi",
49
- "test:fastify:sequelize:ci": "if [ -d \"example/fastify-sequelize/node_modules\" ]; then npm run test:ci --prefix example/fastify-sequelize; else echo 'Can not run the test for fastify api because the dependencies are not installed'; fi",
50
- "test:express:graphql:sequelize:ci": "if [ -d \"example/express-graphql-sequelize/node_modules\" ]; then npm run test:ci --prefix example/express-graphql-sequelize; else echo 'Can not run the test for express api because the dependencies are not installed'; fi",
51
- "test:fastify:graphql:sequelize:ci": "if [ -d \"example/fastify-graphql-sequelize/node_modules\" ]; then npm run test:ci --prefix example/fastify-graphql-sequelize; else echo 'Can not run the test for fastify api because the dependencies are not installed'; fi",
46
+ "test:fastify:mongo:ci": "if [ -d \"example/fastify-mongo/node_modules\" ]; then npm run test:ci --prefix example/fastify-mongo; else echo 'Can not run the test for fastify-mongo api because the dependencies are not installed'; fi",
47
+ "test:express:graphql:ci": "if [ -d \"example/express-graphql/node_modules\" ]; then npm run test:ci --prefix example/express-graphql; else echo 'Can not run the test for express-graphql api because the dependencies are not installed'; fi",
48
+ "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",
49
+ "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",
50
+ "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",
52
51
  "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",
52
+ "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",
53
53
  "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",
54
- "list:directory:tree:express-graphql": "if [ -f \"projectStructureExamples/express-graphql.txt\" ]; then rm projectStructureExamples/express-graphql.txt; fi && tree example/express-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express-graphql.txt",
55
- "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",
56
- "list:directory:tree:express-sequelize": "if [ -f \"projectStructureExamples/express-sequelize.txt\" ]; then rm projectStructureExamples/express-sequelize.txt; fi && tree example/express-sequelize -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express-sequelize.txt",
57
- "list:directory:tree:fastify-sequelize": "if [ -f \"projectStructureExamples/fastify-sequelize.txt\" ]; then rm projectStructureExamples/fastify-sequelize.txt; fi && tree example/fastify-sequelize -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/fastify-sequelize.txt",
58
- "list:directory:tree:express-graphql-sequelize": "if [ -f \"projectStructureExamples/express-graphql-sequelize.txt\" ]; then rm projectStructureExamples/express-graphql-sequelize.txt; fi && tree example/express-graphql-sequelize -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express-graphql-sequelize.txt",
59
- "list:directory:tree:fastify-graphql-sequelize": "if [ -f \"projectStructureExamples/fastify-graphql-sequelize.txt\" ]; then rm projectStructureExamples/fastify-graphql-sequelize.txt; fi && tree example/fastify-graphql-sequelize -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/fastify-graphql-sequelize.txt",
60
- "list:directory:tree:examples": "npm run list:directory:tree:express && npm run list:directory:tree:fastify && npm run list:directory:tree:express-graphql && npm run list:directory:tree:fastify-graphql && npm run list:directory:tree:express-sequelize && npm run list:directory:tree:fastify-sequelize && npm run list:directory:tree:express-graphql-sequelize && npm run list:directory:tree:fastify-graphql-sequelize",
54
+ "list:directory:tree:fastify:mongo": "if [ -f \"projectStructureExamples/fastify-mongo.txt\" ]; then rm projectStructureExamples/fastify-mongo.txt; fi && tree example/fastify-mongo -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/fastify-mongo.txt",
55
+ "list:directory:tree:express:graphql": "if [ -f \"projectStructureExamples/express-graphql.txt\" ]; then rm projectStructureExamples/express-graphql.txt; fi && tree example/express-graphql -a --dirsfirst --sort name -I node_modules | cut -d'/' -f 2 | tail -n +2 >> projectStructureExamples/express-graphql.txt",
56
+ "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",
57
+ "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",
58
+ "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",
59
+ "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",
61
60
  "rm": "if [ -d \"example\" ]; then rm -rf example; fi",
62
- "rm:mongo": "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",
63
- "rm:postgresql": "if [ -d \"example/express-sequelize\" ]; then rm -rf example/express-sequelize; fi && if [ -d \"example/fastify-sequelize\" ]; then rm -rf example/fastify-sequelize; fi",
61
+ "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",
62
+ "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",
64
63
  "rm:express": "if [ -d \"example/express\" ]; then rm -rf example/express; fi",
64
+ "rm:express:mongo": "if [ -d \"example/express-mongo\" ]; then rm -rf example/express-mongo; fi",
65
65
  "rm:fastify": "if [ -d \"example/fastify\" ]; then rm -rf example/fastify; fi",
66
+ "rm:fastify:mongo": "if [ -d \"example/fastify-mongo\" ]; then rm -rf example/fastify-mongo; fi",
66
67
  "rm:express:graphql": "if [ -d \"example/express-graphql\" ]; then rm -rf example/express-graphql; fi",
67
68
  "rm:fastify:graphql": "if [ -d \"example/fastify-graphql\" ]; then rm -rf example/fastify-graphql; fi",
68
- "rm:express:sequelize": "if [ -d \"example/express-sequelize\" ]; then rm -rf example/express-sequelize; fi",
69
- "rm:fastify:sequelize": "if [ -d \"example/fastify-sequelize\" ]; then rm -rf example/fastify-sequelize; fi",
70
- "rm:express:graphql:sequelize": "if [ -d \"example/express-graphql-sequelize\" ]; then rm -rf example/express-graphql-sequelize; fi",
71
- "rm:fastify:graphql:sequelize": "if [ -d \"example/fastify-graphql-sequelize\" ]; then rm -rf example/fastify-graphql-sequelize; fi",
69
+ "rm:express:mongo:graphql": "if [ -d \"example/express-mongo-graphql\" ]; then rm -rf example/express-mongo-graphql; fi",
70
+ "rm:fastify:mongo:graphql": "if [ -d \"example/fastify-mongo-graphql\" ]; then rm -rf example/fastify-mongo-graphql; fi",
72
71
  "rm:git:express": "if [ -d \"example/express/.git\" ]; then rm -rf example/express/.git; fi",
72
+ "rm:git:express:mongo": "if [ -d \"example/express-mongo/.git\" ]; then rm -rf example/express-mongo/.git; fi",
73
73
  "rm:git:fastify": "if [ -d \"example/fastify/.git\" ]; then rm -rf example/fastify/.git; fi",
74
+ "rm:git:fastify:mongo": "if [ -d \"example/fastify-mongo/.git\" ]; then rm -rf example/fastify-mongo/.git; fi",
74
75
  "rm:git:express:graphql": "if [ -d \"example/express-graphql/.git\" ]; then rm -rf example/express-graphql/.git; fi",
76
+ "rm:git:express:mongo:graphql": "if [ -d \"example/express-mongo-graphql/.git\" ]; then rm -rf example/express-mongo-graphql/.git; fi",
75
77
  "rm:git:fastify:graphql": "if [ -d \"example/fastify-graphql/.git\" ]; then rm -rf example/fastify-graphql/.git; fi",
76
- "rm:git:express:sequelize": "if [ -d \"example/express-sequelize/.git\" ]; then rm -rf example/express-sequelize/.git; fi",
77
- "rm:git:fastify:sequelize": "if [ -d \"example/fastify-sequelize/.git\" ]; then rm -rf example/fastify-sequelize/.git; fi",
78
- "rm:git:express:graphql:sequelize": "if [ -d \"example/express-graphql-sequelize/.git\" ]; then rm -rf example/express-graphql-sequelize/.git; fi",
79
- "rm:git:fastify:graphql:sequelize": "if [ -d \"example/fastify-graphql-sequelize/.git\" ]; then rm -rf example/fastify-graphql-sequelize/.git; fi",
80
- "rm:node_modules": "if [ -d \"example/express/node_modules\" ]; then rm -rf example/express/node_modules; fi && if [ -d \"example/express-graphql/node_modules\" ]; then rm -rf example/express-graphql/node_modules; fi && if [ -d \"example/fastify/node_modules\" ]; then rm -rf example/fastify/node_modules; fi && if [ -d \"example/fastify-graphql/node_modules\" ]; then rm -rf example/fastify-graphql/node_modules; fi",
78
+ "rm:git:fastify:mongo:graphql": "if [ -d \"example/fastify-mongo-graphql/.git\" ]; then rm -rf example/fastify-mongo-graphql/.git; fi",
79
+ "rm:project:structures": "if [ -d \"projectStructureExamples\" ]; then rm -rf projectStructureExamples/*; fi",
81
80
  "cd:mv:example": "if [ ! -d \"example\" ]; then mkdir example && cd example; fi",
81
+ "restore:db": "node ./scripts/restoreRelationalDb.js && node ./scripts/restoreMongoDb.js",
82
82
  "release": "standard-version",
83
83
  "version": "npm run release && npm run list:directory:tree:examples && git add ."
84
84
  },
@@ -93,27 +93,34 @@
93
93
  "terminal",
94
94
  "tool",
95
95
  "tty",
96
- "utility"
96
+ "utility",
97
+ "Simba",
98
+ "shell"
97
99
  ],
98
100
  "author": "AnthonyLzq",
99
101
  "license": "MIT",
100
102
  "dependencies": {
101
- "cli-progress": "^3.11.2",
103
+ "cli-progress": "^3.12.0",
102
104
  "colors": "^1.4.0",
103
- "readline-sync": "^1.4.10",
105
+ "prompts": "^2.4.2",
104
106
  "underscore": "^1.13.6",
105
- "yargs": "^17.6.0"
107
+ "yargs": "^17.7.2"
106
108
  },
107
109
  "devDependencies": {
108
- "dotenv": "^16.0.3",
109
- "eslint": "^8.26.0",
110
- "eslint-config-prettier": "^8.5.0",
111
- "eslint-config-standard": "^17.0.0",
112
- "eslint-plugin-import": "^2.26.0",
110
+ "@types/jest": "^29.5.3",
111
+ "dotenv": "^16.3.1",
112
+ "eslint": "^8.46.0",
113
+ "eslint-config-prettier": "^8.10.0",
114
+ "eslint-config-standard": "^17.1.0",
115
+ "eslint-plugin-import": "^2.28.0",
113
116
  "eslint-plugin-node": "^11.1.0",
114
- "eslint-plugin-prettier": "^4.2.1",
117
+ "eslint-plugin-prettier": "^5.0.0",
115
118
  "eslint-plugin-promise": "^6.1.1",
116
- "prettier": "^2.7.1",
119
+ "jest": "^29.6.2",
120
+ "knex": "^2.5.1",
121
+ "mongodb": "^5.7.0",
122
+ "pg": "^8.11.2",
123
+ "prettier": "^3.0.1",
117
124
  "standard-version": "^9.5.0"
118
125
  },
119
126
  "repository": {
@@ -1,16 +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
- herokuContent: `build:
10
- docker:
11
- web: Dockerfile`,
12
- herokuFile: 'heroku.yml'
13
- }
14
-
15
- await writeFile(`${projectName}/${data.herokuFile}`, data.herokuContent)
16
- }
@@ -1,51 +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
- webpackContent: `const path = require('path')
10
- const nodeExternals = require('webpack-node-externals')
11
- const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
12
-
13
- module.exports = {
14
- context: __dirname,
15
- entry: './src/index.ts',
16
- externals: [nodeExternals()],
17
- module: {
18
- rules: [
19
- {
20
- exclude: /node_modules/,
21
- test: /.ts$/,
22
- use: {
23
- loader: 'ts-loader'
24
- }
25
- }
26
- ]
27
- },
28
- node: {
29
- __dirname: false
30
- },
31
- resolve: {
32
- extensions: ['.ts', '.js'],
33
- plugins: [
34
- new TsconfigPathsPlugin({
35
- baseUrl: './src'
36
- })
37
- ]
38
- },
39
- output: {
40
- filename: 'index.js',
41
- path: path.resolve(__dirname, 'dist'),
42
- publicPath: '/dist/'
43
- },
44
- target: 'node'
45
- }
46
- `,
47
- webpackFile: 'webpack.config.js'
48
- }
49
-
50
- await writeFile(`${projectName}/${data.webpackFile}`, data.webpackContent)
51
- }