-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hook): Support setups with CWD below Git project root (#112)
* add node_modules_path variable to template * surround template variable in quotes * testing * pass node_modules path instead of __dirname, change hook() to use regex * test(hook): Modify package name resolution to fit. * fix(hook): try to resolve simple `ghooks` first The former default way to resolve the package (default project setup: cwd === project dir), fixes own `npm install` after cloneing the repo. * test(hook): test default and cwd !== project dir setups * docs(readme): advise to not install globally Fixes #108
- Loading branch information
1 parent
3ea9139
commit 4786985
Showing
5 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
const fs = require('fs') | ||
const resolve = require('path').resolve | ||
const path = require('path') | ||
|
||
exports.generatedMessage = 'Generated by ghooks. Do not edit this file.' | ||
|
||
exports.content = fs | ||
.readFileSync(resolve(`${__dirname}/hook.template.raw`), 'UTF-8') | ||
.replace('{{generated_message}}', exports.generatedMessage) | ||
.replace('{{node_modules_path}}', path.join(process.cwd(), '..')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters