diff --git a/.githooks/install.js b/.githooks/install.js new file mode 100644 index 0000000..5774839 --- /dev/null +++ b/.githooks/install.js @@ -0,0 +1,7 @@ +const { spawn } = require('child_process'); + +const subprocess = spawn('git', ['config', '--local', 'core.hooksPath', '.githooks/']); + +subprocess.on('error', () => { + console.error('Failed to install git hook.'); +}); diff --git a/package.json b/package.json index d32fbac..a11b3b2 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ ], "scripts": { "eslint": "eslint scripts/ source/js test/", - "prepare": "git config --local core.hooksPath .githooks/", + "prepare": "node .githooks/install.js", "stylint": "stylint source/css/", "test": "mocha test/index.js" },