2017-06-24 01:53:17 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
const path = require('path');
|
|
|
|
const pkg = require('../package.json');
|
2017-08-16 06:47:34 +02:00
|
|
|
const mkdirp = require('mkdirp');
|
2017-06-24 01:53:17 +02:00
|
|
|
|
|
|
|
let commit;
|
|
|
|
|
|
|
|
try {
|
|
|
|
commit = require('git-rev-sync').short();
|
|
|
|
} catch (err) {
|
|
|
|
// Whatever...
|
|
|
|
}
|
|
|
|
|
2017-08-16 06:47:34 +02:00
|
|
|
const filename = path.join(__dirname, '..', 'dist', 'public', 'version.json');
|
2017-06-24 01:53:17 +02:00
|
|
|
const filedata = {
|
|
|
|
commit,
|
|
|
|
source: pkg.homepage,
|
2017-08-03 01:50:58 +02:00
|
|
|
version: process.env.CIRCLE_TAG || `v${pkg.version}`
|
2017-06-24 01:53:17 +02:00
|
|
|
};
|
2017-08-16 06:47:34 +02:00
|
|
|
mkdirp.sync(path.dirname(filename));
|
2017-06-24 01:53:17 +02:00
|
|
|
fs.writeFileSync(filename, JSON.stringify(filedata, null, 2) + '\n');
|