mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-03-22 05:19:56 +01:00
Update build process.
This commit is contained in:
parent
464dfeaa15
commit
190275c31a
32
makefile.js
32
makefile.js
@ -2,6 +2,8 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
|
||||
module.exports = function (make) {
|
||||
|
||||
var path = require('path'),
|
||||
@ -14,7 +16,31 @@ module.exports = function (make) {
|
||||
|
||||
$ = make.fQuery,
|
||||
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');
|
||||
@ -28,9 +54,9 @@ module.exports = function (make) {
|
||||
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 });
|
||||
done();
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user