From b785d954ac43a042bc226388e174185b636d2b44 Mon Sep 17 00:00:00 2001 From: Mikhail Avdeev Date: Sat, 28 Dec 2024 14:00:46 +0300 Subject: [PATCH] build: add pre-commit & pre-push hooks --- lefthook.yml | 22 +++++++ package-lock.json | 164 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 3 files changed, 187 insertions(+) create mode 100644 lefthook.yml diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000000..a79efa83c9 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,22 @@ +pre-push: + commands: + coverage: + run: | + npm run build && + npm run test:coverage + +pre-commit: + parallel: true + commands: + format: + glob: '*.{js,ts,md,yml}' + run: npm run fmt:check + license: + run: npm run test:license + audit: + run: | + npm run build && + (run test:audit & + npm run test:circular & + npm run test:size &) + wait diff --git a/package-lock.json b/package-lock.json index 5e549eeaa9..31ec67db40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ "get-port": "^7.1.0", "globby": "^14.0.2", "jsr": "^0.13.2", + "lefthook": "^1.10.1", "madge": "^8.0.0", "minimist": "^1.2.8", "node-fetch-native": "^1.6.4", @@ -3639,6 +3640,169 @@ "dev": true, "license": "MIT" }, + "node_modules/lefthook": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook/-/lefthook-1.10.1.tgz", + "integrity": "sha512-WLwXd8FxAcZ0KJg0d/u1r2nY7F/i2XJlyxQSKJkFkbuzqggNU876ksHuNAluSbsZ4nNdI+tWbBUu1Th3SPvgcQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "lefthook": "bin/index.js" + }, + "optionalDependencies": { + "lefthook-darwin-arm64": "1.10.1", + "lefthook-darwin-x64": "1.10.1", + "lefthook-freebsd-arm64": "1.10.1", + "lefthook-freebsd-x64": "1.10.1", + "lefthook-linux-arm64": "1.10.1", + "lefthook-linux-x64": "1.10.1", + "lefthook-openbsd-arm64": "1.10.1", + "lefthook-openbsd-x64": "1.10.1", + "lefthook-windows-arm64": "1.10.1", + "lefthook-windows-x64": "1.10.1" + } + }, + "node_modules/lefthook-darwin-arm64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-darwin-arm64/-/lefthook-darwin-arm64-1.10.1.tgz", + "integrity": "sha512-dGi4Oiu2LSve8Xmz7vHWlUbnU5mk6HnhTbC1CnXqaFbb08yNYSYoJBwsalS+LoO4L6I/pqnv32ESCbdIzuhBiQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-darwin-x64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-darwin-x64/-/lefthook-darwin-x64-1.10.1.tgz", + "integrity": "sha512-NkEkBZm5jYH4fqbpJweDyJx/+/jWLst0FEHOCU5QZ8xFm+42hTGj4+6kfbjirU1ubvmRY/TeilYDsq1OIr5jZQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/lefthook-freebsd-arm64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-arm64/-/lefthook-freebsd-arm64-1.10.1.tgz", + "integrity": "sha512-hX/c4p0+JoCrr55e8zfXC63ReW3Cg4WKzZKP6NA2uNDaKItHlQ4zR3CCOytdVnuPXOa6f93WB9lmRYtIp34dqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-freebsd-x64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-freebsd-x64/-/lefthook-freebsd-x64-1.10.1.tgz", + "integrity": "sha512-0suh8/Mx56Rircc/hvr3vU/XKv0E/afD/LkF8lkOPm4besgq6k9HCkpdPgBykP8Q0ve/W3rOlXeBQ7c7oDhX8Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/lefthook-linux-arm64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-linux-arm64/-/lefthook-linux-arm64-1.10.1.tgz", + "integrity": "sha512-zADf8CSkoV7EfpLsy5U22gq0+famMjUEfKy9nacS6zEgPvMxDk5Q/7QpnMWJeeiwkf9XWgQ+GATWuGahA3Id9A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-linux-x64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-linux-x64/-/lefthook-linux-x64-1.10.1.tgz", + "integrity": "sha512-wdPVMZAN6vi3/4rlhzaWjR5N3AZE5+dUd3lSzfP6mmfXVQtwnJ29HFUlje6TAnwZBSOBI8yoMsz38FrhPuayYg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/lefthook-openbsd-arm64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-openbsd-arm64/-/lefthook-openbsd-arm64-1.10.1.tgz", + "integrity": "sha512-PJ0fHvjcgapaWsn+4uhj3ZMRvkV0Ug+BOrRovF+SdXdA7DiBbRzFPTpUWrGoV3lw7uFjY6pJqGqakDqZ0J7J6g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/lefthook-openbsd-x64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-openbsd-x64/-/lefthook-openbsd-x64-1.10.1.tgz", + "integrity": "sha512-Bs0hBWHW4s6Dp0qVG4LXv96Vo1NXsM/y6VrWten3pv2oEO18Yw9PmKd6vl4mGI7yA72wq4HNATBagFx460IIEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/lefthook-windows-arm64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-windows-arm64/-/lefthook-windows-arm64-1.10.1.tgz", + "integrity": "sha512-xoBiiAChVSv1YYVkwkpfEoAbjNuRblrA0tI8GOtPBhkzlfBP3MaD5JfU2SPzID9IfAG/yV5dOlrLVKhacQA66A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/lefthook-windows-x64": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/lefthook-windows-x64/-/lefthook-windows-x64-1.10.1.tgz", + "integrity": "sha512-+AwTHtBP8npL604Dd13rnEblWh6a9+sf0lSzoLy22y3jdae4kVENLmYoeZ6bz0Wf6SF18UCjf+byvspQRnnCHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/lilconfig": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz", diff --git a/package.json b/package.json index 8b9efb2407..0918c03283 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,7 @@ "get-port": "^7.1.0", "globby": "^14.0.2", "jsr": "^0.13.2", + "lefthook": "^1.10.1", "madge": "^8.0.0", "minimist": "^1.2.8", "node-fetch-native": "^1.6.4",