Skip to content

Commit

Permalink
feat: utils
Browse files Browse the repository at this point in the history
  • Loading branch information
coltenkrauter committed Sep 30, 2024
1 parent 8d42915 commit 514dee8
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 53 deletions.
34 changes: 34 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

# This script is an example of how a pre-commit hook might be set up
# to execute pre-commit scripts from @krauters/utils.
#
# Prerequisite: Make sure to install @krauters/utils and ts-node in your project
# npm install --save-dev @krauters/utils ts-node

RED='\033[1;31m'
GREEN='\033[1;32m'
NC='\033[0m'

PREFIX='[CHECKS]'

log() {
echo '${GREEN}${PREFIX}${NC} $1'
}

error() {
echo '${RED}${PREFIX}${NC} $1'
}

log 'Running pre-commit scripts...'

if ! OUTPUT=$(npx ts-node ./node_modules/@krauters/utils/src/scripts/pre-commit.ts 2>&1); then
error "Pre-commit check failed:\n\n${OUTPUT}\n"
error 'Aborting commit.'
error 'Run commit with '-n' to skip pre-commit hooks.'
exit 1
fi

log "Script output...\n\n${OUTPUT}\n"
log 'Pre-commit checks passed.'
exit 0
110 changes: 59 additions & 51 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@krauters/typescript-core",
"description": "A TypeScript Repository that stands as a starting point for all other TypeScript repositories.",
"version": "1.0.0",
"version": "1.1.0",
"main": "app.ts",
"type": "commonjs",
"scripts": {
Expand All @@ -25,13 +25,14 @@
"devDependencies": {
"@jest/globals": "^29.7.0",
"@krauters/eslint-config": "^0.6.0",
"@krauters/utils": "^0.1.1",
"@types/jest": "^29.5.13",
"husky": "^9.1.6",
"jest": "^29.7.0",
"nodemon": "^3.1.7",
"ts-jest": "^29.2.5",
"ts-node": "^10.9.2",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
"typescript-eslint": "^8.8.0"
}
}

0 comments on commit 514dee8

Please sign in to comment.