-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(husky): setup ggshield & lint-staged
- Loading branch information
1 parent
1c095bf
commit 6e45354
Showing
6 changed files
with
171 additions
and
14 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"$schema": "https://json.schemastore.org/commitlintrc", | ||
"extends": "@ivangabriele/commitlint-config", | ||
"helpUrl": "https://github.com/ivangabriele/clamav-desktop/blob/main/CONTRIBUTING.md#commit-messages" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
[ -n "$CI" ] && exit 0 | ||
|
||
yarn commitlint --edit "$1" |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
[ -n "$CI" ] && exit 0 | ||
|
||
if command -v ggshield >/dev/null; then | ||
yarn test:sec | ||
else | ||
echo "\033[33mWARNING: ggshield is not installed, please install it: https://github.com/GitGuardian/ggshield#installation.\033[0m" | ||
fi | ||
|
||
yarn lint-staged |
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 |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
"clean": "rm -Rf ./.e2e ./coverage ./dist ./node_modules/.vite ./src-tauri/target ./src-tauri/cobertura.xml", | ||
"dev": "cross-env RUST_BACKTRACE=full TAURI_DEV=true tauri dev", | ||
"dev:webview": "vite", | ||
"postinstall": "node ./scripts/dev/post_install.js", | ||
"release:bin": "tauri build -b none", | ||
"release:deb": "tauri build -b deb", | ||
"release:deb:install": "yarn release:deb && sudo dpkg -i ./src-tauri/target/release/bundle/deb/clamav-desktop_0.3.24_amd64.deb", | ||
|
@@ -24,7 +25,7 @@ | |
"start": "./src-tauri/target/release/clamav-desktop", | ||
"test": "yarn test:lint && yarn test:type && yarn test:unit:core && test:unit:webview", | ||
"test:e2e": "xvfb-run wdio run ./configs/wdio.config.ts", | ||
"test:lint": "eslint --ext js,ts,tsx .", | ||
"test:lint": "eslint --ext cjs,cts,js,json,jsonc,mjs,mts,ts,tson,tsx .", | ||
"test:sec": "ggshield iac scan .", | ||
"test:type": "tsc --noEmit -p ./tsconfig.ci.json", | ||
"test:unit:core": "make test", | ||
|
@@ -96,6 +97,7 @@ | |
"eslint-plugin-sort-keys-fix": "1.1.2", | ||
"eslint-plugin-typescript-sort-keys": "3.2.0", | ||
"esm-path": "1.0.1", | ||
"execa": "9.2.0", | ||
"husky": "9.0.11", | ||
"jest": "29.7.0", | ||
"jest-environment-jsdom": "29.7.0", | ||
|
@@ -106,8 +108,17 @@ | |
"ts-node": "10.9.2", | ||
"type-fest": "4.20.0", | ||
"use-debounce": "10.0.1", | ||
"vite": "5.2.13" | ||
"vite": "5.2.13", | ||
"which": "4.0.0" | ||
}, | ||
"lint-staged": { | ||
"*.{md,yaml,yml}": "prettier --write", | ||
"*.{ts,tsx}": [ | ||
"yarn eslint --ext cjs,cts,js,json,jsonc,mjs,mts,ts,tson,tsx", | ||
"bash -c 'npm run test:type'" | ||
] | ||
}, | ||
"pretter": "@ivangabriele/prettier-config", | ||
"author": { | ||
"name": "Ivan Gabriele", | ||
"email": "[email protected]", | ||
|
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable @typescript-eslint/no-unused-expressions */ | ||
|
||
import { B } from 'bhala' | ||
import { $ } from 'execa' | ||
import which from 'which' | ||
|
||
B.log('[Post Install Script] Checking required dependencies...') | ||
try { | ||
which.sync('ggshield') | ||
} catch (error) { | ||
B.warn( | ||
'[Post Install Script] ggshield is not installed, please install it: https://github.com/GitGuardian/ggshield#installation.', | ||
) | ||
} | ||
|
||
B.log('[Post Install Script] Installing Git hooks (husky)...') | ||
$`yarn husky` |
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