From 3a7e82443c23e2413875ccd1f0f2787cca0b96e0 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 6 Mar 2023 18:00:17 +0100 Subject: [PATCH] small changes --- .husky/pre-commit | 2 +- package.json | 19 ++++++++++--------- src/app.ts | 2 +- src/index.ts | 2 +- ...uldCompress.ts => compresssFilter.util.ts} | 4 ++-- 5 files changed, 15 insertions(+), 14 deletions(-) rename src/utils/{shouldCompress.ts => compresssFilter.util.ts} (83%) diff --git a/.husky/pre-commit b/.husky/pre-commit index 5a182ef..d24fdfc 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh . "$(dirname -- "$0")/_/husky.sh" -yarn lint-staged +npx lint-staged diff --git a/package.json b/package.json index 857b1f1..ed0bbad 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "code:format": "prettier --write src/**/*.{ts,css,js,html}", "code:check": "prettier --check src/**/*.{ts,css,js,html}", "code:format:specific-file": "prettier --write ", - "test": "jest" + "test": "jest", + "prepare": "husky install" }, "dependencies": { "bcryptjs": "^2.4.3", @@ -54,9 +55,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-promise": "^6.1.1", "eslint-plugin-standard": "^5.0.0", - "husky": "^8.0.3", "jest": "^29.4.3", - "lint-staged": "^13.1.2", "nodemon": "^2.0.21", "prettier": "^2.8.4", "prettier-eslint": "^15.0.1", @@ -64,11 +63,6 @@ "ts-jest": "^29.0.5", "typescript": "*" }, - "husky": { - "hooks": { - "pre-commit": "pretty-quick --staged" - } - }, "repository": { "type": "git", "url": "" @@ -76,5 +70,12 @@ "bugs": { "url": "" }, - "homepage": "" + "homepage": "", + "lint-staged":{ + "**/*.{js,jsx,ts,tsx}":[ + "npx prettier --write", + "npx eslint --fix", + "npx jest" + ] + } } diff --git a/src/app.ts b/src/app.ts index 4f6eb7a..6fee066 100644 --- a/src/app.ts +++ b/src/app.ts @@ -3,7 +3,7 @@ import * as dotenv from 'dotenv'; import cors from 'cors'; import helmet from 'helmet'; import compression from 'compression'; -import shouldCompress from './utils/shouldCompress'; +import shouldCompress from './utils/compresssFilter.util'; dotenv.config(); diff --git a/src/index.ts b/src/index.ts index 751c827..2273b4a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,6 @@ import * as dotenv from 'dotenv'; import app from './app'; -import logger from './utils/logger'; +import logger from './middleware/logger'; dotenv.config(); diff --git a/src/utils/shouldCompress.ts b/src/utils/compresssFilter.util.ts similarity index 83% rename from src/utils/shouldCompress.ts rename to src/utils/compresssFilter.util.ts index 06d4aea..cebcbbb 100644 --- a/src/utils/shouldCompress.ts +++ b/src/utils/compresssFilter.util.ts @@ -7,7 +7,7 @@ import type { Request, Response } from 'express'; * @param res HTTPs Response * @returns Returns false if request header contains x-no-compression */ -function shouldCompress(req: Request, res: Response): boolean { +function compresssFilter(req: Request, res: Response): boolean { if (req.headers['x-no-compression']) { // don't compress responses with this request header return false; @@ -17,4 +17,4 @@ function shouldCompress(req: Request, res: Response): boolean { return compression.filter(req, res); } -export default shouldCompress; +export default compresssFilter;