Closed Lenghak closed 9 months ago
[Updated on : 7th Dec 2023
]
Found the solution:
"cruise": "npx depcruise src -p"
in the package.json
script (for convenience).<package-manager> cruise
will get the exit code 1 when there is a violation.pre-commit
hooks // ...
pnpm cruise || exit $
// ...
This is about shell knowledge and problems not library specific. Further inspection I will add more on this.
Summary
I wanted to find out how to generate exit code 1 from getting an dependencies violation errors in
pre-commit
hook.Context
So, the thing is I wanted to check to see if there are any dependencies violations like
orphan-files
,circular-dependencies
, and more in mypre-commit
hook. However, even though there is an error regarding to above options, I still got exit code 0 meaning people can still push their code along with errors into their branch.Environment