Skip to content

Commit 30364e9

Browse files
authored
Merge branch 'master' into fix-uninstall
2 parents ab125af + 8486a22 commit 30364e9

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"simple-git-hooks": minor
3+
---
4+
5+
feat: support `deno`'s `node_modules` structure

simple-git-hooks.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ function getProjectRootDirectoryFromNodeModules(projectPath) {
109109
if (indexOfPnpmDir > -1) {
110110
return projDir.slice(0, indexOfPnpmDir - 1).join('/');
111111
}
112+
const indexOfDenoDir = projDir.indexOf('.deno')
113+
if (indexOfDenoDir > -1) {
114+
return projDir.slice(0, indexOfDenoDir - 1).join('/');
115+
}
112116

113117
const indexOfStoreDir = projDir.indexOf('.store')
114118
if (indexOfStoreDir > -1) {

simple-git-hooks.test.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ describe("Simple Git Hooks tests", () => {
6464
)
6565
).toBe("var/my-project");
6666
});
67+
68+
it("return correct dir when installed using deno:", () => {
69+
expect(
70+
simpleGitHooks.getProjectRootDirectoryFromNodeModules(
71+
`var/my-project/node_modules/.deno/simple-git-hooks@${packageVersion}/node_modules/simple-git-hooks`
72+
)
73+
).toBe("var/my-project");
74+
});
6775
});
6876

6977
describe("getGitProjectRoot", () => {

0 commit comments

Comments
 (0)