@anthonylzq/simba.js 1.9.1 → 2.0.2

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
@@ -6,7 +6,7 @@ Set up a modern backend app by running one command. This project has the goal to
6
6
 
7
7
  - `.env`
8
8
  - `.eslintignore`
9
- - `.eslintrc.js`
9
+ - `.eslintrc`
10
10
  - `.gitignore`
11
11
  - `CHANGELOG.md`
12
12
  - `Dockerfile`
@@ -15,15 +15,17 @@ Set up a modern backend app by running one command. This project has the goal to
15
15
  - `nodemon.json`
16
16
  - `package.json`
17
17
  - `README.md`
18
+ - `tsconfig.base.json`
18
19
  - `tsconfig.json`
19
20
  - `webpack.config.js`
21
+ - `yarn.lock` (or `package-lock.json`)
20
22
 
21
23
  ## Installation
22
24
 
23
25
  This package is meant to be installed globally in your computer by using:
24
26
 
25
27
  ```bash
26
- npm i -g simba.js
28
+ npm i -g @anthonylzq/simba.js
27
29
  ```
28
30
 
29
31
  ## Usage
@@ -86,8 +88,8 @@ Options:
86
88
  -h, --help Show help [boolean]
87
89
 
88
90
  Examples:
89
- simba -N "Project Name" -D "Project description -a Anthony -e
90
- sluzquinosa@uni.pe"
91
+ simba -N 'Project Name' -D 'Project description' -a Anthony -e
92
+ sluzquinosa@uni.pe
91
93
 
92
94
  Developed by AnthonyLzq
93
95
  ```
@@ -95,34 +97,56 @@ Developed by AnthonyLzq
95
97
  Regardless of the option chosen, a new folder will be generated with the name of the project, it will contain the following structure:
96
98
 
97
99
  ```
98
- 📦node_modules
99
- 📦src
100
+ 📂node_modules
101
+ 📂src
100
102
  ┣ 📂@types
101
- ┃ ┣ 📜index.d.ts
102
- 📂controllers
103
- 📜index.ts
104
- 📜user.ts
105
- 📂dto-interfaces
106
- ┃ ┣ 📜index.ts
107
- ┃ ┗ 📜user.dto.ts
108
- 📂models
109
- 📜index.ts
110
- 📜user.ts
103
+ ┃ ┣ 📂custom
104
+ ┃ ┃ 📜request.d.ts
105
+ 📜response.d.ts
106
+ 📂dto
107
+ ┃ ┗ 📜user.d.ts
108
+ ┃ ┣ 📂models
109
+ ┗ 📜user.d.ts
110
+ ┗ 📜index.d.ts
111
+ 📂database
112
+ 📂mongo
113
+ ┃ ┃ ┣ 📂models
114
+ ┃ ┃ ┃ ┣ 📜index.ts
115
+ ┃ ┃ ┃ ┗ 📜user.ts
116
+ ┃ ┃ ┣ 📂queries
117
+ ┃ ┃ ┃ ┣ 📜index.ts
118
+ ┃ ┃ ┃ ┗ 📜user.ts
119
+ ┃ ┃ ┗ 📜index.ts
120
+ ┃ ┗ 📜index.ts
111
121
  ┣ 📂network
122
+ ┃ ┣ 📂routes
123
+ ┃ ┃ ┣ 📂schemas
124
+ ┃ ┃ ┃ ┣ 📜index.ts
125
+ ┃ ┃ ┃ ┗ 📜user.ts
126
+ ┃ ┃ ┣ 📜home.ts
127
+ ┃ ┃ ┣ 📜index.ts
128
+ ┃ ┃ ┗ 📜user.ts
112
129
  ┃ ┣ 📜index.ts
130
+ ┃ ┣ 📜response.ts
113
131
  ┃ ┣ 📜routes.ts
114
132
  ┃ ┗ 📜server.ts
115
- ┣ 📂routes
116
- ┃ ┣ 📜home.ts
133
+ ┣ 📂services
134
+ ┃ ┣ 📂utils
135
+ ┃ ┃ ┣ 📂messages
136
+ ┃ ┃ ┃ ┣ 📜index.ts
137
+ ┃ ┃ ┃ ┗ 📜user.ts
138
+ ┃ ┃ ┗ 📜index.ts
117
139
  ┃ ┣ 📜index.ts
118
140
  ┃ ┗ 📜user.ts
141
+ ┣ 📂test
142
+ ┃ ┗ 📜test.http
119
143
  ┣ 📂utils
120
- ┃ ┣ 📜index.ts
121
- ┃ ┗ 📜response.ts
144
+ ┃ ┣ 📜docs.json
145
+ ┃ ┗ 📜index.ts
122
146
  ┗ 📜index.ts
123
147
  📜.env
124
148
  📜.eslintignore
125
- 📜.eslintrc.js
149
+ 📜.eslintrc
126
150
  📜.gitignore
127
151
  📜CHANGELOG.md
128
152
  📜Dockerfile
@@ -131,6 +155,7 @@ Regardless of the option chosen, a new folder will be generated with the name of
131
155
  📜nodemon.json
132
156
  📜package.json
133
157
  📜README.md
158
+ 📜tsconfig.base.json
134
159
  📜tsconfig.json
135
160
  📜webpack.config.js
136
161
  📜yarn.lock (or package-lock.json)
@@ -160,8 +185,8 @@ simba -N myProject -D 'This is a test' -a myName -e myEmail@email.com -H
160
185
 
161
186
  ### Some considerations
162
187
 
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.
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`).
188
+ - This project was based in other project from my own, [`typescript-project-generator`](https://www.npmjs.com/package/typescript-project-generator), but only considering the `express-mongoose` part.
189
+ - You are able to run a server that has one main route, `home` (`/`), `user` (`api/user` or `api/user/:id`) and `docs` (`api/docs`).
165
190
  - 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
191
 
167
192
  ```bash
@@ -182,11 +207,16 @@ simba -N myProject -D 'This is a test' -a myName -e myEmail@email.com -H
182
207
  // Some more code...
183
208
 
184
209
  // another file
185
- globalStringVariable = 'Hi mom, I am global'
210
+ global.globalStringVariable = 'Hi mom, I am global'
186
211
  console.log({ globalStringVariable })
187
212
  ```
188
213
 
189
- - The provided project structure is inspired in my personal experience as [`Node.js`](https://nodejs.org/en/) developer and the [`Nest`](https://nestjs.com/) framework.
214
+ - The provided project structure is inspired in my personal experience as [`Node.js`](https://nodejs.org/en/) developer and the [`Nest`](https://nestjs.com/) framework. It follows a layered architecture:
215
+
216
+ 1. Presentation layer (network layer): it is represented by the network folder, which contains the routes and the necessary schemas for each route.
217
+ 2. Business layer (services layer): it is represented by the services folder, which contains all the code related to the business logic of your application.
218
+ 3. Persistance layer (database layer): it is represented by the database folder, which contains the database connection, models and queries (that will be used by the services). Multiple database connection are possible and should be implemented here.
219
+
190
220
  - The server is fully tested and has no errors (at least for now), feel free to report one [here](https://github.com/AnthonyLzq/simba.js/issues).
191
221
  - Support for windows and linux platforms is available.
192
222
  - To check the content of the files generated, please check the `example` folder.
@@ -215,8 +245,6 @@ Here is the list of the packages that are being installed, as `devDependencies`:
215
245
  - [`eslint-config-standard`](https://www.npmjs.com/package/eslint-config-standard)
216
246
  - [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import)
217
247
  - [`eslint-plugin-prettier`](https://www.npmjs.com/package/eslint-plugin-prettier)
218
- - [`eslint-plugin-sort-keys-fix`](https://www.npmjs.com/package/eslint-plugin-sort-keys-fix)
219
- - [`eslint-plugin-typescript-sort-keys`](https://www.npmjs.com/package/eslint-plugin-typescript-sort-keys)
220
248
  - [`nodemon`](https://www.npmjs.com/package/nodemon)
221
249
  - [`prettier`](https://www.npmjs.com/package/prettier)
222
250
  - [`standard-version`](https://www.npmjs.com/package/standard-version)
package/lib/index.js CHANGED
@@ -12,7 +12,7 @@ const argv = yargs(hideBin(process.argv))
12
12
  'simba [options] (if you it installed globally) or only simba if you want to be asked for the options one by one'
13
13
  )
14
14
  .example(
15
- 'simba -N "Project Name" -D "Project description -a Anthony -e sluzquinosa@uni.pe"'
15
+ "simba -N 'Project Name' -D 'Project description' -a Anthony -e sluzquinosa@uni.pe"
16
16
  )
17
17
  .alias('N', 'projectName')
18
18
  .nargs('N', 1)
@@ -14,11 +14,11 @@ COPY package.json ./
14
14
 
15
15
  RUN yarn install --prod
16
16
 
17
- RUN yarn add webpack webpack-node-externals -D
17
+ RUN yarn add webpack webpack-node-externals tsconfig-paths-webpack-plugin -D
18
18
 
19
19
  RUN yarn build
20
20
 
21
- RUN yarn remove webpack webpack-node-externals
21
+ RUN yarn remove webpack webpack-node-externals tsconfig-paths-webpack-plugin
22
22
 
23
23
  COPY dist /app/dist
24
24
 
@@ -74,7 +74,7 @@ module.exports = async projectName => {
74
74
  }
75
75
  }
76
76
  `,
77
- eslintFile: '.eslintrc.js',
77
+ eslintFile: '.eslintrc',
78
78
  eslintIgnoreContent: '/dist',
79
79
  eslintIgnoreFile: '.eslintignore'
80
80
  }