feat(bundle): add version info
This commit is contained in:
parent
1262c6dad4
commit
38e0aff159
|
@ -28,6 +28,7 @@ This project contains the base configuration and build scripts for most of my Ty
|
||||||
- [Daily](#daily)
|
- [Daily](#daily)
|
||||||
- [External Services](#external-services)
|
- [External Services](#external-services)
|
||||||
- [Maintenance Bots](#maintenance-bots)
|
- [Maintenance Bots](#maintenance-bots)
|
||||||
|
- [External Secrets](#external-secrets)
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
@ -90,3 +91,9 @@ configured to work with:
|
||||||
- [SonarCloud](https://sonarcloud.io/)
|
- [SonarCloud](https://sonarcloud.io/)
|
||||||
|
|
||||||
None of these are required, but Renovate and Snyk can be very helpful when dependencies release a security patch.
|
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
|
||||||
|
|
|
@ -45,7 +45,7 @@ const bundle = {
|
||||||
format: 'cjs',
|
format: 'cjs',
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
banner: () => {
|
banner: () => {
|
||||||
return shebang;
|
return ''; // @TODO: return shebang for executable scripts
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -54,13 +54,13 @@ const bundle = {
|
||||||
replace({
|
replace({
|
||||||
delimiters: ['{{ ', ' }}'],
|
delimiters: ['{{ ', ' }}'],
|
||||||
values: {
|
values: {
|
||||||
APP_NAME: metadata.name,
|
|
||||||
APP_VERSION: metadata.version,
|
|
||||||
BUILD_JOB: process.env['CI_JOB_ID'],
|
BUILD_JOB: process.env['CI_JOB_ID'],
|
||||||
BUILD_RUNNER: process.env['CI_RUNNER_DESCRIPTION'],
|
BUILD_RUNNER: process.env['CI_RUNNER_DESCRIPTION'],
|
||||||
GIT_BRANCH: process.env['CI_COMMIT_REF_SLUG'],
|
GIT_BRANCH: process.env['CI_COMMIT_REF_SLUG'],
|
||||||
GIT_COMMIT: process.env['CI_COMMIT_SHA'],
|
GIT_COMMIT: process.env['CI_COMMIT_SHA'],
|
||||||
NODE_VERSION: process.env['NODE_VERSION'],
|
NODE_VERSION: process.env['NODE_VERSION'],
|
||||||
|
PACKAGE_NAME: metadata.name,
|
||||||
|
PACKAGE_VERSION: metadata.version,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
resolve({
|
resolve({
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
import { VERSION_INFO } from './version';
|
||||||
|
|
||||||
export async function createApp(): Promise<void> {
|
export async function createApp(): Promise<void> {
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
console.log('Hello World!');
|
console.log('Hello World!', VERSION_INFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 }}',
|
||||||
|
},
|
||||||
|
};
|
Loading…
Reference in New Issue