send/scripts/version.js
2017-08-15 11:55:52 -07:00

20 lines
447 B
JavaScript
Executable file

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, '..', 'dist', 'version.json');
const filedata = {
commit,
source: pkg.homepage,
version: process.env.CIRCLE_TAG || `v${pkg.version}`
};
fs.writeFileSync(filename, JSON.stringify(filedata, null, 2) + '\n');