mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-05 05:34:43 +00:00
chore(grunt): support semver v2 version number format
previously we couldn't use it because of bower bugs
This commit is contained in:
parent
9a7adb5455
commit
7b203fcff6
1 changed files with 8 additions and 4 deletions
|
|
@ -17,13 +17,17 @@ module.exports = {
|
||||||
if (version) return version;
|
if (version) return version;
|
||||||
|
|
||||||
var package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));
|
var package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));
|
||||||
// TODO(brian): change `(-|rc)` to `-` in the regex below after bower
|
var match = package.version.match(/^([^\-]*)(?:\-(.+))?$/);
|
||||||
// fixes this issue: https://github.com/bower/bower/issues/782
|
|
||||||
var match = package.version.match(/^([^\-]*)(?:(-|rc)(.+))?$/);
|
|
||||||
var semver = match[1].split('.');
|
var semver = match[1].split('.');
|
||||||
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
|
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
|
||||||
|
|
||||||
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
|
var fullVersion = match[1];
|
||||||
|
|
||||||
|
if (match[2]) {
|
||||||
|
fullVersion += '-';
|
||||||
|
fullVersion += (match[2] == 'snapshot') ? hash : match[2];
|
||||||
|
}
|
||||||
|
|
||||||
version = {
|
version = {
|
||||||
full: fullVersion,
|
full: fullVersion,
|
||||||
major: semver[0],
|
major: semver[0],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue