frontsideair / yarnhook

Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically
MIT License
217 stars 17 forks source link

Fix for lerna/monorepos: always run from git root #28

Closed christophehurpeau closed 6 years ago

christophehurpeau commented 6 years ago

Typical lerna repo:

package.json
packages/
  - package1/
      - package.json

I have this in my root package.json:

  "scripts": {
    "postinstall": "lerna bootstrap",
  }

running git checkout from inside package1 will result in installing dependencies only for this package and will remove symlinks to other dependencies inside the monorepo

This fix always run the install from the root, then via the postinstall script runs lerna boostrap and install dependencies in sub packages

frontsideair commented 6 years ago

Can I help?

christophehurpeau commented 6 years ago

I read the issue #14 after this PR and realised I missed the fact that yarnhook checks if the lockfile changed ! I will work on proposed solutions in #14 instead soon :)

frontsideair commented 6 years ago

Sure! Let me know if you need anything.