lint pretty
This commit is contained in:
parent
c3aab70f19
commit
f52792c999
|
@ -2,7 +2,7 @@ module.exports = {
|
||||||
parser: '@typescript-eslint/parser',
|
parser: '@typescript-eslint/parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
project: 'tsconfig.json',
|
project: 'tsconfig.json',
|
||||||
tsconfigRootDir : __dirname,
|
tsconfigRootDir: __dirname,
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
plugins: ['@typescript-eslint/eslint-plugin'],
|
plugins: ['@typescript-eslint/eslint-plugin'],
|
||||||
|
|
|
@ -12,7 +12,7 @@ test:
|
||||||
stage: test
|
stage: test
|
||||||
image: docker/compose:latest
|
image: docker/compose:latest
|
||||||
variables:
|
variables:
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ''
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
script:
|
script:
|
||||||
|
@ -22,7 +22,7 @@ test:
|
||||||
- docker exec -t v3-user-api sh -c "npm run test:integration:ci"
|
- docker exec -t v3-user-api sh -c "npm run test:integration:ci"
|
||||||
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
|
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
|
||||||
rules:
|
rules:
|
||||||
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
@ -33,7 +33,7 @@ build:
|
||||||
stage: build
|
stage: build
|
||||||
image: docker:20.10.22
|
image: docker:20.10.22
|
||||||
variables:
|
variables:
|
||||||
DOCKER_TLS_CERTDIR: ""
|
DOCKER_TLS_CERTDIR: ''
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
before_script:
|
before_script:
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
node_modules
|
||||||
|
*.log*
|
||||||
|
.env
|
||||||
|
dist
|
||||||
|
coverage
|
||||||
|
.prettierrc.json
|
19
README.md
19
README.md
|
@ -14,7 +14,7 @@ A RabbitMQ instance is also required to send / receive messages when data has be
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
- copy `.env.dist` to `.env` :
|
- copy `.env.dist` to `.env` :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp .env.dist .env
|
cp .env.dist .env
|
||||||
|
@ -22,13 +22,13 @@ A RabbitMQ instance is also required to send / receive messages when data has be
|
||||||
|
|
||||||
Modify it if needed.
|
Modify it if needed.
|
||||||
|
|
||||||
- install the dependencies :
|
- install the dependencies :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
- start the containers :
|
- start the containers :
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
@ -36,7 +36,6 @@ A RabbitMQ instance is also required to send / receive messages when data has be
|
||||||
|
|
||||||
The app runs automatically on port **5001**.
|
The app runs automatically on port **5001**.
|
||||||
|
|
||||||
|
|
||||||
## Database migration
|
## Database migration
|
||||||
|
|
||||||
Before using the app, you need to launch the database migration (it will be launched inside the container) :
|
Before using the app, you need to launch the database migration (it will be launched inside the container) :
|
||||||
|
@ -107,10 +106,10 @@ As mentionned earlier, RabbitMQ messages are sent after these events :
|
||||||
|
|
||||||
Various messages are also sent for logging purpose.
|
Various messages are also sent for logging purpose.
|
||||||
|
|
||||||
## Tests
|
## Tests / ESLint / Prettier
|
||||||
|
|
||||||
Tests are run outside the container for ease of use (switching between different environments inside containers using prisma is complicated and error prone).
|
Tests are run outside the container for ease of use (switching between different environments inside containers using prisma is complicated and error prone).
|
||||||
The integration tests use a dedicated database (see *db-test* section of *docker-compose.yml*).
|
The integration tests use a dedicated database (see _db-test_ section of _docker-compose.yml_).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# run all tests (unit + integration)
|
# run all tests (unit + integration)
|
||||||
|
@ -124,6 +123,12 @@ npm run test:integration
|
||||||
|
|
||||||
# coverage
|
# coverage
|
||||||
npm run test:cov
|
npm run test:cov
|
||||||
|
|
||||||
|
# ESLint
|
||||||
|
npm run lint
|
||||||
|
|
||||||
|
# Prettier
|
||||||
|
npm run pretty
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
|
@ -25,5 +25,9 @@ RUN npm run build
|
||||||
# Run unit tests
|
# Run unit tests
|
||||||
RUN npm run test:unit:ci
|
RUN npm run test:unit:ci
|
||||||
|
|
||||||
|
# ESLint / Prettier
|
||||||
|
RUN npm run lint:check
|
||||||
|
RUN npm run pretty:check
|
||||||
|
|
||||||
# Start the server
|
# Start the server
|
||||||
CMD [ "node", "dist/main.js" ]
|
CMD [ "node", "dist/main.js" ]
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
"start:debug": "nest start --debug --watch",
|
"start:debug": "nest start --debug --watch",
|
||||||
"start:prod": "node dist/main",
|
"start:prod": "node dist/main",
|
||||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
|
"lint:check": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix-dry-run --ignore-path .gitignore",
|
||||||
|
"pretty:check": "./node_modules/.bin/prettier --check .",
|
||||||
|
"pretty": "./node_modules/.bin/prettier --write .",
|
||||||
"test": "npm run migrate:test && dotenv -e .env.test jest",
|
"test": "npm run migrate:test && dotenv -e .env.test jest",
|
||||||
"test:unit": "jest --testPathPattern 'tests/unit/' --verbose",
|
"test:unit": "jest --testPathPattern 'tests/unit/' --verbose",
|
||||||
"test:unit:ci": "jest --testPathPattern 'tests/unit/' --coverage",
|
"test:unit:ci": "jest --testPathPattern 'tests/unit/' --coverage",
|
||||||
|
|
Loading…
Reference in New Issue