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

lint-staged & husky in monorepos #30

Merged
merged 7 commits into from
Nov 19, 2019
Merged

lint-staged & husky in monorepos #30

merged 7 commits into from
Nov 19, 2019

Conversation

nikzaugg
Copy link
Collaborator

This pull request explained:

  • husky & lint-staged never worked correctly with our setup, nothing was formatted each time we committed. Even tough the pre-commit hook was fired it did not recognize any staged files.
  • best practice is to remove husky from the sub-repos and only install it at the top-level
  • this PR adds lerna https://github.com/lerna/lerna, the Nr. 1 tool to manage monorepos
  • lerna can call npm scripts in sub-repos simultaneously
  • the lerna.json holds some minor configs, most importantly the "packages":[ ... ], that tell where our repos are
  • added a top-level package.json with the husky hook pre-commit, which will then run the pre-commit command in each sub-repo
  • basically: if this is merged, then each time something is commited, the pre-commit script of every sub-repo is run

Copy link
Owner

@alexscheitlin alexscheitlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one, I didn't know that.

@nikzaugg nikzaugg merged commit b90fe8e into master Nov 19, 2019
@nikzaugg nikzaugg deleted the prettier-config branch November 19, 2019 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants