Skip to content

Commit 5ad49a0

Browse files
authored
build: Add husky pre-commit hook (#8)
* build: Add husky pre-commit hook * build: Add code formatting with Prettier and update pre-commit hook Signed-off-by: Eden Reich <eden.reich@gmail.com> * build: Add build step to pre-commit hook Signed-off-by: Eden Reich <eden.reich@gmail.com> --------- Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent 200eb12 commit 5ad49a0

File tree

4 files changed

+41
-10
lines changed

4 files changed

+41
-10
lines changed

.husky/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
# Format code
5+
npm run format
6+
# Lint code
7+
npm run lint
8+
# Run build
9+
npm run build
10+
# Run tests
11+
npm test

package-lock.json

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
"build": "tsc",
5050
"test": "jest",
5151
"lint": "eslint src/**/*.ts",
52-
"prepare": "npm run build"
52+
"format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
53+
"prepare": "husky"
5354
},
5455
"devDependencies": {
5556
"@eslint/js": "^9.18.0",
@@ -59,7 +60,9 @@
5960
"@typescript-eslint/parser": "^8.21.0",
6061
"eslint": "^9.18.0",
6162
"eslint-plugin-prettier": "^5.2.3",
63+
"husky": "^9.1.7",
6264
"jest": "^29.7.0",
65+
"prettier": "^3.5.3",
6366
"ts-jest": "^29.2.5",
6467
"typescript": "^5.7.3"
6568
},

tests/client.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,9 @@ describe('InferenceGatewayClient', () => {
387387
id: 'call_123',
388388
type: 'function',
389389
function: {
390-
name: 'get_weather',
391-
arguments: '{"location":"San Francisco, CA"}'
392-
}
390+
name: 'get_weather',
391+
arguments: '{"location":"San Francisco, CA"}',
392+
},
393393
});
394394
expect(callbacks.onFinish).toHaveBeenCalledTimes(1);
395395
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy