forked from openMF/webapp-microfrontends
-
Notifications
You must be signed in to change notification settings - Fork 0
/
version.js
27 lines (23 loc) · 804 Bytes
/
version.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const { gitDescribeSync } = require('git-describe');
const { resolve, relative } = require('path');
const { writeFileSync } = require('fs-extra');
const moment = require('moment');
const gitInfo = gitDescribeSync({
dirtyMark: false,
dirtySemver: false
});
gitInfo.version = moment().format('YYMMDD');;
const file = resolve(__dirname, '.', 'src', '../../environments', '.env.ts');
writeFileSync(file,
`// IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN!
/* tslint:disable */
export default {
'mifos_x': {
'version': '${gitInfo.version}',
'hash': '${gitInfo.hash}'
},
'allow_switching_backend_instance': true
};
/* tslint:enable */
`, { encoding: 'utf-8' });
console.log(`Wrote version info ${gitInfo.raw} to ${relative(resolve(__dirname, '..'), file)}`);