reading version from package.json instead of version file #5
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "privacy.sexy",
|
"name": "privacy.sexy",
|
||||||
"version": "0.1.0",
|
"version": "0.4.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "vue-cli-service serve",
|
"serve": "vue-cli-service serve",
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export function parseApplication(): Application {
|
|||||||
const app = new Application(
|
const app = new Application(
|
||||||
applicationFile.name,
|
applicationFile.name,
|
||||||
applicationFile.repositoryUrl,
|
applicationFile.repositoryUrl,
|
||||||
applicationFile.version,
|
process.env.VUE_APP_VERSION,
|
||||||
categories);
|
categories);
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export class ApplicationState implements IApplicationState {
|
|||||||
/** Initially selected scripts */
|
/** Initially selected scripts */
|
||||||
public readonly defaultScripts: Script[]) {
|
public readonly defaultScripts: Script[]) {
|
||||||
this.selection = new UserSelection(app, defaultScripts);
|
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);
|
this.filter = new UserFilter(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
name: privacy.sexy
|
name: privacy.sexy
|
||||||
version: 0.4.2
|
|
||||||
repositoryUrl: https://github.com/undergroundwires/privacy.sexy
|
repositoryUrl: https://github.com/undergroundwires/privacy.sexy
|
||||||
actions:
|
actions:
|
||||||
-
|
-
|
||||||
|
|||||||
1
src/application/application.yaml.d.ts
vendored
1
src/application/application.yaml.d.ts
vendored
@@ -19,7 +19,6 @@ declare module 'js-yaml-loader!*' {
|
|||||||
|
|
||||||
interface ApplicationYaml {
|
interface ApplicationYaml {
|
||||||
name: string;
|
name: string;
|
||||||
version: number;
|
|
||||||
repositoryUrl: string;
|
repositoryUrl: string;
|
||||||
actions: ReadonlyArray<YamlCategory>;
|
actions: ReadonlyArray<YamlCategory>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,11 +12,11 @@ export class Application implements IApplication {
|
|||||||
constructor(
|
constructor(
|
||||||
public readonly name: string,
|
public readonly name: string,
|
||||||
public readonly repositoryUrl: string,
|
public readonly repositoryUrl: string,
|
||||||
public readonly version: number,
|
public readonly version: string,
|
||||||
public readonly categories: ReadonlyArray<ICategory>) {
|
public readonly categories: ReadonlyArray<ICategory>) {
|
||||||
if (!name) { throw Error('Application has no name'); }
|
if (!name) { throw Error('Application has no name'); }
|
||||||
if (!repositoryUrl) { throw Error('Application has no repository url'); }
|
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);
|
this.flattened = flatten(categories);
|
||||||
if (this.flattened.allCategories.length === 0) {
|
if (this.flattened.allCategories.length === 0) {
|
||||||
throw new Error('Application must consist of at least one category');
|
throw new Error('Application must consist of at least one category');
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { ICategory } from '@/domain/ICategory';
|
|||||||
export interface IApplication {
|
export interface IApplication {
|
||||||
readonly name: string;
|
readonly name: string;
|
||||||
readonly repositoryUrl: string;
|
readonly repositoryUrl: string;
|
||||||
readonly version: number;
|
readonly version: string;
|
||||||
readonly categories: ReadonlyArray<ICategory>;
|
readonly categories: ReadonlyArray<ICategory>;
|
||||||
readonly totalScripts: number;
|
readonly totalScripts: number;
|
||||||
readonly totalCategories: number;
|
readonly totalCategories: number;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ describe('Application', () => {
|
|||||||
new ScriptStub('S3').withIsRecommended(true),
|
new ScriptStub('S3').withIsRecommended(true),
|
||||||
new ScriptStub('S4').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(3).withScripts(expected[0], new ScriptStub('S1').withIsRecommended(false)),
|
||||||
new CategoryStub(2).withScripts(expected[1], new ScriptStub('S2').withIsRecommended(false)),
|
new CategoryStub(2).withScripts(expected[1], new ScriptStub('S2').withIsRecommended(false)),
|
||||||
]);
|
]);
|
||||||
@@ -28,7 +28,7 @@ describe('Application', () => {
|
|||||||
const categories = [];
|
const categories = [];
|
||||||
|
|
||||||
// act
|
// act
|
||||||
function construct() { return new Application('name', 'repo', 2, categories); }
|
function construct() { return new Application('name', 'repo', '0.1.0', categories); }
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(construct).to.throw('Application must consist of at least one category');
|
expect(construct).to.throw('Application must consist of at least one category');
|
||||||
@@ -41,7 +41,7 @@ describe('Application', () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// act
|
// act
|
||||||
function construct() { return new Application('name', 'repo', 2, categories); }
|
function construct() { return new Application('name', 'repo', '0.1.0', categories); }
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(construct).to.throw('Application must consist of at least one script');
|
expect(construct).to.throw('Application must consist of at least one script');
|
||||||
@@ -54,7 +54,7 @@ describe('Application', () => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// act
|
// act
|
||||||
function construct() { return new Application('name', 'repo', 2, categories); }
|
function construct() { return new Application('name', 'repo', '0.1.0', categories); }
|
||||||
|
|
||||||
// assert
|
// assert
|
||||||
expect(construct).to.throw('Application must consist of at least one recommended script');
|
expect(construct).to.throw('Application must consist of at least one recommended script');
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export class ApplicationStub implements IApplication {
|
|||||||
public readonly totalCategories = 0;
|
public readonly totalCategories = 0;
|
||||||
public readonly name = 'StubApplication';
|
public readonly name = 'StubApplication';
|
||||||
public readonly repositoryUrl = 'https://privacy.sexy';
|
public readonly repositoryUrl = 'https://privacy.sexy';
|
||||||
public readonly version = 1;
|
public readonly version = '0.1.0';
|
||||||
public readonly categories = new Array<ICategory>();
|
public readonly categories = new Array<ICategory>();
|
||||||
|
|
||||||
public withCategory(category: ICategory): IApplication {
|
public withCategory(category: ICategory): IApplication {
|
||||||
|
|||||||
1
vue.config.js
Normal file
1
vue.config.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
process.env.VUE_APP_VERSION = require('./package.json').version;
|
||||||
Reference in New Issue
Block a user