0.2.1 • Published 10 years ago
vorto v0.2.1
Vorto.js
Simple module to generate build numbers based on the latest git commit hash. This can be used with Gulp, or any other build system, when you're creating build artifacts.
Install
$ npm install vorto --saveUsage
vorto([format][, options], callback);The format and options parameters are optional. The last argument must be a callback function of the de facto async
standard function(err, version) {...}.
Formats
%h: 4dd41fa
%H: 4dd41fa4656cdbc7ed7d4dba0eeb8056f62c75a2
%ct-%h: 1448966785-4dd41fa
%j: 0.2.1Read more about the pretty format options to see whats available.
Options
repo: specify the directory of the repository that you want to generate a version code for. The default is the current directorygit: specify a different path for thegitcommand. The default is just git.
Examples
Generate short code:
var vorto = require("vorto");
vorto(function(err, version) {
console.log("Version: " + version);
});
//Version: 8e0b117Generate long code:
var vorto = require("vorto");
vorto("%H", function(err, version) {
console.log("Version: " + version);
});
//Version: 271c4461c88bbe3ce11274caa1208ca0e57c1bf1Generate with timestamp and hash:
var vorto = require("vorto");
vorto("%ct-%h", function(err, version) {
console.log("Version: " + version);
});
//Version: 1448640790-7f562baGulp example:
var gulp = require("gulp");
var vorto = require("vorto");
var GIT_VERSION;
gulp.task("version", function(cb) {
vorto(function(err, version){
GIT_VERSION = version;
cb();
});
});