@anthonylzq/simba.js 1.5.0 → 1.9.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/CHANGELOG.md +41 -0
- package/README.md +25 -14
- package/lib/index.js +10 -8
- package/lib/src/functions/docker.js +6 -0
- package/lib/src/functions/eslint.js +13 -29
- package/lib/src/functions/express.js +14 -34
- package/lib/src/functions/gitignore.js +2 -0
- package/lib/src/functions/tsconfig.js +3 -2
- package/lib/src/functions/webpack.js +7 -1
- package/lib/src/installation.js +8 -6
- package/package.json +3 -3
- package/.eslintrc +0 -64
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [1.9.0](https://github.com/AnthonyLzq/simba.js/compare/v1.8.0...v1.9.0) (2021-12-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* updated packages and example folder to include license and heroku config ([7267e7a](https://github.com/AnthonyLzq/simba.js/commit/7267e7ab40bf7333d566d7e90d85ad4f4357b731))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* linted eslint.js file ([a47ea79](https://github.com/AnthonyLzq/simba.js/commit/a47ea795e2f6cf4363bd82ed05fc2c31b4fa8a26))
|
|
16
|
+
|
|
17
|
+
## [1.8.0](https://github.com/AnthonyLzq/simba.js/compare/v1.7.0...v1.8.0) (2021-12-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* implemented baseUrl config with ts and webpack to avoid "../../.. ..." ([9b9e9d2](https://github.com/AnthonyLzq/simba.js/commit/9b9e9d20cae8b4bbdaef58364220512514dac1a4))
|
|
23
|
+
* updated docker file and ignored git folder to be generated manually by docker ([33c1b0d](https://github.com/AnthonyLzq/simba.js/commit/33c1b0df9cfac4e686ece884aa3102e9ad49e6ab))
|
|
24
|
+
* updated docs ([ba72b64](https://github.com/AnthonyLzq/simba.js/commit/ba72b643ea45af7ce7dd7a9adaf8b4f27eacd266))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* fixed eslint ignore ([1405884](https://github.com/AnthonyLzq/simba.js/commit/1405884ab10cf869d6811fbf588ba0b0efb04de2))
|
|
30
|
+
* fixed mongo connection ([57f8580](https://github.com/AnthonyLzq/simba.js/commit/57f85803701253be2308b1c45f537db5b59c92d4))
|
|
31
|
+
|
|
32
|
+
## [1.7.0](https://github.com/AnthonyLzq/simba.js/compare/v1.6.0...v1.7.0) (2021-12-12)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* updated docs and minor changes ([e6b32ca](https://github.com/AnthonyLzq/simba.js/commit/e6b32ca309603544e3506c9d18717f0e45ef0457))
|
|
38
|
+
|
|
39
|
+
## [1.6.0](https://github.com/AnthonyLzq/simba.js/compare/v1.5.0...v1.6.0) (2021-12-12)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Features
|
|
43
|
+
|
|
44
|
+
* implemented default mongo connection to local database ([1e66e98](https://github.com/AnthonyLzq/simba.js/commit/1e66e982b03eca5c2c3846a10ad827150683da21))
|
|
45
|
+
|
|
5
46
|
## [1.5.0](https://github.com/AnthonyLzq/simba.js/compare/v1.3.1...v1.5.0) (2021-12-12)
|
|
6
47
|
|
|
7
48
|
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Simba.js
|
|
2
2
|
|
|
3
|
+
[](https://standardjs.com)
|
|
4
|
+
|
|
3
5
|
Set up a modern backend app by running one command. This project has the goal to create a complete setup for a backend application using `TypeScript` and `Express`. It will create many files that are usually created manually. Currently the following files are being created:
|
|
4
6
|
|
|
5
7
|
- `.env`
|
|
@@ -59,14 +61,14 @@ simba -h
|
|
|
59
61
|
This will generate the following output:
|
|
60
62
|
|
|
61
63
|
```bash
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
simba [options] (if you it installed globally) or only simba if you want to be
|
|
65
|
+
asked for the options one by one
|
|
64
66
|
|
|
65
67
|
Options:
|
|
66
|
-
-a, --author Author of the project
|
|
67
|
-
-e, --email Email of the author
|
|
68
68
|
-N, --projectName Project name
|
|
69
69
|
-D, --projectDescription Project description
|
|
70
|
+
-a, --author Author of the project
|
|
71
|
+
-e, --email Email of the author
|
|
70
72
|
-H, --heroku Whether or not the project will be deployed using
|
|
71
73
|
Heroku [boolean] [default: false]
|
|
72
74
|
-l, --license Type of license for the project, it can be one of:
|
|
@@ -84,8 +86,8 @@ Options:
|
|
|
84
86
|
-h, --help Show help [boolean]
|
|
85
87
|
|
|
86
88
|
Examples:
|
|
87
|
-
simba
|
|
88
|
-
|
|
89
|
+
simba -N "Project Name" -D "Project description -a Anthony -e
|
|
90
|
+
sluzquinosa@uni.pe"
|
|
89
91
|
|
|
90
92
|
Developed by AnthonyLzq
|
|
91
93
|
```
|
|
@@ -139,28 +141,34 @@ Regardless of the option chosen, a new folder will be generated with the name of
|
|
|
139
141
|
Let's suppose you want to build a project that will be deployed to Heroku, so should run:
|
|
140
142
|
|
|
141
143
|
```bash
|
|
142
|
-
simba -
|
|
144
|
+
simba -N myProject -D 'This is a test' -l mit -a myName -e myEmail@email.com -H
|
|
143
145
|
```
|
|
144
146
|
|
|
145
|
-
Here we are specifying that we want to create a new project called `myProject` using the `MIT` license,
|
|
147
|
+
Here we are specifying that we want to create a new project called `myProject` using the `MIT` license, my name and my email are respectively: `myName` and `myEmail@email.com` and I want to use heroku to deploy this server.
|
|
146
148
|
|
|
147
|
-
As default, `yarn` is selected as package manager, but you don't want to use it,
|
|
149
|
+
As default, `yarn` is selected as package manager, but if you don't want to use it, you can pass the flag `-n` or `--npm` as follows:
|
|
148
150
|
|
|
149
151
|
```bash
|
|
150
|
-
simba -
|
|
152
|
+
simba -N myProject -D 'This is a test' -l mit -a myName -e myEmail@email.com -H -n
|
|
151
153
|
```
|
|
152
154
|
|
|
153
155
|
Finally, you may not want to use a license or one of the available licenses, don't worry, just don't pass the flag `-l` neither `--license` as follows:
|
|
154
156
|
|
|
155
157
|
```bash
|
|
156
|
-
simba -
|
|
158
|
+
simba -N myProject -D 'This is a test' -a myName -e myEmail@email.com -H
|
|
157
159
|
```
|
|
158
160
|
|
|
159
161
|
### Some considerations
|
|
160
162
|
|
|
161
163
|
- This project is based in other project from my own, [`typescript-project-generator`](https://www.npmjs.com/package/typescript-project-generator), but only considering the `express-mongoose-node` part.
|
|
162
|
-
- You are able to run a server that has one main route, `home` (`/`),
|
|
163
|
-
- To connect your server with your `MongoDB` database, you need to provide your `uri` in the `.env`.
|
|
164
|
+
- You are able to run a server that has one main route, `home` (`/`), `user` (`api/user` or `api/user/:userId`) and `docs` (`api/docs`).
|
|
165
|
+
- To connect your server with your `MongoDB` database, you need to provide your `uri` in the `.env`. By default, Simba will try to connect to a local database. The content of the `.env` file is:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
MONGO_URI = mongodb://mongo:mongo@mongo:27017/${projectName}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Where `${projectName}` will be replaced by the name of the project you provided in lowercase.
|
|
164
172
|
- Once you have done that, now you can perform the following `HTTP REQUEST`: `GET`, `POST`, `PATCH` and `DELETE`.
|
|
165
173
|
- In order to use global variables, just add the one you need in the `src/@types/index.d.ts` file, and add a new `var` with its type to the `global` interface, as follows:
|
|
166
174
|
```ts
|
|
@@ -184,6 +192,7 @@ simba -a myName -e myEmail@email.com -N myProject -D 'This is a test' -H
|
|
|
184
192
|
- To check the content of the files generated, please check the `example` folder.
|
|
185
193
|
- If you provide a project name that contains spaces, something like 'My awesome Project', every space will be replaced with a hyphen. So at the end your project name will be 'My-awesome-project', but in its README.md file, the hyphens will be removed and the project name will be parsed to title case (My Awesome Project).
|
|
186
194
|
- Finally, `git` will be initialized and a list of libraries will be installed. Check the [**notes**](#notes).
|
|
195
|
+
- 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.
|
|
187
196
|
|
|
188
197
|
## What is new?
|
|
189
198
|
|
|
@@ -202,8 +211,8 @@ Here is the list of the packages that are being installed, as `devDependencies`:
|
|
|
202
211
|
- [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
|
|
203
212
|
- [`dotenv`](https://www.npmjs.com/package/dotenv)
|
|
204
213
|
- [`eslint`](https://www.npmjs.com/package/eslint)
|
|
205
|
-
- [`eslint-config-airbnb-typescript`](https://www.npmjs.com/package/eslint-config-airbnb-typescript)
|
|
206
214
|
- [`eslint-config-prettier`](https://www.npmjs.com/package/eslint-config-prettier)
|
|
215
|
+
- [`eslint-config-standard`](https://www.npmjs.com/package/eslint-config-standard)
|
|
207
216
|
- [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import)
|
|
208
217
|
- [`eslint-plugin-prettier`](https://www.npmjs.com/package/eslint-plugin-prettier)
|
|
209
218
|
- [`eslint-plugin-sort-keys-fix`](https://www.npmjs.com/package/eslint-plugin-sort-keys-fix)
|
|
@@ -213,6 +222,8 @@ Here is the list of the packages that are being installed, as `devDependencies`:
|
|
|
213
222
|
- [`standard-version`](https://www.npmjs.com/package/standard-version)
|
|
214
223
|
- [`ts-loader`](https://www.npmjs.com/package/ts-loader)
|
|
215
224
|
- [`ts-node`](https://www.npmjs.com/package/ts-node)
|
|
225
|
+
- [`tsconfig-paths`](https://www.npmjs.com/package/tsconfig-paths)
|
|
226
|
+
- [`tsconfig-paths-webpack-plugin`](https://www.npmjs.com/package/tsconfig-paths-webpack-plugin)
|
|
216
227
|
- [`typescript`](https://www.npmjs.com/package/typescript)
|
|
217
228
|
- [`webpack`](https://www.npmjs.com/package/webpack)
|
|
218
229
|
- [`webpack-cli`](https://www.npmjs.com/package/webpack-cli)
|
package/lib/index.js
CHANGED
|
@@ -7,24 +7,25 @@ const installation = require('./src/installation')
|
|
|
7
7
|
const CURRENT_YEAR = `${new Date().getFullYear()}`
|
|
8
8
|
const argv = yargs(hideBin(process.argv))
|
|
9
9
|
.version(false)
|
|
10
|
+
// Pending to test it using npx
|
|
10
11
|
.usage(
|
|
11
|
-
'
|
|
12
|
+
'simba [options] (if you it installed globally) or only simba if you want to be asked for the options one by one'
|
|
12
13
|
)
|
|
13
14
|
.example(
|
|
14
|
-
'simba
|
|
15
|
+
'simba -N "Project Name" -D "Project description -a Anthony -e sluzquinosa@uni.pe"'
|
|
15
16
|
)
|
|
16
|
-
.alias('a', 'author')
|
|
17
|
-
.nargs('a', 1)
|
|
18
|
-
.describe('a', 'Author of the project')
|
|
19
|
-
.alias('e', 'email')
|
|
20
|
-
.nargs('e', 1)
|
|
21
|
-
.describe('e', 'Email of the author')
|
|
22
17
|
.alias('N', 'projectName')
|
|
23
18
|
.nargs('N', 1)
|
|
24
19
|
.describe('N', 'Project name')
|
|
25
20
|
.alias('D', 'projectDescription')
|
|
26
21
|
.nargs('D', 1)
|
|
27
22
|
.describe('D', 'Project description')
|
|
23
|
+
.alias('a', 'author')
|
|
24
|
+
.nargs('a', 1)
|
|
25
|
+
.describe('a', 'Author of the project')
|
|
26
|
+
.alias('e', 'email')
|
|
27
|
+
.nargs('e', 1)
|
|
28
|
+
.describe('e', 'Email of the author')
|
|
28
29
|
.alias('H', 'heroku')
|
|
29
30
|
.describe('H', 'Whether or not the project will be deployed using Heroku')
|
|
30
31
|
.alias('l', 'license')
|
|
@@ -45,6 +46,7 @@ const argv = yargs(hideBin(process.argv))
|
|
|
45
46
|
.nargs('f', 1)
|
|
46
47
|
.describe('f', 'Main file of the project')
|
|
47
48
|
.alias('q', 'questions')
|
|
49
|
+
.nargs('q', 1)
|
|
48
50
|
.describe(
|
|
49
51
|
'q',
|
|
50
52
|
'Whether or not you want to be asked to answer the questions related to the project one by one'
|
|
@@ -12,11 +12,7 @@ module.exports = async projectName => {
|
|
|
12
12
|
},
|
|
13
13
|
root: true,
|
|
14
14
|
parser: '@typescript-eslint/parser',
|
|
15
|
-
plugins: [
|
|
16
|
-
'@typescript-eslint',
|
|
17
|
-
'import',
|
|
18
|
-
'prettier'
|
|
19
|
-
],
|
|
15
|
+
plugins: ['@typescript-eslint', 'import', 'prettier'],
|
|
20
16
|
extends: [
|
|
21
17
|
'standard',
|
|
22
18
|
'eslint:recommended',
|
|
@@ -27,10 +23,7 @@ module.exports = async projectName => {
|
|
|
27
23
|
rules: {
|
|
28
24
|
'@typescript-eslint/no-var-requires': 'off',
|
|
29
25
|
'@typescript-eslint/no-empty-interface': 'off',
|
|
30
|
-
'arrow-parens': [
|
|
31
|
-
'error',
|
|
32
|
-
'as-needed'
|
|
33
|
-
],
|
|
26
|
+
'arrow-parens': ['error', 'as-needed'],
|
|
34
27
|
'import/extensions': [
|
|
35
28
|
2,
|
|
36
29
|
{
|
|
@@ -60,37 +53,28 @@ module.exports = async projectName => {
|
|
|
60
53
|
}
|
|
61
54
|
],
|
|
62
55
|
'newline-before-return': 'error',
|
|
63
|
-
'object-curly-spacing': [
|
|
64
|
-
'error',
|
|
65
|
-
'always'
|
|
66
|
-
],
|
|
56
|
+
'object-curly-spacing': ['error', 'always'],
|
|
67
57
|
'prefer-const': 'error',
|
|
68
58
|
'prettier/prettier': [
|
|
69
59
|
'error',
|
|
70
60
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
61
|
+
arrowParens: 'avoid',
|
|
62
|
+
bracketSpacing: true,
|
|
63
|
+
printWidth: 80,
|
|
64
|
+
quoteProps: 'as-needed',
|
|
65
|
+
semi: false,
|
|
66
|
+
singleQuote: true,
|
|
67
|
+
tabWidth: 2,
|
|
68
|
+
trailingComma: 'none'
|
|
79
69
|
}
|
|
80
70
|
],
|
|
81
|
-
radix: [
|
|
82
|
-
'error',
|
|
83
|
-
'as-needed'
|
|
84
|
-
],
|
|
71
|
+
radix: ['error', 'as-needed'],
|
|
85
72
|
'spaced-comment': ['error', 'always']
|
|
86
73
|
}
|
|
87
74
|
}
|
|
88
75
|
`,
|
|
89
76
|
eslintFile: '.eslintrc.js',
|
|
90
|
-
eslintIgnoreContent:
|
|
91
|
-
.eslintrc.js
|
|
92
|
-
webpack.config.js
|
|
93
|
-
`,
|
|
77
|
+
eslintIgnoreContent: '/dist',
|
|
94
78
|
eslintIgnoreFile: '.eslintignore'
|
|
95
79
|
}
|
|
96
80
|
|
|
@@ -35,7 +35,6 @@ const writeFile = require('../utils/writeFile')
|
|
|
35
35
|
* | |- index.http: content, file
|
|
36
36
|
* |- utils:
|
|
37
37
|
* | |- docs.json: content, file
|
|
38
|
-
* | |- response: content, file
|
|
39
38
|
* | |- index: content, file
|
|
40
39
|
* |- .env: content, file
|
|
41
40
|
* |- index: content, file
|
|
@@ -54,7 +53,7 @@ module.exports = async (projectName, projectVersion, email) => {
|
|
|
54
53
|
import { IncomingHttpHeaders } from 'http'
|
|
55
54
|
import { Request, Response } from 'express'
|
|
56
55
|
|
|
57
|
-
import { DtoUser } from '
|
|
56
|
+
import { DtoUser } from 'dto-interfaces'
|
|
58
57
|
|
|
59
58
|
declare global {
|
|
60
59
|
// This variable is global, so it will be available everywhere in the code
|
|
@@ -101,8 +100,8 @@ export { User }
|
|
|
101
100
|
user: {
|
|
102
101
|
content: `import httpErrors from 'http-errors'
|
|
103
102
|
|
|
104
|
-
import { DtoUser } from '
|
|
105
|
-
import { IUser, UserModel } from '
|
|
103
|
+
import { DtoUser } from 'dto-interfaces'
|
|
104
|
+
import { IUser, UserModel } from 'models'
|
|
106
105
|
import { EFU, MFU, GE, errorHandling } from './utils'
|
|
107
106
|
|
|
108
107
|
type Process = {
|
|
@@ -353,8 +352,8 @@ export { IUser, UserModel }
|
|
|
353
352
|
import swaggerUi from 'swagger-ui-express'
|
|
354
353
|
import httpErrors from 'http-errors'
|
|
355
354
|
|
|
356
|
-
import { Home, User } from '
|
|
357
|
-
import { docs } from '
|
|
355
|
+
import { Home, User } from 'routes'
|
|
356
|
+
import { docs } from 'utils'
|
|
358
357
|
|
|
359
358
|
const routers = [User]
|
|
360
359
|
|
|
@@ -429,8 +428,6 @@ class Server {
|
|
|
429
428
|
this._connection = mongoose.connection
|
|
430
429
|
const connection = {
|
|
431
430
|
keepAlive: true,
|
|
432
|
-
useCreateIndex: true,
|
|
433
|
-
useFindAndModify: false,
|
|
434
431
|
useNewUrlParser: true,
|
|
435
432
|
useUnifiedTopology: true
|
|
436
433
|
}
|
|
@@ -466,11 +463,11 @@ class Server {
|
|
|
466
463
|
console.log(\`Server running at port \${PORT}\`)
|
|
467
464
|
})
|
|
468
465
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
466
|
+
try {
|
|
467
|
+
this._mongo()
|
|
468
|
+
} catch (e) {
|
|
469
|
+
console.error(e)
|
|
470
|
+
}
|
|
474
471
|
}
|
|
475
472
|
}
|
|
476
473
|
|
|
@@ -516,9 +513,9 @@ export { Home, User }
|
|
|
516
513
|
import httpErrors from 'http-errors'
|
|
517
514
|
import { ValidationError } from 'joi'
|
|
518
515
|
|
|
519
|
-
import { User as UserC } from '
|
|
520
|
-
import { DtoUser } from '
|
|
521
|
-
import { idSchema, userSchema } from '
|
|
516
|
+
import { User as UserC } from 'controllers/user'
|
|
517
|
+
import { DtoUser } from 'dto-interfaces'
|
|
518
|
+
import { idSchema, userSchema } from 'schemas'
|
|
522
519
|
|
|
523
520
|
const User = Router()
|
|
524
521
|
|
|
@@ -1148,26 +1145,10 @@ DELETE http://localhost:1996/api/user/60e7e3b93b01c1a7aa74cd6b
|
|
|
1148
1145
|
export { docs }
|
|
1149
1146
|
`,
|
|
1150
1147
|
file: `${projectName}/src/utils/index.ts`
|
|
1151
|
-
},
|
|
1152
|
-
response: {
|
|
1153
|
-
content: `import { Response } from 'express'
|
|
1154
|
-
|
|
1155
|
-
const response = (
|
|
1156
|
-
error: boolean,
|
|
1157
|
-
message: unknown,
|
|
1158
|
-
res: Response,
|
|
1159
|
-
status: number
|
|
1160
|
-
): void => {
|
|
1161
|
-
res.status(status).send({ error, message })
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
export { response }
|
|
1165
|
-
`,
|
|
1166
|
-
file: `${projectName}/src/utils/response.ts`
|
|
1167
1148
|
}
|
|
1168
1149
|
},
|
|
1169
1150
|
'.env': {
|
|
1170
|
-
content:
|
|
1151
|
+
content: `MONGO_URI = mongodb://mongo:mongo@mongo:27017/${projectName}`,
|
|
1171
1152
|
file: `${projectName}/.env`
|
|
1172
1153
|
},
|
|
1173
1154
|
index: {
|
|
@@ -1249,7 +1230,6 @@ ${projectName}/src/utils
|
|
|
1249
1230
|
|
|
1250
1231
|
// /utils
|
|
1251
1232
|
await writeFile(data.utils.docs.file, data.utils.docs.content)
|
|
1252
|
-
await writeFile(data.utils.response.file, data.utils.response.content)
|
|
1253
1233
|
await writeFile(data.utils.index.file, data.utils.index.content)
|
|
1254
1234
|
|
|
1255
1235
|
// .env
|
|
@@ -8,7 +8,8 @@ module.exports = async projectName => {
|
|
|
8
8
|
const data = {
|
|
9
9
|
tsconfigContent: `{
|
|
10
10
|
"ts-node": {
|
|
11
|
-
"files": true
|
|
11
|
+
"files": true,
|
|
12
|
+
"require": ["tsconfig-paths/register"]
|
|
12
13
|
},
|
|
13
14
|
"compilerOptions": {
|
|
14
15
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
|
@@ -52,7 +53,7 @@ module.exports = async projectName => {
|
|
|
52
53
|
|
|
53
54
|
/* Module Resolution Options */
|
|
54
55
|
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
|
|
55
|
-
|
|
56
|
+
"baseUrl": "./src", /* Base directory to resolve non-absolute module names. */
|
|
56
57
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
57
58
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
58
59
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
@@ -8,6 +8,7 @@ module.exports = async projectName => {
|
|
|
8
8
|
const data = {
|
|
9
9
|
webpackContent: `const path = require('path')
|
|
10
10
|
const nodeExternals = require('webpack-node-externals')
|
|
11
|
+
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')
|
|
11
12
|
|
|
12
13
|
module.exports = {
|
|
13
14
|
context: __dirname,
|
|
@@ -28,7 +29,12 @@ module.exports = {
|
|
|
28
29
|
__dirname: false
|
|
29
30
|
},
|
|
30
31
|
resolve: {
|
|
31
|
-
extensions: ['.ts', '.js']
|
|
32
|
+
extensions: ['.ts', '.js'],
|
|
33
|
+
plugins: [
|
|
34
|
+
new TsconfigPathsPlugin({
|
|
35
|
+
baseUrl: './src'
|
|
36
|
+
})
|
|
37
|
+
]
|
|
32
38
|
},
|
|
33
39
|
output: {
|
|
34
40
|
filename: 'index.js',
|
package/lib/src/installation.js
CHANGED
|
@@ -58,7 +58,11 @@ module.exports = async ({
|
|
|
58
58
|
|
|
59
59
|
const prodPackages = `${manager} express mongoose morgan http-errors joi swagger-ui-express`
|
|
60
60
|
const devPackages = `${manager} -D \
|
|
61
|
+
@types/express \
|
|
62
|
+
@types/http-errors \
|
|
63
|
+
@types/morgan \
|
|
61
64
|
@types/node \
|
|
65
|
+
@types/swagger-ui-express \
|
|
62
66
|
@typescript-eslint/eslint-plugin \
|
|
63
67
|
@typescript-eslint/parser \
|
|
64
68
|
dotenv \
|
|
@@ -71,17 +75,15 @@ eslint-plugin-sort-keys-fix \
|
|
|
71
75
|
eslint-plugin-typescript-sort-keys \
|
|
72
76
|
nodemon \
|
|
73
77
|
prettier \
|
|
78
|
+
standard-version \
|
|
74
79
|
ts-loader \
|
|
75
80
|
ts-node \
|
|
81
|
+
tsconfig-paths \
|
|
82
|
+
tsconfig-paths-webpack-plugin \
|
|
76
83
|
typescript \
|
|
77
84
|
webpack \
|
|
78
85
|
webpack-cli \
|
|
79
|
-
webpack-node-externals
|
|
80
|
-
@types/express \
|
|
81
|
-
@types/morgan \
|
|
82
|
-
@types/swagger-ui-express \
|
|
83
|
-
@types/http-errors \
|
|
84
|
-
standard-version`
|
|
86
|
+
webpack-node-externals`
|
|
85
87
|
|
|
86
88
|
bar.start(process, i)
|
|
87
89
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthonylzq/simba.js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "set up a modern backend app by running one command",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"directories": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"service": "node ./bin",
|
|
12
12
|
"release": "standard-version",
|
|
13
|
-
"test": "npm run rm && node ./bin -a AnthonyLzq -e sluzquinosa@uni.pe -
|
|
13
|
+
"test": "npm run rm && node ./bin -N example -D 'This is a test' -a AnthonyLzq -e sluzquinosa@uni.pe -l mit -H",
|
|
14
14
|
"lint": "eslint --ext js lib/ --fix",
|
|
15
15
|
"rm": "if [ -d \"example\" ]; then rm -rf example; fi"
|
|
16
16
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"yargs": "^17.3.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"eslint": "^
|
|
40
|
+
"eslint": "^8.4.1",
|
|
41
41
|
"eslint-config-prettier": "^8.3.0",
|
|
42
42
|
"eslint-config-standard": "^16.0.3",
|
|
43
43
|
"eslint-plugin-import": "^2.25.3",
|
package/.eslintrc
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"node": true
|
|
4
|
-
},
|
|
5
|
-
"root": true,
|
|
6
|
-
"plugins": [
|
|
7
|
-
"import",
|
|
8
|
-
"prettier"
|
|
9
|
-
],
|
|
10
|
-
"extends": [
|
|
11
|
-
"standard",
|
|
12
|
-
"eslint:recommended",
|
|
13
|
-
"prettier"
|
|
14
|
-
],
|
|
15
|
-
"rules": {
|
|
16
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
17
|
-
"arrow-parens": [
|
|
18
|
-
"error",
|
|
19
|
-
"as-needed"
|
|
20
|
-
],
|
|
21
|
-
"import/no-extraneous-dependencies": [
|
|
22
|
-
"error",
|
|
23
|
-
{
|
|
24
|
-
"devDependencies": true
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"max-len": [
|
|
28
|
-
"error",
|
|
29
|
-
{
|
|
30
|
-
"code": 80,
|
|
31
|
-
"ignoreComments": true,
|
|
32
|
-
"ignoreRegExpLiterals": true,
|
|
33
|
-
"ignoreTemplateLiterals": true,
|
|
34
|
-
"ignoreTrailingComments": true,
|
|
35
|
-
"ignoreStrings": true,
|
|
36
|
-
"ignoreUrls": true
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
"newline-before-return": "error",
|
|
40
|
-
"object-curly-spacing": [
|
|
41
|
-
"error",
|
|
42
|
-
"always"
|
|
43
|
-
],
|
|
44
|
-
"prefer-const": "error",
|
|
45
|
-
"prettier/prettier": [
|
|
46
|
-
"error",
|
|
47
|
-
{
|
|
48
|
-
"arrowParens": "avoid",
|
|
49
|
-
"bracketSpacing": true,
|
|
50
|
-
"printWidth": 80,
|
|
51
|
-
"quoteProps": "as-needed",
|
|
52
|
-
"semi": false,
|
|
53
|
-
"singleQuote": true,
|
|
54
|
-
"tabWidth": 2,
|
|
55
|
-
"trailingComma": "none"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
"radix": [
|
|
59
|
-
"error",
|
|
60
|
-
"as-needed"
|
|
61
|
-
],
|
|
62
|
-
"spaced-comment": ["error", "always"]
|
|
63
|
-
}
|
|
64
|
-
}
|