Skip to content

Commit

Permalink
feat: ✨ support run postpush hook
Browse files Browse the repository at this point in the history
closes #45, #46
  • Loading branch information
vivaxy committed Apr 29, 2020
1 parent f0d5adf commit d7bc7d8
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 38 deletions.
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
CHANGELOG.md
README.md
package.json
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"homepage": "/~https://github.com/vivaxy/gacp#readme",
"dependencies": {
"@commitlint/load": "^8.1.0",
"@vivaxy/git": "^4.0.0",
"@vivaxy/git": "^4.0.1",
"chalk": "^2.4.2",
"conventional-commit-types": "^2.1.1",
"cosmiconfig": "^5.2.1",
Expand Down Expand Up @@ -122,5 +122,10 @@
"extends": [
"@commitlint/config-conventional"
]
},
"gacp": {
"hooks": {
"postpush": "echo after push"
}
}
}
1 change: 1 addition & 0 deletions src/gacp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import * as git from '@vivaxy/git';

import prompt from './prompt';
import GacpError from './errors/gacp';
import runHook from './shell/run-hook';
import { EMOJI_TYPES } from './configs';
import * as logger from './shell/logger';
import checkNeedsPush from './git/status/check-needs-push';
Expand Down
29 changes: 0 additions & 29 deletions src/git/commands/git-push.ts

This file was deleted.

17 changes: 17 additions & 0 deletions src/shell/run-hook.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @since 2020-04-29 10:39
* @author vivaxy
*/
import * as execa from 'execa';

export default async function runHook(
script: string,
{
cwd,
}: {
cwd: string;
},
) {
const [command, ...args] = script.split(' ');
await execa(command, args, { cwd });
}
14 changes: 7 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,10 @@
dependencies:
"@types/yargs-parser" "*"

"@vivaxy/git@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@vivaxy/git/-/git-4.0.0.tgz#e2a67507e44b7525912131028035222d02c0fa44"
integrity sha512-x69ke1VzQ9J3533ZRlb4lSEVGth2ab63Gjtne4+t8g8pgO9t3tpWn1gLjHezDkbmUwd62g4gYQIOARvX2xbjJA==
"@vivaxy/git@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@vivaxy/git/-/git-4.0.1.tgz#82a90dcce11eba5034184ac46e1b500624a5606b"
integrity sha512-KJrk9RqSEskKPpbB/vphqKZC1tTqUfK++bDLw1hoJiNbPdFP6ymXhZDo57axBR5b6Es6Gtent5EepCalxFIWHA==
dependencies:
"@types/fs-extra" "^8.0.0"
execa "^2.0.3"
Expand Down Expand Up @@ -2160,9 +2160,9 @@ graceful-fs@^4.1.3:
integrity sha512-b9usnbDGnD928gJB3LrCmxoibr3VE4U2SMo5PBuBnokWyDADTqDPXg4YpwKF1trpH+UbGp7QLicO3+aWEy0+mw==

graceful-fs@^4.2.0:
version "4.2.3"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423"
integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==
version "4.2.4"
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==

handlebars@^4.1.0, handlebars@^4.1.2:
version "4.5.3"
Expand Down

0 comments on commit d7bc7d8

Please sign in to comment.