DEV Community

Kyle Schwartz
Kyle Schwartz

Posted on

Using Githooks for CI/CD

A tutorial on how to to use git-scripts for CI/CD

Create the package.json

Create a package.json by running:

npm init
Enter fullscreen mode Exit fullscreen mode

Install git-scripts to the package by running:

npm install --save-dev git-scripts
Enter fullscreen mode Exit fullscreen mode

Add the Git Hooks

After the devDependencies section, add:

  "devDependencies": {
    "git-scripts": "^0.2.1"
  },
  "git": { 
    "scripts": { 
      "pre-push": "<command(s) to run before git push>" 
    } 
  }
Enter fullscreen mode Exit fullscreen mode

Discussion (0)