Change subtitle heading to new slogan
- Unify reading subtitle/slogan throughout the application. - Refactor related unit tests for easier future changes. - Add typed constants for Vue app environment variables.
This commit is contained in:
@@ -3,13 +3,26 @@ import { ProjectInformation } from '@/domain/ProjectInformation';
|
||||
import { Version } from '@/domain/Version';
|
||||
|
||||
export function parseProjectInformation(
|
||||
environment: NodeJS.ProcessEnv,
|
||||
environment: NodeJS.ProcessEnv | VueAppEnvironment,
|
||||
): IProjectInformation {
|
||||
const version = new Version(environment.VUE_APP_VERSION);
|
||||
const version = new Version(environment[VueAppEnvironmentKeys.VUE_APP_VERSION]);
|
||||
return new ProjectInformation(
|
||||
environment.VUE_APP_NAME,
|
||||
environment[VueAppEnvironmentKeys.VUE_APP_NAME],
|
||||
version,
|
||||
environment.VUE_APP_REPOSITORY_URL,
|
||||
environment.VUE_APP_HOMEPAGE_URL,
|
||||
environment[VueAppEnvironmentKeys.VUE_APP_SLOGAN],
|
||||
environment[VueAppEnvironmentKeys.VUE_APP_REPOSITORY_URL],
|
||||
environment[VueAppEnvironmentKeys.VUE_APP_HOMEPAGE_URL],
|
||||
);
|
||||
}
|
||||
|
||||
export const VueAppEnvironmentKeys = {
|
||||
VUE_APP_VERSION: 'VUE_APP_VERSION',
|
||||
VUE_APP_NAME: 'VUE_APP_NAME',
|
||||
VUE_APP_SLOGAN: 'VUE_APP_SLOGAN',
|
||||
VUE_APP_REPOSITORY_URL: 'VUE_APP_REPOSITORY_URL',
|
||||
VUE_APP_HOMEPAGE_URL: 'VUE_APP_HOMEPAGE_URL',
|
||||
} as const;
|
||||
|
||||
export type VueAppEnvironment = {
|
||||
[K in keyof typeof VueAppEnvironmentKeys]: string;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user