In the previous video, we had iterated to create a more full featured Hapijs Elapsed time plugin which calculates the elapsed time from the request coming in to when the response has been fully sent.

This video picks up where we left off and we create a new GitHub repo and push our local code up to it. We also install our code to a new project directly from the GitHub repo.

Goals

  • create new GitHub repo
  • push to GitHub
  • install from GitHub

Video Info

  • Episode: CW V007
  • Skill level: Beginner with basic git and npm skills
  • Prerequisites:
    • Basic Node.js & npm
    • Basic Git skills
  • Published: June 26th, 2014
  • Tags: js, nodejs,git,hapi,plugin,free
  • Duration: 5:21
  • Node.js version: 0.10.25
  • Git version: 1.8.2.1

Notes

  • We are creating a new GitHub repo and will be using our existing code from our local system to populate the repo.
  • Once we push our code to GitHub we will have an exact copy of the local files living there. We can continue to make changes locally and push up commits and all our work will be replicated to the GitHub server.
  • With our code on GitHub others can use and review our code and even clone or fork the repository for themselves.
  • Since npm supports installation directly from GitHub we can install directly from there (even without publishing to the npm registry), this is great for sharing even when not ready to publish to npm yet.
  • There are many ways to install with npm from a git repo
    • npm install manual
    • I prefer using the tarball URL since it is more efficient (the other methods clone the repo which could grow to be very large over time).
    • In practice I also recommend using a tag rather than just installing from master, that way you can control exactly which version you are getting and can selectively choose when to upgrade. You can also use a branch name instead of a tag.
# Various ways to install from GitHub
# install master from tarball
npm install https://github.com/codewinds/hapi-elapsed/archive/master.tar.gz
# install tag v0.0.1 from tarball (my preferred)
npm install https://github.com/codewinds/hapi-elapsed/archive/v0.0.1.tar.gz
npm install codewinds/hapi-elapsed  # installs from github repo
npm install codewinds/hapi-elapsed#v0.0.1  # installs tag v0.0.1
npm install git+ssh://git@github.com:codewinds/hapi-elapased.git#v0.0.1

In the next video

  • Enable travis-ci for repo
  • Trigger build with test hook
  • Push change to run build