Feature/set up husky and pre-commit hook for linting and format check (#3867)
* Set up husky and pre-commit hook for linting and format check * Update changelog --------- Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
6
.husky/pre-commit
Normal file
6
.husky/pre-commit
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Run linting and stop the commit process if any errors are found
|
||||||
|
# --quiet suppresses warnings (temporary until all warnings are fixed)
|
||||||
|
npm run lint --quiet || exit 1
|
||||||
|
|
||||||
|
# Check formatting on modified and uncommitted files, stop the commit if issues are found
|
||||||
|
npm run format:check --uncommitted || exit 1
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Set up a git-hook via `husky` to lint and format the changes before a commit
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
- Handled an exception in the historical market data gathering of derived currencies
|
- Handled an exception in the historical market data gathering of derived currencies
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
1. Run `npm install`
|
1. Run `npm install`
|
||||||
1. Run `docker compose --env-file ./.env -f docker/docker-compose.dev.yml up -d` to start [PostgreSQL](https://www.postgresql.org) and [Redis](https://redis.io)
|
1. Run `docker compose --env-file ./.env -f docker/docker-compose.dev.yml up -d` to start [PostgreSQL](https://www.postgresql.org) and [Redis](https://redis.io)
|
||||||
1. Run `npm run database:setup` to initialize the database schema
|
1. Run `npm run database:setup` to initialize the database schema
|
||||||
1. Run `git config core.hooksPath ./git-hooks/` to setup git hooks
|
|
||||||
1. Start the [server](#start-server) and the [client](#start-client)
|
1. Start the [server](#start-server) and the [client](#start-client)
|
||||||
1. Open https://localhost:4200/en in your browser
|
1. Open https://localhost:4200/en in your browser
|
||||||
1. Create a new user via _Get Started_ (this first user will get the role `ADMIN`)
|
1. Create a new user via _Get Started_ (this first user will get the role `ADMIN`)
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Will check if "npm run format" is run before executing.
|
|
||||||
# Called by "git commit" with no arguments. The hook should
|
|
||||||
# exit with non-zero status after issuing an appropriate message if
|
|
||||||
# it wants to stop the commit.
|
|
||||||
|
|
||||||
echo "Running npm run format"
|
|
||||||
|
|
||||||
# Run the command and loop over its output
|
|
||||||
FILES_TO_STAGE=""
|
|
||||||
i=0
|
|
||||||
while IFS= read -r line; do
|
|
||||||
# Process each line here
|
|
||||||
((i++))
|
|
||||||
if [ $i -le 2 ]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [[ $line == Done* ]]; then
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
FILES_TO_STAGE="$FILES_TO_STAGE $line"
|
|
||||||
|
|
||||||
done < <(npm run format)
|
|
||||||
git add $FILES_TO_STAGE
|
|
||||||
echo "Files formatted. Committing..."
|
|
16
package-lock.json
generated
16
package-lock.json
generated
@ -143,6 +143,7 @@
|
|||||||
"eslint-plugin-cypress": "2.15.1",
|
"eslint-plugin-cypress": "2.15.1",
|
||||||
"eslint-plugin-import": "2.29.1",
|
"eslint-plugin-import": "2.29.1",
|
||||||
"eslint-plugin-storybook": "0.6.15",
|
"eslint-plugin-storybook": "0.6.15",
|
||||||
|
"husky": "9.1.6",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"jest-environment-jsdom": "29.7.0",
|
"jest-environment-jsdom": "29.7.0",
|
||||||
"jest-preset-angular": "14.1.0",
|
"jest-preset-angular": "14.1.0",
|
||||||
@ -20653,6 +20654,21 @@
|
|||||||
"node": ">=8.12.0"
|
"node": ">=8.12.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/husky": {
|
||||||
|
"version": "9.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/husky/-/husky-9.1.6.tgz",
|
||||||
|
"integrity": "sha512-sqbjZKK7kf44hfdE94EoX8MZNk0n7HeW37O4YrVGCF4wzgQjp+akPAkfUK5LZ6KuR/6sqeAVuXHji+RzQgOn5A==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"husky": "bin.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/typicode"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/hyperdyperid": {
|
"node_modules/hyperdyperid": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/hyperdyperid/-/hyperdyperid-1.2.0.tgz",
|
||||||
|
@ -33,10 +33,11 @@
|
|||||||
"format:check": "nx format:check",
|
"format:check": "nx format:check",
|
||||||
"format:write": "nx format:write",
|
"format:write": "nx format:write",
|
||||||
"help": "nx help",
|
"help": "nx help",
|
||||||
"lint": "nx lint",
|
"lint": "nx run-many --target=lint --all",
|
||||||
"ng": "nx",
|
"ng": "nx",
|
||||||
"nx": "nx",
|
"nx": "nx",
|
||||||
"postinstall": "prisma generate",
|
"postinstall": "prisma generate",
|
||||||
|
"prepare": "husky",
|
||||||
"prisma": "prisma",
|
"prisma": "prisma",
|
||||||
"replace-placeholders-in-build": "node ./replace.build.js",
|
"replace-placeholders-in-build": "node ./replace.build.js",
|
||||||
"start": "node dist/apps/api/main",
|
"start": "node dist/apps/api/main",
|
||||||
@ -188,6 +189,7 @@
|
|||||||
"eslint-plugin-cypress": "2.15.1",
|
"eslint-plugin-cypress": "2.15.1",
|
||||||
"eslint-plugin-import": "2.29.1",
|
"eslint-plugin-import": "2.29.1",
|
||||||
"eslint-plugin-storybook": "0.6.15",
|
"eslint-plugin-storybook": "0.6.15",
|
||||||
|
"husky": "9.1.6",
|
||||||
"jest": "29.7.0",
|
"jest": "29.7.0",
|
||||||
"jest-environment-jsdom": "29.7.0",
|
"jest-environment-jsdom": "29.7.0",
|
||||||
"jest-preset-angular": "14.1.0",
|
"jest-preset-angular": "14.1.0",
|
||||||
|
Reference in New Issue
Block a user