diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..fb967d4e --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +npm run db:validate diff --git a/package-lock.json b/package-lock.json index 8b45da90..3587a667 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,6 +6,8 @@ "": { "name": "@iptv-org/database", "dependencies": { + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.16.0", "@freearhey/core": "^0.2.2", "@joi/date": "^2.1.0", "@json2csv/formatters": "^7.0.3", @@ -15,6 +17,7 @@ "@octokit/plugin-paginate-rest": "^6.0.0", "@octokit/plugin-rest-endpoint-methods": "^7.1.3", "@types/jest": "^29.5.5", + "@types/joi": "^17.2.3", "@typescript-eslint/eslint-plugin": "^8.17.0", "chalk": "^4.1.2", "commander": "^9.0.0", @@ -22,18 +25,13 @@ "eslint": "^9.16.0", "eslint-config-prettier": "^9.0.0", "fs-extra": "^11.2.0", + "globals": "^15.13.0", + "husky": "^9.1.7", "jest": "^29.7.0", "joi": "^17.13.3", "ts-jest": "^29.1.1", "tsx": "^4.10.5" }, - "devDependencies": { - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "^9.16.0", - "@types/joi": "^17.2.3", - "globals": "^15.13.0", - "pre-commit": "^1.0.10" - }, "engines": { "node": ">=18.0.0 <=22.12.0" } @@ -2184,7 +2182,6 @@ "resolved": "https://registry.npmjs.org/@types/joi/-/joi-17.2.3.tgz", "integrity": "sha512-dGjs/lhrWOa+eO0HwgxCSnDm5eMGCsXuvLglMghJq32F6q5LyyNuXb41DHzrg501CKNOSSAHmfB7FDGeUnDmzw==", "deprecated": "This is a stub types definition. joi provides its own type definitions, so you do not need this installed.", - "dev": true, "dependencies": { "joi": "*" } @@ -3790,7 +3787,6 @@ "version": "15.13.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", - "dev": true, "engines": { "node": ">=18" }, @@ -3840,6 +3836,20 @@ "node": ">=10.17.0" } }, + "node_modules/husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==", + "bin": { + "husky": "bin.js" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/typicode" + } + }, "node_modules/ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -5329,16 +5339,6 @@ "node": ">=8" } }, - "node_modules/pre-commit": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.0.10.tgz", - "integrity": "sha512-lpS8vLmOuAHSH8v+9GLSyYMplk9oZYLr3caRbsx9BVJzXb+/bI1l45JXAa0x/io732ZwgW2nhV8EeKjqVm7y4Q==", - "dev": true, - "hasInstallScript": true, - "dependencies": { - "shelljs": "0.5.x" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -5540,18 +5540,6 @@ "node": ">=10" } }, - "node_modules/shelljs": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", - "integrity": "sha512-C2FisSSW8S6TIYHHiMHN0NqzdjWfTekdMpA2FJTbRWnQMLO1RRIXEB9eVZYOlofYmjZA7fY3ChoFu09MeI3wlQ==", - "dev": true, - "bin": { - "shjs": "bin/shjs" - }, - "engines": { - "node": ">=0.8.0" - } - }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -7667,7 +7655,6 @@ "version": "17.2.3", "resolved": "https://registry.npmjs.org/@types/joi/-/joi-17.2.3.tgz", "integrity": "sha512-dGjs/lhrWOa+eO0HwgxCSnDm5eMGCsXuvLglMghJq32F6q5LyyNuXb41DHzrg501CKNOSSAHmfB7FDGeUnDmzw==", - "dev": true, "requires": { "joi": "*" } @@ -8756,8 +8743,7 @@ "globals": { "version": "15.13.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.13.0.tgz", - "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==", - "dev": true + "integrity": "sha512-49TewVEz0UxZjr1WYYsWpPrhyC/B/pA8Bq0fUmet2n+eR7yn0IvNzNaoBwnK6mdkzcN+se7Ez9zUgULTz2QH4g==" }, "graceful-fs": { "version": "4.2.9", @@ -8792,6 +8778,11 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==" }, + "husky": { + "version": "9.1.7", + "resolved": "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz", + "integrity": "sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==" + }, "ignore": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", @@ -9891,15 +9882,6 @@ } } }, - "pre-commit": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/pre-commit/-/pre-commit-1.0.10.tgz", - "integrity": "sha512-lpS8vLmOuAHSH8v+9GLSyYMplk9oZYLr3caRbsx9BVJzXb+/bI1l45JXAa0x/io732ZwgW2nhV8EeKjqVm7y4Q==", - "dev": true, - "requires": { - "shelljs": "0.5.x" - } - }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -10014,12 +9996,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==" }, - "shelljs": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz", - "integrity": "sha512-C2FisSSW8S6TIYHHiMHN0NqzdjWfTekdMpA2FJTbRWnQMLO1RRIXEB9eVZYOlofYmjZA7fY3ChoFu09MeI3wlQ==", - "dev": true - }, "signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", diff --git a/package.json b/package.json index 4de3cfb7..2fa1f69f 100644 --- a/package.json +++ b/package.json @@ -8,14 +8,12 @@ "db:export": "tsx scripts/db/export.ts", "db:update": "tsx scripts/db/update.ts", "lint": "npx eslint \"{scripts,tests}/**/*.{ts,js}\"", - "test": "jest --runInBand" + "test": "jest --runInBand", + "prepare": "husky" }, "engines": { "node": ">=18.0.0 <=22.12.0" }, - "pre-commit": [ - "db:validate" - ], "private": true, "author": "Arhey", "jest": { @@ -25,6 +23,8 @@ "testRegex": "tests/(.*?/)?.*test.(js|ts)$" }, "dependencies": { + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "^9.16.0", "@freearhey/core": "^0.2.2", "@joi/date": "^2.1.0", "@json2csv/formatters": "^7.0.3", @@ -34,6 +34,7 @@ "@octokit/plugin-paginate-rest": "^6.0.0", "@octokit/plugin-rest-endpoint-methods": "^7.1.3", "@types/jest": "^29.5.5", + "@types/joi": "^17.2.3", "@typescript-eslint/eslint-plugin": "^8.17.0", "chalk": "^4.1.2", "commander": "^9.0.0", @@ -41,16 +42,11 @@ "eslint": "^9.16.0", "eslint-config-prettier": "^9.0.0", "fs-extra": "^11.2.0", + "globals": "^15.13.0", + "husky": "^9.1.7", "jest": "^29.7.0", "joi": "^17.13.3", "ts-jest": "^29.1.1", "tsx": "^4.10.5" - }, - "devDependencies": { - "@eslint/eslintrc": "^3.2.0", - "@eslint/js": "^9.16.0", - "@types/joi": "^17.2.3", - "globals": "^15.13.0", - "pre-commit": "^1.0.10" } } diff --git a/yarn.lock b/yarn.lock index 27f14153..91a49e56 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2010,6 +2010,11 @@ human-signals@^2.1.0: resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +husky@^9.1.7: + version "9.1.7" + resolved "https://registry.npmjs.org/husky/-/husky-9.1.7.tgz" + integrity sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA== + ignore@^5.2.0, ignore@^5.3.1: version "5.3.2" resolved "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz" @@ -3012,13 +3017,6 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -pre-commit@^1.0.10: - version "1.0.10" - resolved "https://registry.npmjs.org/pre-commit/-/pre-commit-1.0.10.tgz" - integrity sha512-lpS8vLmOuAHSH8v+9GLSyYMplk9oZYLr3caRbsx9BVJzXb+/bI1l45JXAa0x/io732ZwgW2nhV8EeKjqVm7y4Q== - dependencies: - shelljs "0.5.x" - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz" @@ -3141,11 +3139,6 @@ shebang-regex@^3.0.0: resolved "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz" integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== -shelljs@0.5.x: - version "0.5.3" - resolved "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz" - integrity sha512-C2FisSSW8S6TIYHHiMHN0NqzdjWfTekdMpA2FJTbRWnQMLO1RRIXEB9eVZYOlofYmjZA7fY3ChoFu09MeI3wlQ== - signal-exit@^3.0.3, signal-exit@^3.0.7: version "3.0.7" resolved "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz"