Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 7b203fc

Browse files
committedSep 4, 2013
chore(grunt): support semver v2 version number format
previously we couldn't use it because of bower bugs
1 parent 9a7adb5 commit 7b203fc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed
 

‎lib/grunt/utils.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,17 @@ module.exports = {
1717
if (version) return version;
1818

1919
var package = JSON.parse(fs.readFileSync('package.json', 'UTF-8'));
20-
// TODO(brian): change `(-|rc)` to `-` in the regex below after bower
21-
// fixes this issue: https://github.com/bower/bower/issues/782
22-
var match = package.version.match(/^([^\-]*)(?:(-|rc)(.+))?$/);
20+
var match = package.version.match(/^([^\-]*)(?:\-(.+))?$/);
2321
var semver = match[1].split('.');
2422
var hash = shell.exec('git rev-parse --short HEAD', {silent: true}).output.replace('\n', '');
2523

26-
var fullVersion = (match[1] + (match[2] ? '-' + hash : ''));
24+
var fullVersion = match[1];
25+
26+
if (match[2]) {
27+
fullVersion += '-';
28+
fullVersion += (match[2] == 'snapshot') ? hash : match[2];
29+
}
30+
2731
version = {
2832
full: fullVersion,
2933
major: semver[0],

0 commit comments

Comments
 (0)
This repository has been archived.