mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(grunt): cache version number
caching the version number speeds up the build and preserves resources. this also fixed EMFILE error that now occurs on some macs.
This commit is contained in:
parent
724819e3cf
commit
b53c945bf5
1 changed files with 4 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ var fs = require('fs');
|
|||
var shell = require('shelljs');
|
||||
var grunt = require('grunt');
|
||||
var spawn = require('child_process').spawn;
|
||||
var version;
|
||||
|
||||
module.exports = {
|
||||
|
||||
|
|
@ -11,6 +12,8 @@ module.exports = {
|
|||
|
||||
|
||||
getVersion: function(){
|
||||
if (version) return version;
|
||||
|
||||
var package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));
|
||||
var match = package.version.match(/^([^\-]*)(-snapshot)?$/);
|
||||
var semver = match[1].split('.');
|
||||
|
|
@ -18,7 +21,7 @@ module.exports = {
|
|||
|
||||
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
|
||||
var numVersion = semver[0] + '.' + semver[1] + '.' + semver[2];
|
||||
var version = {
|
||||
version = {
|
||||
number: numVersion,
|
||||
full: fullVersion,
|
||||
major: semver[0],
|
||||
|
|
|
|||
Loading…
Reference in a new issue