Move __version__ to a script

This commit is contained in:
Peter deHaan 2017-06-23 16:53:17 -07:00
parent 2b01bb75dc
commit 314e756ef1
No known key found for this signature in database
GPG key ID: F0FC6C01C6305097
4 changed files with 28 additions and 13 deletions

20
scripts/version.js Executable file
View file

@ -0,0 +1,20 @@
const fs = require('fs');
const path = require('path');
const pkg = require('../package.json');
let commit;
try {
commit = require('git-rev-sync').short();
} catch (err) {
// Whatever...
}
const filename = path.join(__dirname, '..', 'public', 'version.json');
const filedata = {
commit,
source: pkg.homepage,
version: pkg.version
};
fs.writeFileSync(filename, JSON.stringify(filedata, null, 2) + '\n');