You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a a repo with 4 micro-services each with his own package.json. I wanted to run some lints rules before do a commit in /app micro-services, but I have the problem that if some of my workmates works in other micro-service, the the hook was triggered when is not required.
so i did this small script and change my package.json configuration to run it.
#!/bin/bash
SRC_PATTERN="app/"if git diff @{push} --cached --name-only | grep --quiet "$SRC_PATTERN"then
npm run lint && npm run type-check
elseexit 0
fi
this will check if the changes to be pushed is part of the folder that this hook belong.
that would be the ideal solution.
If you have a monoRepo, the hook would check where the husky was installed or where you have packages.json with a valid husky configuration and save this locations for later use.
husky will then check which paths changes happen and trigger the task in each package.json where the files where modify.
e.g.
this is your repo structure
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
this is a suggestion / feature:
I have a a repo with 4 micro-services each with his own package.json. I wanted to run some lints rules before do a commit in
/app
micro-services, but I have the problem that if some of my workmates works in other micro-service, the the hook was triggered when is not required.so i did this small script and change my package.json configuration to run it.
this will check if the changes to be pushed is part of the folder that this hook belong.
that would be the ideal solution.
husky
was installed or where you have packages.json with a validhusky
configuration and save this locations for later use.husky
will then check which paths changes happen and trigger the task in each package.json where the files where modify.e.g.
this is your repo structure
api.js
onlynpm test
is execute,/app
thennpm lint
is execute/utils
nothing happenapp.js
,api.js
andutils/index.js
, thennpm lint
andnpm lint
is executedthanks
The text was updated successfully, but these errors were encountered: