From 38e0aff159dc5d5ecdef8fa012af8181d16f988c Mon Sep 17 00:00:00 2001 From: ssube Date: Tue, 17 Sep 2019 08:57:45 -0500 Subject: [PATCH] feat(bundle): add version info --- README.md | 7 +++++++ config/rollup.js | 6 +++--- src/app.ts | 4 +++- src/version.ts | 15 +++++++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 src/version.ts diff --git a/README.md b/README.md index e2655de..c60565e 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/config/rollup.js b/config/rollup.js index 3fea125..d966d32 100644 --- a/config/rollup.js +++ b/config/rollup.js @@ -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({ diff --git a/src/app.ts b/src/app.ts index d2a26d5..6febc7f 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,4 +1,6 @@ +import { VERSION_INFO } from './version'; + export async function createApp(): Promise { // tslint:disable-next-line:no-console - console.log('Hello World!'); + console.log('Hello World!', VERSION_INFO); } diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 0000000..03518c3 --- /dev/null +++ b/src/version.ts @@ -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 }}', + }, +};