Skip to content

Commit

Permalink
Merge pull request #90 from AlexPoleschuk/bugfix/yarn3-nodelinker-pnp…
Browse files Browse the repository at this point in the history
…m-fix

fix: using with yarn3 nodeLinker pnpm
  • Loading branch information
toplenboren authored Jul 17, 2023
2 parents 4a89119 + 10b2830 commit 2acc134
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions simple-git-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ function getProjectRootDirectoryFromNodeModules(projectPath) {
return projDir.slice(0, indexOfPnpmDir - 1).join('/');
}

const indexOfStoreDir = projDir.indexOf('.store')
if (indexOfStoreDir > -1) {
return projDir.slice(0, indexOfStoreDir - 1).join('/');
}

// A yarn2 STAB
if (projDir.includes('.yarn') && projDir.includes('unplugged')) {
return undefined
Expand Down
4 changes: 4 additions & 0 deletions simple-git-hooks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ test('getProjectRootDirectory return correct dir when installed using pnpm:', ()
expect(spc.getProjectRootDirectoryFromNodeModules(`var/my-project/node_modules/.pnpm/simple-git-hooks@${packageVersion}/node_modules/simple-git-hooks`)).toBe('var/my-project')
})

test('getProjectRootDirectory return correct dir when installed using yarn3 nodeLinker pnpm:', () => {
expect(spc.getProjectRootDirectoryFromNodeModules(`var/my-project/node_modules/.store/simple-git-hooks@${packageVersion}/node_modules/simple-git-hooks`)).toBe('var/my-project')
})


// Get git root

Expand Down

0 comments on commit 2acc134

Please sign in to comment.