@anthonylzq/simba.js 7.0.0 → 7.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 +74 -20
- package/lib/index.js +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -55,43 +55,47 @@ This will generate the following output:
|
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
"simba [options]" (if you it installed globally) or only "simba -q" if you want
|
|
58
|
-
to be asked for the options one by one
|
|
58
|
+
to be asked for the options one by one.
|
|
59
59
|
|
|
60
60
|
Options:
|
|
61
|
-
-N, --projectName Project name
|
|
62
|
-
-D, --projectDescription Project description
|
|
63
|
-
-a, --author Author of the project
|
|
64
|
-
-e, --email Email of the author
|
|
61
|
+
-N, --projectName Project name.
|
|
62
|
+
-D, --projectDescription Project description.
|
|
63
|
+
-a, --author Author of the project.
|
|
64
|
+
-e, --email Email of the author.
|
|
65
65
|
-H, --heroku Whether or not the project will be deployed
|
|
66
|
-
using Heroku
|
|
66
|
+
using Heroku. [boolean] [default: false]
|
|
67
67
|
-l, --license Type of license for the project, it can be one
|
|
68
68
|
of: MIT, Apache 2.0, MPL 2.0, LGPL 3.0, GPL 3.0
|
|
69
|
-
and AGPL 3.0, in lowercase without its version
|
|
69
|
+
and AGPL 3.0, in lowercase without its version.
|
|
70
70
|
[default: "unlicensed"]
|
|
71
|
-
-v, --version Project initial version
|
|
72
|
-
-y, --licenseYear Year when the license starts
|
|
71
|
+
-v, --version Project initial version. [default: "0.1.0"]
|
|
72
|
+
-y, --licenseYear Year when the license starts. [default: "2022"]
|
|
73
73
|
-n, --npm Whether or not the project should use npm as
|
|
74
|
-
package manager
|
|
75
|
-
-f, --mainFile Main file of the project
|
|
74
|
+
package manager. [boolean] [default: false]
|
|
75
|
+
-f, --mainFile Main file of the project.
|
|
76
76
|
[default: "src/index.ts"]
|
|
77
77
|
-q, --questions Whether or not you want to be asked to answer
|
|
78
|
-
the questions related to the project one by
|
|
79
|
-
|
|
78
|
+
the questions related to the project one by
|
|
79
|
+
one. [boolean] [default: false]
|
|
80
80
|
-F, --fastify Whether or not you want to use Fastify for your
|
|
81
|
-
project
|
|
81
|
+
project. [boolean] [default: false]
|
|
82
82
|
-g, --graphql Whether or not you want to use GraphQL for your
|
|
83
|
-
project
|
|
83
|
+
project. [boolean] [default: false]
|
|
84
84
|
-t, --tests Whether or not you want to have a basic suit of
|
|
85
|
-
unit tests with Jest
|
|
85
|
+
unit tests with Jest.[boolean] [default: false]
|
|
86
86
|
--ghat, --gh-action-tests Whether or not you want to have a GitHub Action
|
|
87
|
-
with a CI for your tests. If this
|
|
88
|
-
to true, the tests flag must be
|
|
89
|
-
|
|
87
|
+
with a CI for your tests and linting. If this
|
|
88
|
+
option is set to true, the tests flag must be
|
|
89
|
+
set to true. [default: false]
|
|
90
|
+
-d, --database Which database you want to use, available
|
|
91
|
+
databases are: MongoDB, PostgreSQL, MySQL,
|
|
92
|
+
MariaDB, Sqlite and Microsoft SQL Server.
|
|
93
|
+
[default: "mongo"]
|
|
90
94
|
-h, --help Show help [boolean]
|
|
91
95
|
|
|
92
96
|
Examples:
|
|
93
97
|
simba -N 'Project Name' -D 'Project description' -a Anthony -e
|
|
94
|
-
sluzquinosa@uni.pe -l mit -F
|
|
98
|
+
sluzquinosa@uni.pe -l mit -F -t -d mongo --ghat
|
|
95
99
|
|
|
96
100
|
Developed by AnthonyLzq
|
|
97
101
|
```
|
|
@@ -118,6 +122,12 @@ What if I want to use Fastify instead Express? Well, you only have to pass the `
|
|
|
118
122
|
simba -N myProject -D 'This is a test' -l mit -a myName -e myEmail@email.com -H -F
|
|
119
123
|
```
|
|
120
124
|
|
|
125
|
+
If I want to use a relational database instead MongoDB? Well, you only have to pass the `-d` flag:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
simba -N myProject -D 'This is a test' -l mit -a myName -e myEmail@email.com -H -F -d postgresql
|
|
129
|
+
```
|
|
130
|
+
|
|
121
131
|
And how can I use GraphQL? Well, you only have to pass the `-g` flag:
|
|
122
132
|
|
|
123
133
|
```bash
|
|
@@ -142,8 +152,12 @@ Also, if you are interested in the folder structure of each case, please take a
|
|
|
142
152
|
|
|
143
153
|
- [Express case](./projectStructureExamples/express.txt)
|
|
144
154
|
- [Express-GraphQL case](./projectStructureExamples/express-graphql.txt)
|
|
155
|
+
- [Express-GraphQL-Sequelize case](./projectStructureExamples/express-GraphQL-sequelize.txt)
|
|
156
|
+
- [Express-Sequelize case](./projectStructureExamples/express-sequelize.txt)
|
|
145
157
|
- [Fastify case](./projectStructureExamples/fastify.txt)
|
|
146
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)
|
|
147
161
|
|
|
148
162
|
### Some considerations
|
|
149
163
|
|
|
@@ -186,6 +200,7 @@ Also, if you are interested in the folder structure of each case, please take a
|
|
|
186
200
|
- Finally, `git` will be initialized and a list of libraries will be installed. Check the [**notes**](#notes).
|
|
187
201
|
- Relative imports is already configured, you do not need to import a file using `../../../some/very/nested/stuff/in/other/folder`, you can use `some/very/nested/stuff/in/other/folder` assuming that your folder is under the `src` folder.
|
|
188
202
|
- The Fastify version is set to v3 because Apollo Server has not yet provided support for Fastify v4 yet, and it is difficult to have support for two different major versions of Fastify, so until Apollo Server supports Fastify v4, this package will use Fastify v3.
|
|
203
|
+
- Support for Heroku will be deprecated in the next major release because it drops its free tier.
|
|
189
204
|
|
|
190
205
|
## Who uses Simba.js?
|
|
191
206
|
|
|
@@ -306,6 +321,45 @@ As `dependencies`:
|
|
|
306
321
|
|
|
307
322
|
Feel free to contribute to this project. Every contribution will be appreciated.
|
|
308
323
|
|
|
324
|
+
### In case you are using a relational database
|
|
325
|
+
|
|
326
|
+
As `dependencies`:
|
|
327
|
+
|
|
328
|
+
- [`sequelize`](https://www.npmjs.com/package/sequelize)
|
|
329
|
+
- [`sequelize-typescript`](https://www.npmjs.com/package/sequelize-typescript)
|
|
330
|
+
- [`sequelize-typescript-migration-lts`](https://www.npmjs.com/package/sequelize-typescript-migration-lts)
|
|
331
|
+
|
|
332
|
+
#### PostgreSQL case
|
|
333
|
+
|
|
334
|
+
As `dependencies`:
|
|
335
|
+
|
|
336
|
+
- [`pg`](https://www.npmjs.com/package/pg)
|
|
337
|
+
- [`pg-hstore`](https://www.npmjs.com/package/pg-hstore)
|
|
338
|
+
|
|
339
|
+
#### MySql case
|
|
340
|
+
|
|
341
|
+
As `dependencies`:
|
|
342
|
+
|
|
343
|
+
- [`mysql2`](https://www.npmjs.com/package/mysql2)
|
|
344
|
+
|
|
345
|
+
#### MariaDB case
|
|
346
|
+
|
|
347
|
+
As `dependencies`:
|
|
348
|
+
|
|
349
|
+
- [`mariadb`](https://www.npmjs.com/package/mariadb)
|
|
350
|
+
|
|
351
|
+
#### Sqlite case
|
|
352
|
+
|
|
353
|
+
As `dependencies`:
|
|
354
|
+
|
|
355
|
+
- [`sqlite3`](https://www.npmjs.com/package/sqlite3)
|
|
356
|
+
|
|
357
|
+
#### SQLServer case
|
|
358
|
+
|
|
359
|
+
As `dependencies`:
|
|
360
|
+
|
|
361
|
+
- [`tedious`](https://www.npmjs.com/package/tedious)
|
|
362
|
+
|
|
309
363
|
## Author
|
|
310
364
|
|
|
311
365
|
- **Anthony Luzquiños** - _Initial Work_ - _Documentation_ - [AnthonyLzq](https://github.com/AnthonyLzq).
|
package/lib/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const argv = yargs(hideBin(process.argv))
|
|
|
16
16
|
)
|
|
17
17
|
.alias('N', 'projectName')
|
|
18
18
|
.nargs('N', 1)
|
|
19
|
-
.describe('N', 'Project name')
|
|
19
|
+
.describe('N', 'Project name.')
|
|
20
20
|
.alias('D', 'projectDescription')
|
|
21
21
|
.nargs('D', 1)
|
|
22
22
|
.describe('D', 'Project description.')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthonylzq/simba.js",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "set up a modern backend app by running one command",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build:and:test:only": "npm run build && npm run test:only",
|
|
28
28
|
"test": "npm run test:without:restore && git restore .",
|
|
29
29
|
"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:sequelize:local && test:fastify:sequelize:local",
|
|
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
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
32
|
"test:ci:postgresql": "npm run build:postgresql && npm run test:express:sequelize:ci && npm run test:fastify:sequelize:ci",
|
|
33
33
|
"test:only": "npm run test:express:only && npm run test:fastify:only",
|
|
@@ -55,7 +55,9 @@
|
|
|
55
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
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
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:
|
|
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",
|
|
59
61
|
"rm": "if [ -d \"example\" ]; then rm -rf example; fi",
|
|
60
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",
|
|
61
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",
|
|
@@ -103,14 +105,14 @@
|
|
|
103
105
|
"yargs": "^17.5.1"
|
|
104
106
|
},
|
|
105
107
|
"devDependencies": {
|
|
106
|
-
"dotenv": "^16.0.
|
|
107
|
-
"eslint": "^8.
|
|
108
|
+
"dotenv": "^16.0.2",
|
|
109
|
+
"eslint": "^8.23.0",
|
|
108
110
|
"eslint-config-prettier": "^8.5.0",
|
|
109
111
|
"eslint-config-standard": "^17.0.0",
|
|
110
112
|
"eslint-plugin-import": "^2.26.0",
|
|
111
113
|
"eslint-plugin-node": "^11.1.0",
|
|
112
114
|
"eslint-plugin-prettier": "^4.2.1",
|
|
113
|
-
"eslint-plugin-promise": "^6.0.
|
|
115
|
+
"eslint-plugin-promise": "^6.0.1",
|
|
114
116
|
"prettier": "^2.7.1",
|
|
115
117
|
"standard-version": "^9.5.0"
|
|
116
118
|
},
|