Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 762 B view raw
1const path = require('path'); 2const fs = require('fs'); 3 4const hookSource = path.resolve( 5 __dirname, 6 '../../node_modules/husky-v4/sh/husky.sh' 7); 8const hook = path.resolve(__dirname, '../../.git/hooks/husky.sh'); 9const localHook = path.resolve(__dirname, '../../.git/hooks/husky.local.sh'); 10const gitConfig = path.resolve(__dirname, '../../.git/config'); 11 12let script = fs.readFileSync(hookSource, { encoding: 'utf-8' }); 13script = script.replace(`$(basename "$0")`, `$(basename "$0" .sh)`); 14 15let config = fs.readFileSync(gitConfig, { encoding: 'utf-8' }); 16config = config.replace(/\s*hooksPath\s*=\s*\.husky\n?/g, '\n'); 17 18fs.writeFileSync(hook, script); 19fs.writeFileSync(gitConfig, config); 20 21fs.writeFileSync(localHook, 'packageManager=yarn\n' + 'cd "."\n');