send/scripts/version.js

21 lines
447 B
JavaScript
Raw Normal View History

2017-06-23 23:53:17 +00:00
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...
}
2017-08-15 18:55:52 +00:00
const filename = path.join(__dirname, '..', 'dist', 'version.json');
2017-06-23 23:53:17 +00:00
const filedata = {
commit,
source: pkg.homepage,
2017-08-02 23:50:58 +00:00
version: process.env.CIRCLE_TAG || `v${pkg.version}`
2017-06-23 23:53:17 +00:00
};
fs.writeFileSync(filename, JSON.stringify(filedata, null, 2) + '\n');