npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

watchpush

v2.0.2

Published

Watch for push event on github repository and rebulild your app automatically

Downloads

11

Readme

WatchPush

It is a package that ease the development process on IaaS. With this package you can automatically rebuild and restart your application as you push changes to your github repository.

Install/Run

npm install -g watchpush #installation
watchpull #run application

NOTE: This package need to be installed globally

Configuration

watchpush.json file is required in the root directory of your application It contains following configurations

{
    "name": "Name of your project",
    "hook_port":4000, // Port at which webhook sends request
    "secret":"Secret token registered at github webhook",
    "preProcesses":[ // Processes that need to run before starting app
        "git pull",
        "install module"
    ],
    "runScript":"Final command that lifts/run/start your application"
}

Start your app by running watchpull command in cli at root directory of your application from where all the above commands need to run

Setup webhook

  • You need to add a webhook in your repository setting to listen to push event
  • Create a new webhook with following settings:
    • Payload URL: YourHostAdd:hook_port
      • eg http://192.23.34.5:5000, if your machine's external ip address is 192.23.34.5 and 5000 is configured as hook_port in watchpush.json
    • Content type: application/json
    • Secret: Token that is configured in watchpush.json
    • Check Just the push event.

For more infromation refer: https://developer.github.com/webhooks/

Note

  • hook_port is different from the port your app might be listening.
  • Make sure hook_port configured in watchpush.json is publically accessible.
  • Get request on YourHostAdd:hook_port should return

    Listening to push events on port 'hook_port'

  • Package currently support only application/json, so make sure same is configured on github webhook
  • Since it need to automatically pull repository use git config credential.helper store and do a manuall pull/push to let git remember your credentials for future requests

Examples

For a node app

{
    "name": "Simple node project",
    "hook_port":4000,
    "secret":"qwerty",
    "preProcesses":[
        "git pull origin master",
        "npm install"
    ],
    "runScript":"node index.js"
}

For a react app

{
    "name": "Simple react project",
    "hook_port":4000,
    "secret":"qwerty",
    "preProcesses":[
        "git pull origin master",
        "npm install",
        "npm run build"
    ],
    "runScript":"serve ./public"
}

For a python app

{
    "name": "Simple python project",
    "hook_port":4000,
    "secret":"qwerty",
    "preProcesses":[
        "git pull origin master",
        "pip install -r requirements.txt"
    ],
    "runScript":"python app.py"
}