refactor build scripts
This commit is contained in:
parent
8460eede78
commit
23f7f56f3f
110 changed files with 512 additions and 954 deletions
|
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var shell = require('shelljs');
|
||||
|
||||
var getCommitHash = function() {
|
||||
//exec git command to get the hash of the current commit
|
||||
//git rev-parse HEAD
|
||||
|
||||
var hash = shell.exec('git rev-parse HEAD', {
|
||||
silent: true
|
||||
}).output.trim().substr(0, 7);
|
||||
return hash;
|
||||
}
|
||||
|
||||
var commitHash = getCommitHash();
|
||||
var json = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
||||
console.log('v' + json.version + ' #' + commitHash);
|
||||
|
||||
var content = 'window.version="' + json.version + '";';
|
||||
content = content + '\nwindow.commitHash="' + commitHash + '";';
|
||||
fs.writeFileSync("./src/js/version.js", content);
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue