Skip to content

Commit da9b46a

Browse files
Merge pull request #108 from vndevteam/develop
feat: merge develop into main
2 parents 11c9403 + 06ed4dd commit da9b46a

File tree

9 files changed

+220
-115
lines changed

9 files changed

+220
-115
lines changed

.husky/pre-commit

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env sh
2-
31
BRANCH=$(git rev-parse --abbrev-ref HEAD)
42
REGEX="^(feature|bugfix|hotfix|release|merge)\.([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*)$"
53

.husky/pre-push

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env sh
21
GREEN='\033[0;32m'
32
BLUE='\033[0;34m'
43
NC='\033[0m'

.vscode/launch.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Nest Debug",
6+
"request": "launch",
7+
"runtimeArgs": ["start:debug"],
8+
"autoAttachChildProcesses": true,
9+
"console": "integratedTerminal",
10+
"runtimeExecutable": "pnpm",
11+
"skipFiles": ["<node_internals>/**"],
12+
"type": "node"
13+
}
14+
]
15+
}

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ $ pnpm run start:prod
7272
- [x] Docker.
7373
- [x] CI (Github Actions).
7474

75+
## References
76+
77+
- [Awesome Nest Boilerplate](https://github.com/NarHakobyan/awesome-nest-boilerplate)
78+
- [Brocoders NestJS Boilerplate](https://github.com/brocoders/nestjs-boilerplate)
79+
7580
## Support
7681

7782
[Discuss on Github](https://github.com/vndevteam/nestjs-boilerplate/discussions)

docs/README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# NestJS Boilerplate
1+
# NestJS Boilerplate Documentation
2+
3+
- [Setup & Development](development.md)
4+
- [Architecture](architecture.md)
5+
- [Database](database.md)
6+
- [Security](security.md)
7+
- [Testing](testing.md)
8+
- [Deployment](deployment.md)
9+
- [Techniques](techniques.md)
10+
- [Troubleshooting](troubleshooting.md)
11+
- Convention
12+
- [Naming cheatsheet](conventions/naming-cheatsheet.md)
13+
- [TypeScript Style Guide and Coding Conventions](conventions/styleguide.md)
14+
- [Clean code Typescript](conventions/clean-code-typescript.md)
15+
- [Branch conventions](conventions/branch-conventions.md)
16+
- [Commit conventions](conventions/commit-conventions.md)
17+
- [Linting & formatting](conventions/linting.md)

docs/conventions/linting.md

+28-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
# Linting & formatting
22

3-
We use `prettier` to format the code
3+
This project uses [Typescript Eslint](https://typescript-eslint.io/), and [Prettier](https://prettier.io/) to catch errors and avoid bike-shedding by enforcing a common code style.
44

5-
## Prettier
5+
## Languages
66

7-
<!-- prettier-ignore-start -->
7+
- **Typescript** is linted by Typescript Eslint and formatted by Prettier
8+
- **JSON** is formatted by Prettier
89

9-
- Semicolons
10+
## Scripts
1011

11-
```ts
12-
// bad ❌
13-
const foo = 1
12+
There are a few different contexts in which the linters run.
1413

15-
// good ✅
16-
const foo = 1;
14+
### Terminal
15+
16+
```bash
17+
# Lint all files, fixing many violations automatically
18+
pnpm lint
1719
```
1820

19-
<!-- prettier-ignore-end -->
21+
See `package.json` to update.
22+
23+
### Pre-commit
24+
25+
Staged files are automatically linted and tested before each commit. See `lint-staged.config.mjs` to update.
26+
27+
### Editor
28+
29+
In supported editors, all files will be linted and show under the linter errors section.
30+
31+
## Configuration
32+
33+
- [ESLint](https://eslint.org/docs/latest/use/configure/)
34+
- `eslint.config.mjs`
35+
36+
- [Prettier](https://prettier.io/docs/en/configuration.html)
37+
- `.prettierrc`

docs/testing.md

+54
Original file line numberDiff line numberDiff line change
@@ -1 +1,55 @@
11
# Testing
2+
3+
We use **Jest** for comprehensive unit testing in our NestJS project. Below are the various commands and methods you can use to run tests effectively.
4+
5+
## Running All Tests
6+
7+
Execute all test cases across the project using:
8+
9+
```bash
10+
pnpm test
11+
```
12+
13+
## Running a Specific Test File
14+
15+
To run tests in a specific file, use the following command:
16+
17+
```bash
18+
pnpm test path/to/file
19+
20+
# example: pnpm test src/api/auth/auth.controller.spec.ts
21+
```
22+
23+
## Running End-to-End (e2e) Tests
24+
25+
End-to-end tests can be executed using:
26+
27+
```bash
28+
pnpm test:e2e
29+
```
30+
31+
## Running Tests in Watch Mode
32+
33+
For continuous testing, enabling watch mode allows you to re-run tests automatically upon file changes:
34+
35+
```bash
36+
pnpm test:watch
37+
```
38+
39+
## Running Tests with Coverage
40+
41+
To generate a code coverage report, use the command:
42+
43+
```bash
44+
pnpm test:cov
45+
```
46+
47+
## Running Tests in IDE
48+
49+
### Visual Studio Code
50+
51+
For a seamless testing experience within Visual Studio Code, install the [Jest Runner](https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner) extension. This extension allows you to run tests directly from the test file, streamlining the development process.
52+
53+
![Jest Runner](https://github.com/firsttris/vscode-jest/raw/master/public/vscode-jest.gif)
54+
55+
By following this guide, you can ensure a robust testing workflow, leading to more reliable and maintainable code.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"@nestjs/schematics": "10.1.2",
6767
"@nestjs/testing": "10.3.10",
6868
"@swc/cli": "0.4.0",
69-
"@swc/core": "1.6.13",
69+
"@swc/core": "1.7.0",
7070
"@types/compression": "1.7.5",
7171
"@types/eslint__js": "8.42.3",
7272
"@types/express": "4.17.21",
@@ -83,7 +83,7 @@
8383
"eslint": "9.7.0",
8484
"eslint-config-prettier": "9.1.0",
8585
"eslint-plugin-prettier": "5.2.1",
86-
"husky": "9.1.0",
86+
"husky": "9.1.1",
8787
"jest": "29.7.0",
8888
"lint-staged": "15.2.7",
8989
"prettier": "3.3.3",

0 commit comments

Comments
 (0)