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;
|
||||
};
|
||||
|
||||
@@ -4,6 +4,8 @@ import { Version } from '@/domain/Version';
|
||||
export interface IProjectInformation {
|
||||
readonly name: string;
|
||||
readonly version: Version;
|
||||
|
||||
readonly slogan: string;
|
||||
readonly repositoryUrl: string;
|
||||
readonly homepage: string;
|
||||
readonly feedbackUrl: string;
|
||||
|
||||
@@ -9,6 +9,7 @@ export class ProjectInformation implements IProjectInformation {
|
||||
constructor(
|
||||
public readonly name: string,
|
||||
public readonly version: Version,
|
||||
public readonly slogan: string,
|
||||
public readonly repositoryUrl: string,
|
||||
public readonly homepage: string,
|
||||
) {
|
||||
@@ -18,6 +19,9 @@ export class ProjectInformation implements IProjectInformation {
|
||||
if (!version) {
|
||||
throw new Error('undefined version');
|
||||
}
|
||||
if (!slogan) {
|
||||
throw new Error('undefined slogan');
|
||||
}
|
||||
if (!repositoryUrl) {
|
||||
throw new Error('repositoryUrl is undefined');
|
||||
}
|
||||
|
||||
@@ -148,7 +148,8 @@ function getLanguage(language: ScriptingLanguage) {
|
||||
function getDefaultCode(language: ScriptingLanguage): string {
|
||||
return new CodeBuilderFactory()
|
||||
.create(language)
|
||||
.appendCommentLine('privacy.sexy — 🔐 Enforce privacy & security best-practices on Windows and macOS')
|
||||
.appendCommentLine('privacy.sexy — Now you have the choice.')
|
||||
.appendCommentLine(' 🔐 Enforce privacy & security best-practices on Windows, macOS and Linux.')
|
||||
.appendLine()
|
||||
.appendCommentLine('-- 🤔 How to use')
|
||||
.appendCommentLine(' 📙 Start by exploring different categories and choosing different tweaks.')
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div id="container">
|
||||
<h1 class="child title" >{{ title }}</h1>
|
||||
<h2 class="child subtitle">Enforce privacy & security on Windows, macOS and Linux</h2>
|
||||
<h2 class="child subtitle">Now you have the choice</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -18,6 +18,7 @@ export default class TheHeader extends Vue {
|
||||
public async created() {
|
||||
const app = await ApplicationFactory.Current.getApp();
|
||||
this.title = app.info.name;
|
||||
this.subtitle = app.info.slogan;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -32,6 +32,7 @@ function getTargetProject(targetVersion: string) {
|
||||
const targetProject = new ProjectInformation(
|
||||
existingProject.name,
|
||||
new Version(targetVersion),
|
||||
existingProject.slogan,
|
||||
existingProject.repositoryUrl,
|
||||
existingProject.homepage,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user