generated from Gabb-c/node-ts-lib-setup
-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: enhance Husky hooks and pre-commit script
- Loading branch information
Showing
7 changed files
with
101 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,19 @@ | ||
#!/bin/sh | ||
# Husky pre-commit hook to check commit messages using commitlint. | ||
|
||
# Load Husky | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
echo "Checking commit message 📝" | ||
# Display a message indicating that commit message check is in progress | ||
echo "Checking commit message..." | ||
|
||
# Run commitlint with the provided commit message | ||
pnpm commitlint --edit $1 -v | ||
|
||
# Check the exit status of the previous command | ||
if [ $? -ne 0 ]; then | ||
echo "❌ Commit message check failed. Please follow the commit message conventions." | ||
exit 1 | ||
else | ||
echo "✅ Commit message check passed. Proceeding with the commit." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
#!/usr/bin/env sh | ||
# Husky pre-commit hook to run lint-staged using pnpm. | ||
|
||
# Load Husky | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
# Display a message indicating that lint-staged is running | ||
echo "Running lint-staged..." | ||
|
||
# Run lint-staged with pnpm | ||
pnpm lint-staged | ||
|
||
# Check the exit status of the previous command | ||
if [ $? -ne 0 ]; then | ||
echo "❌ lint-staged check failed. Please fix the issues before committing." | ||
exit 1 | ||
else | ||
echo "✅ lint-staged check passed. Proceeding with the commit." | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,49 @@ | ||
{ | ||
"compilerOptions": { | ||
// Specifies the ECMAScript target version (latest features). | ||
"target": "ESNext", | ||
"lib": [ | ||
"ESNext" | ||
], | ||
// An array of library files to include in the compilation. | ||
"lib": ["ESNext"], | ||
// Allows JavaScript files to be included in the project. | ||
"allowJs": true, | ||
// Skips type checking of declaration files. | ||
"skipLibCheck": true, | ||
// Enables all strict type-checking options. | ||
"strict": true, | ||
// Prevents TypeScript from emitting output files (e.g., JavaScript files). | ||
"noEmit": true, | ||
// Adds `undefined` to the type of an indexing operation for possibly undefined objects. | ||
"noUncheckedIndexedAccess": true, | ||
// Ensures that the casing of referenced file names matches the casing of the actual file. | ||
"forceConsistentCasingInFileNames": true, | ||
// Generates corresponding `.d.ts` files for TypeScript files. | ||
"declaration": false, | ||
// Allows default imports from modules with no default export. | ||
"esModuleInterop": true, | ||
// Specifies the module code generation. | ||
"module": "ESNext", | ||
// Specifies how modules are resolved. | ||
"moduleResolution": "Bundler", | ||
// Enables experimental support for decorators. | ||
"experimentalDecorators": true, | ||
// Enables the metadata reflection for decorators. | ||
"emitDecoratorMetadata": true, | ||
// Allows importing JSON files as modules. | ||
"resolveJsonModule": true, | ||
// Transforms each file as a separate module, which can help catch more errors. | ||
"isolatedModules": true, | ||
// Specifies the base directory for resolving non-relative module names. | ||
"baseUrl": ".", | ||
// Defines path mappings for module names. | ||
"paths": { | ||
"@clients": [ | ||
"src/clients/index.ts" | ||
], | ||
"@config": [ | ||
"src/config/index.ts" | ||
], | ||
"@constants": [ | ||
"src/constants/index.ts" | ||
], | ||
"@models": [ | ||
"src/models/index.ts" | ||
], | ||
"@clients": ["src/clients/index.ts"], | ||
"@config": ["src/config/index.ts"], | ||
"@constants": ["src/constants/index.ts"], | ||
"@models": ["src/models/index.ts"], | ||
} | ||
}, | ||
"include": [ | ||
"src/**/*" | ||
], | ||
"exclude": [ | ||
"node_modules", | ||
"**/*.spec.ts", | ||
"**/*.test.ts" | ||
] | ||
// Specifies the files to include in the compilation. | ||
"include": ["src/**/*"], | ||
// Specifies files to be excluded from the compilation. | ||
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters