Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add Post-Merge Hooks to sync local packages automatically #1621

Open
anshgoyalevil opened this issue Jul 31, 2023 · 5 comments
Open

Comments

@anshgoyalevil
Copy link
Contributor

Requirement

The git post-merge hook help run certain commands after git pull is executed inside the project's folder.

Certain developers forget to run yarn install each time they execute git pull.

Problem

For example, a yarn package is added or upgraded inside the project by any other developer, and the other developer working on it locally executes git pull but forgets to run yarn install

This can be problematic in some cases and may result in inconsistent code. Like for example, a typescript definition for a package is upgraded in the upstream, but not upgraded inside the local dev env, it won't show the updated types or interfaces if there's any.

Proposal

We can use husky and git post-merge hook to automate this.

This technique is widely used across open-source projects as it automatically executes certain commands after a change in upstream yarn.lock or package.json is detected.

Open questions

No response

@anshgoyalevil
Copy link
Contributor Author

anshgoyalevil commented Jul 31, 2023

@yurishkuro
I would personally advocate for Husky to automate this. We are already having some conflicts with the outdated packages, and this might be a good start to tackle all those things.

In the future, we can also use Husky pre-commit hooks to check for lint errors, as catching them in dev environment before committing the code is better than checking inside CI env

What are your opinions?

@yurishkuro
Copy link
Member

We already have some pre-commit husky hooks, which I personally have disabled locally, because I don't like basic git commands triggering expensive work.

@anshgoyalevil
Copy link
Contributor Author

@yurishkuro Yes, most of the people disable pre-commit hooks like lint test, unit test, etc, as they take up an extra time for each commit, though we can use --no-verify to skip that.

In the case of post merge, what are your preferences? Should we have it in place?

@yurishkuro
Copy link
Member

I have the same view on post-merge. I do git pull often and in most cases do not need a reinstall of deps, even if they have changed (usually just minor upgrades).

What might be useful is a hook that simply warns about outdated deps, if it can be executed very quickly. Then people can reinstall manually.

@anshgoyalevil
Copy link
Contributor Author

@yurishkuro Yeah. Got the point. That hook can also be added, which simply warns about the outdated deps. Going ahead to make a PR for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants