-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using npm run commands for building angular application (supports `pr…
…e` steps). Automatically embed the application version in the UI.
- Loading branch information
Showing
9 changed files
with
45 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { writeFileSync } from 'fs'; | ||
import { dedent } from 'tslint/lib/utils'; | ||
import { promisify } from 'util'; | ||
import * as child from 'child_process'; | ||
const exec = promisify(child.exec); | ||
|
||
async function createVersionsFile(filename: string) { | ||
const tag = (await exec('git describe --tags')).stdout.toString().trim(); | ||
const revision = (await exec('git rev-parse --short HEAD')).stdout.toString().trim(); | ||
const branch = (await exec('git rev-parse --abbrev-ref HEAD')).stdout.toString().trim(); | ||
|
||
console.log(`version: '${process.env.npm_package_version}', revision: '${revision}', branch: '${branch}'`); | ||
|
||
const content = dedent` | ||
// this file is automatically generated by git.version.ts script | ||
export const versions = { | ||
version: '${tag}', | ||
revision: '${revision}', | ||
branch: '${branch}' | ||
};`; | ||
|
||
writeFileSync(filename, content, {encoding: 'utf8'}); | ||
} | ||
|
||
createVersionsFile('src/environments/versions.ts'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
// this file is automatically generated by git.version.ts script | ||
export const versions = { | ||
version: 'v0.0.0', | ||
revision: 'abcdef123', | ||
branch: 'master' | ||
}; |