diff --git a/package.json b/package.json index 4f1bf1dc..581dbd2a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "privacy.sexy", - "version": "0.1.0", + "version": "0.4.3", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/src/application/Parser/ApplicationParser.ts b/src/application/Parser/ApplicationParser.ts index 03195e22..73163c53 100644 --- a/src/application/Parser/ApplicationParser.ts +++ b/src/application/Parser/ApplicationParser.ts @@ -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; } diff --git a/src/application/State/ApplicationState.ts b/src/application/State/ApplicationState.ts index d1d207ac..2e2c12c9 100644 --- a/src/application/State/ApplicationState.ts +++ b/src/application/State/ApplicationState.ts @@ -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); } } diff --git a/src/application/application.yaml b/src/application/application.yaml index cc7e77fd..9843f800 100644 --- a/src/application/application.yaml +++ b/src/application/application.yaml @@ -1,5 +1,4 @@ name: privacy.sexy -version: 0.4.2 repositoryUrl: https://github.com/undergroundwires/privacy.sexy actions: - diff --git a/src/application/application.yaml.d.ts b/src/application/application.yaml.d.ts index 7a181a38..7a09408f 100644 --- a/src/application/application.yaml.d.ts +++ b/src/application/application.yaml.d.ts @@ -19,7 +19,6 @@ declare module 'js-yaml-loader!*' { interface ApplicationYaml { name: string; - version: number; repositoryUrl: string; actions: ReadonlyArray; } diff --git a/src/domain/Application.ts b/src/domain/Application.ts index 5f11eef3..d22038af 100644 --- a/src/domain/Application.ts +++ b/src/domain/Application.ts @@ -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) { 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'); diff --git a/src/domain/IApplication.ts b/src/domain/IApplication.ts index b5146c8e..97bbcc12 100644 --- a/src/domain/IApplication.ts +++ b/src/domain/IApplication.ts @@ -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; readonly totalScripts: number; readonly totalCategories: number; diff --git a/tests/unit/domain/Application.spec.ts b/tests/unit/domain/Application.spec.ts index 261abcf4..6a267681 100644 --- a/tests/unit/domain/Application.spec.ts +++ b/tests/unit/domain/Application.spec.ts @@ -11,7 +11,7 @@ describe('Application', () => { new ScriptStub('S3').withIsRecommended(true), new ScriptStub('S4').withIsRecommended(true), ]; - const sut = new Application('name', 'repo', 2, [ + const sut = new Application('name', 'repo', '0.1.0', [ new CategoryStub(3).withScripts(expected[0], new ScriptStub('S1').withIsRecommended(false)), new CategoryStub(2).withScripts(expected[1], new ScriptStub('S2').withIsRecommended(false)), ]); @@ -28,7 +28,7 @@ describe('Application', () => { const categories = []; // act - function construct() { return new Application('name', 'repo', 2, categories); } + function construct() { return new Application('name', 'repo', '0.1.0', categories); } // assert expect(construct).to.throw('Application must consist of at least one category'); @@ -41,7 +41,7 @@ describe('Application', () => { ]; // act - function construct() { return new Application('name', 'repo', 2, categories); } + function construct() { return new Application('name', 'repo', '0.1.0', categories); } // assert expect(construct).to.throw('Application must consist of at least one script'); @@ -54,7 +54,7 @@ describe('Application', () => { ]; // act - function construct() { return new Application('name', 'repo', 2, categories); } + function construct() { return new Application('name', 'repo', '0.1.0', categories); } // assert expect(construct).to.throw('Application must consist of at least one recommended script'); diff --git a/tests/unit/stubs/ApplicationStub.ts b/tests/unit/stubs/ApplicationStub.ts index 750e28b7..ebf890cc 100644 --- a/tests/unit/stubs/ApplicationStub.ts +++ b/tests/unit/stubs/ApplicationStub.ts @@ -5,7 +5,7 @@ export class ApplicationStub implements IApplication { public readonly totalCategories = 0; public readonly name = 'StubApplication'; public readonly repositoryUrl = 'https://privacy.sexy'; - public readonly version = 1; + public readonly version = '0.1.0'; public readonly categories = new Array(); public withCategory(category: ICategory): IApplication { diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 00000000..c0820935 --- /dev/null +++ b/vue.config.js @@ -0,0 +1 @@ +process.env.VUE_APP_VERSION = require('./package.json').version; \ No newline at end of file