Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Fixing versioning.
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Sep 28, 2018
1 parent aeb3697 commit 8c73b78
Show file tree
Hide file tree
Showing 4 changed files with 814 additions and 851 deletions.
1 change: 1 addition & 0 deletions ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
npm-debug.log
testem.log
/typings
/src/environments/versions.ts

# e2e
/e2e/*.js
Expand Down
27 changes: 21 additions & 6 deletions ui/git.version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,31 @@ const branch = new Observable<string>(s => {
});
});

combineLatest(revision, branch)
.subscribe(([revision, branch]) => {
console.log(`version: '${process.env.npm_package_version}', revision: '${revision}', branch: '${branch}'`);
const tag = new Observable<string>(s => {
exec('git describe --abbrev=0 --tags',
function (error: Error, stdout: Buffer, stderr: Buffer) {
if (error !== null) {
console.log('git error: ' + error + stderr);
}
s.next(stdout.toString().trim());
s.complete();
});
});

const content = '// this file is automatically generated by git.version.ts script\n' +
`export const versions = {version: '${process.env.npm_package_version}', revision: '${revision}', branch: '${branch}'};`;
combineLatest(revision, branch, tag)
.subscribe(([revision, branch, tag]) => {
console.log(`version: '${process.env.npm_package_version}', revision: '${revision}', branch: '${branch}', tag: '${tag}'`);

const content = '// this file is automatically generated by git.version.ts script\n' +
`export const versions = {
version: '${process.env.npm_package_version}',
revision: '${revision}',
branch: '${branch}',
tag: '${tag}'};`;

fs.writeFileSync(
'src/environments/versions.ts',
content,
{ encoding: 'utf8' }
);
});
});
2 changes: 0 additions & 2 deletions ui/src/environments/versions.ts

This file was deleted.

Loading

0 comments on commit 8c73b78

Please sign in to comment.