Skip to content

Commit 514dee8

Browse files
committed
feat: utils
1 parent 8d42915 commit 514dee8

File tree

3 files changed

+96
-53
lines changed

3 files changed

+96
-53
lines changed

.husky/pre-commit

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
3+
# This script is an example of how a pre-commit hook might be set up
4+
# to execute pre-commit scripts from @krauters/utils.
5+
#
6+
# Prerequisite: Make sure to install @krauters/utils and ts-node in your project
7+
# npm install --save-dev @krauters/utils ts-node
8+
9+
RED='\033[1;31m'
10+
GREEN='\033[1;32m'
11+
NC='\033[0m'
12+
13+
PREFIX='[CHECKS]'
14+
15+
log() {
16+
echo '${GREEN}${PREFIX}${NC} $1'
17+
}
18+
19+
error() {
20+
echo '${RED}${PREFIX}${NC} $1'
21+
}
22+
23+
log 'Running pre-commit scripts...'
24+
25+
if ! OUTPUT=$(npx ts-node ./node_modules/@krauters/utils/src/scripts/pre-commit.ts 2>&1); then
26+
error "Pre-commit check failed:\n\n${OUTPUT}\n"
27+
error 'Aborting commit.'
28+
error 'Run commit with '-n' to skip pre-commit hooks.'
29+
exit 1
30+
fi
31+
32+
log "Script output...\n\n${OUTPUT}\n"
33+
log 'Pre-commit checks passed.'
34+
exit 0

package-lock.json

Lines changed: 59 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@krauters/typescript-core",
33
"description": "A TypeScript Repository that stands as a starting point for all other TypeScript repositories.",
4-
"version": "1.0.0",
4+
"version": "1.1.0",
55
"main": "app.ts",
66
"type": "commonjs",
77
"scripts": {
@@ -25,13 +25,14 @@
2525
"devDependencies": {
2626
"@jest/globals": "^29.7.0",
2727
"@krauters/eslint-config": "^0.6.0",
28+
"@krauters/utils": "^0.1.1",
2829
"@types/jest": "^29.5.13",
2930
"husky": "^9.1.6",
3031
"jest": "^29.7.0",
3132
"nodemon": "^3.1.7",
3233
"ts-jest": "^29.2.5",
3334
"ts-node": "^10.9.2",
3435
"typescript": "^5.6.2",
35-
"typescript-eslint": "^8.7.0"
36+
"typescript-eslint": "^8.8.0"
3637
}
3738
}

0 commit comments

Comments
 (0)