aboutsummaryrefslogtreecommitdiffstats
path: root/src/models/Recipe.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Recipe.js')
-rw-r--r--src/models/Recipe.js21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/models/Recipe.js b/src/models/Recipe.js
index 4db056f26..0d97d4472 100644
--- a/src/models/Recipe.js
+++ b/src/models/Recipe.js
@@ -1,9 +1,9 @@
1import emailParser from 'address-rfc2822';
2import semver from 'semver'; 1import semver from 'semver';
3import fs from 'fs-extra'; 2import { pathExistsSync } from 'fs-extra';
4import path from 'path'; 3import { join } from 'path';
5 4
6export default class Recipe { 5export default class Recipe {
6 // Note: Do NOT change these default values. If they change, then the corresponding changes in the recipes needs to be done
7 id = ''; 7 id = '';
8 8
9 name = ''; 9 name = '';
@@ -12,6 +12,8 @@ export default class Recipe {
12 12
13 version = ''; 13 version = '';
14 14
15 aliases = [];
16
15 path = ''; 17 path = '';
16 18
17 serviceURL = ''; 19 serviceURL = '';
@@ -60,9 +62,8 @@ export default class Recipe {
60 62
61 this.id = data.id || this.id; 63 this.id = data.id || this.id;
62 this.name = data.name || this.name; 64 this.name = data.name || this.name;
63 this.rawAuthor = data.author || this.author;
64 this.description = data.description || this.description;
65 this.version = data.version || this.version; 65 this.version = data.version || this.version;
66 this.aliases = data.aliases || this.aliases;
66 this.path = data.path; 67 this.path = data.path;
67 68
68 this.serviceURL = data.config.serviceURL || this.serviceURL; 69 this.serviceURL = data.config.serviceURL || this.serviceURL;
@@ -86,18 +87,12 @@ export default class Recipe {
86 this.message = data.config.message || this.message; 87 this.message = data.config.message || this.message;
87 } 88 }
88 89
90 // TODO: Need to remove this if its not used anywhere
89 get author() { 91 get author() {
90 try {
91 const addresses = emailParser.parse(this.rawAuthor);
92 return addresses.map(a => ({ email: a.address, name: a.phrase }));
93 } catch (err) {
94 console.warn(`Not a valid author for ${this.name}`);
95 }
96
97 return []; 92 return [];
98 } 93 }
99 94
100 get hasDarkMode() { 95 get hasDarkMode() {
101 return fs.pathExistsSync(path.join(this.path, 'darkmode.css')); 96 return pathExistsSync(join(this.path, 'darkmode.css'));
102 } 97 }
103} 98}