1
0
Fork 0

feat(bundle): add version info

This commit is contained in:
ssube 2019-09-17 08:57:45 -05:00
parent 1262c6dad4
commit 38e0aff159
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
4 changed files with 28 additions and 4 deletions

View File

@ -28,6 +28,7 @@ This project contains the base configuration and build scripts for most of my Ty
- [Daily](#daily)
- [External Services](#external-services)
- [Maintenance Bots](#maintenance-bots)
- [External Secrets](#external-secrets)
## Features
@ -90,3 +91,9 @@ configured to work with:
- [SonarCloud](https://sonarcloud.io/)
None of these are required, but Renovate and Snyk can be very helpful when dependencies release a security patch.
## External Secrets
This template expects a few secrets to exist in the environment, including tokens for the [external services](#external-services).
**TODO:** doc secrets

View File

@ -45,7 +45,7 @@ const bundle = {
format: 'cjs',
sourcemap: true,
banner: () => {
return shebang;
return ''; // @TODO: return shebang for executable scripts
},
},
plugins: [
@ -54,13 +54,13 @@ const bundle = {
replace({
delimiters: ['{{ ', ' }}'],
values: {
APP_NAME: metadata.name,
APP_VERSION: metadata.version,
BUILD_JOB: process.env['CI_JOB_ID'],
BUILD_RUNNER: process.env['CI_RUNNER_DESCRIPTION'],
GIT_BRANCH: process.env['CI_COMMIT_REF_SLUG'],
GIT_COMMIT: process.env['CI_COMMIT_SHA'],
NODE_VERSION: process.env['NODE_VERSION'],
PACKAGE_NAME: metadata.name,
PACKAGE_VERSION: metadata.version,
},
}),
resolve({

View File

@ -1,4 +1,6 @@
import { VERSION_INFO } from './version';
export async function createApp(): Promise<void> {
// tslint:disable-next-line:no-console
console.log('Hello World!');
console.log('Hello World!', VERSION_INFO);
}

15
src/version.ts Normal file
View File

@ -0,0 +1,15 @@
export const VERSION_INFO = {
build: {
job: '{{ BUILD_JOB }}',
node: '{{ NODE_VERSION }}',
runner: '{{ BUILD_RUNNER }}',
},
git: {
branch: '{{ GIT_BRANCH }}',
commit: '{{ GIT_COMMIT }}',
},
package: {
name: '{{ PACKAGE_NAME }}',
version: '{{ PACKAGE_VERSION }}',
},
};