Nodejitsu

Save time managing and deploying your node.js app

Nodejitsu has joined GoDaddy

We are excited to join GoDaddy to help spearhead their largest Node.js product: Website Builder. Please read our blog post to learn more about customer transition plans and our continued support for Open Source within the node community.

Want to know all the details?
Read the full blog post or read the GoDaddy Announcement.

npmawesome: parse and reuse GitHub URLs with hosted-git-info

About the author

Name
Location
Worldwide
nodejitsu nodejitsu

Other popular posts

- Scaling Isomorphic Javascript Code - Keep a node.js server up with Forever - Package.json dependencies done right
- npm cheat sheet - 6 Must Have Node.js Modules

This is a guest post from Alex Gorbatchev over at npmawesome.com. Nodejitsu loved what npmawesome.com was doing and is now supporting the project.

hosted-git-info (GitHub: npm/hosted-git-info, License: ISC) by Rebecca Turner of the NPM Inc is another fantastic ulitify module for parsing, breaking down and reusing GitHub, BitBucket and GitLab project URLs. It has a simple API and comes with full test coverage.

npm install hosted-git-info  

Usage

var hostedGitInfo = require('hosted-git-info');  
var info = hostedGitInfo.fromUrl('git@github.com:npmawesome/example-hosted-git-info.git');

console.log(JSON.stringify(info, null, 2));  

Once you have results object, a few convinience methods are provided for your enjoyment.

console.log(info.file('/package.json'));  
console.log(info.shortcut());  
console.log(info.browse());  
console.log(info.bugs());  
console.log(info.docs());  
console.log(info.https());  
console.log(info.sshurl());  
console.log(info.ssh());  
console.log(info.path());  

What Else?

I like that Rebecca Turner released version 1.0 instead of forever iterating on 0.0.x which has been the trend in the last couple of years. I'm a strong advocate of 1.0 releases as soon as it makes sense.

Checkout the runnable example and github example repository.