git-tasker

1.0.1 • Public • Published

git-execute

Execute scripts when various file types have been updated in GIT. Specifically this script is used at Beanstalk within a git hook to conditionally run npm install and a gulp build when frontend files have changed.

Example configuration within package.json

Install with npm install -g git-tasker

By default, git-tasker will execute git diff --name-only HEAD@{1} HEAD to determine which files have changed. Each file is matched against a matcher within the below json. If it matches, the command will be queued for execution. Duplicate commands will only be queued once and are queued in the order they are defined. In the below example, the npm install command will always be executed before the gulp build.

{
  "name": "example",
  "dependencies": [],
  "git-tasker": [
    {
      "matcher": "package.json",
      "command": "npm install"
    },
    {
      "matcher": "**/*.js",
      "command": "gulp build"
    }
  ]
}

API Usage

Install with npm install git-tasker

var git_tasker = require('git-tasker');
/**
 * @param config - a configuration array, same as the above config in package.json
 * @param git_list_command - optional string command for listing files changed. Defaults to `git diff --name-only HEAD@{1} HEAD`
 * @param callback - A final callback when all tasks/commands have been executed
 */
git_tasker(config, git_list_command, callback);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1
  • 1.0.0
    0

Package Sidebar

Install

npm i git-tasker

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • blittle