diff options
Diffstat (limited to 'src/models/Recipe.js')
-rw-r--r-- | src/models/Recipe.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/models/Recipe.js b/src/models/Recipe.js index 1fc23ac89..43c44514c 100644 --- a/src/models/Recipe.js +++ b/src/models/Recipe.js | |||
@@ -1,5 +1,7 @@ | |||
1 | import emailParser from 'address-rfc2822'; | 1 | import emailParser from 'address-rfc2822'; |
2 | import semver from 'semver'; | 2 | import semver from 'semver'; |
3 | import fs from 'fs-extra'; | ||
4 | import path from 'path'; | ||
3 | 5 | ||
4 | export default class Recipe { | 6 | export default class Recipe { |
5 | id = ''; | 7 | id = ''; |
@@ -32,8 +34,12 @@ export default class Recipe { | |||
32 | throw Error(`Recipe '${data.name}' requires Id`); | 34 | throw Error(`Recipe '${data.name}' requires Id`); |
33 | } | 35 | } |
34 | 36 | ||
35 | if (!semver.valid(data.version)) { | 37 | try { |
36 | throw Error(`Version ${data.version} of recipe '${data.name}' is not a valid semver version`); | 38 | if (!semver.valid(data.version)) { |
39 | throw Error(`Version ${data.version} of recipe '${data.name}' is not a valid semver version`); | ||
40 | } | ||
41 | } catch (e) { | ||
42 | console.warn(e.message); | ||
37 | } | 43 | } |
38 | 44 | ||
39 | this.id = data.id || this.id; | 45 | this.id = data.id || this.id; |
@@ -69,4 +75,8 @@ export default class Recipe { | |||
69 | 75 | ||
70 | return []; | 76 | return []; |
71 | } | 77 | } |
78 | |||
79 | get hasDarkMode() { | ||
80 | return fs.pathExistsSync(path.join(this.path, 'darkmode.css')); | ||
81 | } | ||
72 | } | 82 | } |