reading version from package.json instead of version file #5

This commit is contained in:
undergroundwires
2020-04-26 14:38:16 +01:00
parent 226074c534
commit 691f989682
10 changed files with 12 additions and 13 deletions

View File

@@ -15,7 +15,7 @@ export function parseApplication(): Application {
const app = new Application(
applicationFile.name,
applicationFile.repositoryUrl,
applicationFile.version,
process.env.VUE_APP_VERSION,
categories);
return app;
}

View File

@@ -37,7 +37,7 @@ export class ApplicationState implements IApplicationState {
/** Initially selected scripts */
public readonly defaultScripts: Script[]) {
this.selection = new UserSelection(app, defaultScripts);
this.code = new ApplicationCode(this.selection, app.version.toString());
this.code = new ApplicationCode(this.selection, app.version);
this.filter = new UserFilter(app);
}
}

View File

@@ -1,5 +1,4 @@
name: privacy.sexy
version: 0.4.2
repositoryUrl: https://github.com/undergroundwires/privacy.sexy
actions:
-

View File

@@ -19,7 +19,6 @@ declare module 'js-yaml-loader!*' {
interface ApplicationYaml {
name: string;
version: number;
repositoryUrl: string;
actions: ReadonlyArray<YamlCategory>;
}

View File

@@ -12,11 +12,11 @@ export class Application implements IApplication {
constructor(
public readonly name: string,
public readonly repositoryUrl: string,
public readonly version: number,
public readonly version: string,
public readonly categories: ReadonlyArray<ICategory>) {
if (!name) { throw Error('Application has no name'); }
if (!repositoryUrl) { throw Error('Application has no repository url'); }
if (!version) { throw Error('Version cannot be zero'); }
if (!version) { throw Error('Version cannot be empty'); }
this.flattened = flatten(categories);
if (this.flattened.allCategories.length === 0) {
throw new Error('Application must consist of at least one category');

View File

@@ -4,7 +4,7 @@ import { ICategory } from '@/domain/ICategory';
export interface IApplication {
readonly name: string;
readonly repositoryUrl: string;
readonly version: number;
readonly version: string;
readonly categories: ReadonlyArray<ICategory>;
readonly totalScripts: number;
readonly totalCategories: number;