mirror of
https://github.com/lrsjng/jquery-qrcode.git
synced 2026-08-13 04:11:36 +08:00
Updates build process.
This commit is contained in:
+13
-24
@@ -64,34 +64,23 @@ module.exports = function (make) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
make.target('git-hash', [], 'get git hash tag')
|
make.target('check-version', [], 'add git info to dev builds').async(function (done, fail) {
|
||||||
.async(function (done, fail) {
|
|
||||||
|
|
||||||
if (!/-dev$/.test(pkg.version)) {
|
if (!/-dev$/.test(pkg.version)) {
|
||||||
done();
|
done();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var hash = '',
|
$.git(root, function (err, result) {
|
||||||
cmd = 'git',
|
|
||||||
args = ['rev-parse', '--short', 'HEAD'],
|
|
||||||
options = {},
|
|
||||||
proc = child_process.spawn(cmd, args, options);
|
|
||||||
|
|
||||||
proc.stdout.on('data', function (data) {
|
pkg.version += '-' + result.revListOriginMasterHead.length + '-' + result.revParseHead.slice(0, 7);
|
||||||
hash += ('' + data).replace(/\s*/g, '');
|
Event.info({
|
||||||
});
|
method: 'check-version',
|
||||||
proc.on('exit', function (code) {
|
message: 'version set to ' + pkg.version
|
||||||
if (code) {
|
|
||||||
Event.error({ method: 'git-hash', message: cmd + ' exit code ' + code });
|
|
||||||
fail();
|
|
||||||
} else {
|
|
||||||
pkg.version += '-' + hash;
|
|
||||||
Event.ok({ method: 'git-hash', message: 'version is now ' + pkg.version });
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
done();
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
make.target('clean', [], 'delete build folder')
|
make.target('clean', [], 'delete build folder')
|
||||||
@@ -109,7 +98,7 @@ module.exports = function (make) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
make.target('build', ['git-hash'], 'build all updated files')
|
make.target('build', ['check-version'], 'build all updated files')
|
||||||
.sync(function () {
|
.sync(function () {
|
||||||
|
|
||||||
var scriptName = pkg.name;
|
var scriptName = pkg.name;
|
||||||
|
|||||||
Reference in New Issue
Block a user