mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-28 14:04:45 -04:00
Update build process.
This commit is contained in:
parent
464dfeaa15
commit
190275c31a
1 changed files with 29 additions and 3 deletions
32
makefile.js
32
makefile.js
|
@ -2,6 +2,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = function (make) {
|
module.exports = function (make) {
|
||||||
|
|
||||||
var path = require('path'),
|
var path = require('path'),
|
||||||
|
@ -14,7 +16,31 @@ module.exports = function (make) {
|
||||||
|
|
||||||
$ = make.fQuery,
|
$ = make.fQuery,
|
||||||
mapSrc = $.map.p(src, build).s('.less', '.css').s('.jade', ''),
|
mapSrc = $.map.p(src, build).s('.less', '.css').s('.jade', ''),
|
||||||
mapRoot = $.map.p(root, path.join(build, '_h5ai'));
|
mapRoot = $.map.p(root, path.join(build, '_h5ai')),
|
||||||
|
|
||||||
|
// bad hack
|
||||||
|
getBuildSuffix = function (callback) {
|
||||||
|
|
||||||
|
var child_process = require('child_process');
|
||||||
|
|
||||||
|
child_process.exec('git rev-list --tags --max-count=1', {cwd: root}, function (err, out) {
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
child_process.exec('git rev-list ' + out.trim() + '..HEAD', {cwd: root}, function (err, out) {
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
callback();
|
||||||
|
} else {
|
||||||
|
var lines = out.split(/\r?\n/);
|
||||||
|
var count = lines.length - 1;
|
||||||
|
callback('' + count + '~' + lines[0].substring(0, 10));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
make.version('>=0.10.0');
|
make.version('>=0.10.0');
|
||||||
|
@ -28,9 +54,9 @@ module.exports = function (make) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.git(root, function (err, result) {
|
getBuildSuffix(function (result) {
|
||||||
|
|
||||||
pkg.version += '+' + result.buildSuffix;
|
pkg.version += '+' + result;
|
||||||
$.info({ method: 'check-version', message: 'version set to ' + pkg.version });
|
$.info({ method: 'check-version', message: 'version set to ' + pkg.version });
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue