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

Add flag to fix relativeUserPkgDir #728

Closed
wants to merge 2 commits into from
Closed

Conversation

bnbarak
Copy link

@bnbarak bnbarak commented May 26, 2020

What

Per #677, and @eduard-malakhov great explanation #677 (comment)

Fix a bug when running yarn|npm install from a sub node_modules in a monorepo/yarn workspaces project.

Current: the relative path to the project's root is set no packages/someOther when running from a package like packages/someOther.
Expected: To be able to force the relative path to the be the root of the project even when the yarn|npm install is running not from the root.

README.md Outdated
@@ -328,6 +328,10 @@ npm install husky --save-dev

Verify that your version of Git is `>=2.13.0`.

#### Lerna Workspaces and Monorepos

Choose a reason for hiding this comment

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

Seems like this fix would also address this happening in a Yarn Workspaces monorepo. Maybe we should call that out?

Copy link
Author

Choose a reason for hiding this comment

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

Changed to Lerna, Monorepos, and Yarn Worksapces to cover everything. What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

Thanks :) Already updated the PR, what is your merge process?

Choose a reason for hiding this comment

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

Maybe @typicode can chime in for merge process.

I'd love to test this out @bnbarak, what's the easiest way?

Copy link
Author

Choose a reason for hiding this comment

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

First lets recreate the issue on master:

  1. close this example of a basic Lerna monorepo https://github.com/reggi/lerna-tutorial
  2. Setup Husky
  3. Run yarn inside packages/usage
  4. Open .git/hooks/huskey.local.sh, expect to see cd "packages/usage" // <-- this is the problem

Test the fix

  1. Checkout this PR in the example project
  2. Set the env variable HUSKY_RUN_FROM_ROOT="true" or HUSKY_RUN_FROM_ROOT="1"
  3. Remove .git/hooks
  4. Run yarn inside packages/usage
  5. Open .git/hooks/huskey.local.sh, expect to see cd "." // <-- this is the fix

Copy link
Author

Choose a reason for hiding this comment

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

Piniging @lessen-inc and @typicode for their attention :)

@Faolain
Copy link

Faolain commented May 16, 2021

hey just bumping this, any reason why it hasn't been merged? @typicode @lessen-inc

@typicode typicode closed this May 20, 2021
@typicode typicode deleted the branch typicode:v4 May 20, 2021 13:32
@Faolain
Copy link

Faolain commented May 22, 2021

@typicode is there a reason this was closed and not merged? cc: @bnbarak @bryantee

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.

4 participants