Skip to content

Commit

Permalink
husky-upgrade replace GIT_PARAMS with HUSKY_GIT_PARAMS (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored and typicode committed Sep 27, 2018
1 parent 201221e commit ee39cf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/upgrader/__tests__/index.ts
Expand Up @@ -12,6 +12,7 @@ describe('upgrade', () => {
filename,
JSON.stringify({
scripts: {
commitmsg: 'echo $GIT_PARAMS GIT_PARAMS HUSKY_GIT_PARAMS',
precommit: 'npm test'
}
}),
Expand All @@ -23,6 +24,8 @@ describe('upgrade', () => {
expect(JSON.parse(fs.readFileSync(filename, 'utf-8'))).toEqual({
husky: {
hooks: {
'commit-msg':
'echo $HUSKY_GIT_PARAMS HUSKY_GIT_PARAMS HUSKY_GIT_PARAMS',
'pre-commit': 'npm test'
}
},
Expand Down
5 changes: 4 additions & 1 deletion src/upgrader/index.ts
Expand Up @@ -51,7 +51,10 @@ export default function upgrade(cwd: string) {
if (script) {
delete pkg.scripts[name]
const newName = hookList[name]
pkg.husky.hooks[newName] = script
pkg.husky.hooks[newName] = script.replace(
/\bGIT_PARAMS\b/g,
'HUSKY_GIT_PARAMS'
)
console.log(`moved scripts.${name} to husky.hooks.${newName}`)
}
})
Expand Down

0 comments on commit ee39cf9

Please sign in to comment.