ndifhdihf / example-githooks

An example of using git hooks with npm run scripts and Surge.

Home Page:https://surge.sh/help/deploying-continuously-using-git-hooks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Git Hooks example

An example of using git hooks with npm run scripts and Surge.

Getting started

To try out this example, clone the project and add a test commit and you’ll be prompted to publish.

In your own project, install Surge and git-scripts:

npm install --save-dev surge git-scripts

Next, in your package.json, add the git hook you’d like to run your npm task on. Finally, add add a npm run task for Surge:

"git": {
  "scripts": {
    "post-commit": "npm run deploy",
    "pre-push": "npm run deploy"
  }
},
"scripts": {
  "deploy": "surge --project ./ --domain my-project.surge.sh"
}

Now, anyone can npm run deploy to use Surge, and they will also deploy post-commit and pre-push (note the later requires git 1.8.x and up).

In practice, you probably won’t want to publish post-commit, but pre-push is very useful. The full list of hooks is available here.

License

The MIT License (MIT)

Copyright © 2015 Chloi Inc.

About

An example of using git hooks with npm run scripts and Surge.

https://surge.sh/help/deploying-continuously-using-git-hooks

License:MIT License


Languages

Language:HTML 100.0%