diff options
author | 2021-08-15 17:15:09 +0530 | |
---|---|---|
committer | 2021-08-15 13:54:00 +0000 | |
commit | bc76d19c6f5687dd18c96db249e0abe7ad79a673 (patch) | |
tree | d4e977f99be77d723ce93bb3866468d8b63ec038 /src/helpers/recipe-helpers.js | |
parent | chore: npm upgrades (diff) | |
download | ferdium-app-bc76d19c6f5687dd18c96db249e0abe7ad79a673.tar.gz ferdium-app-bc76d19c6f5687dd18c96db249e0abe7ad79a673.tar.zst ferdium-app-bc76d19c6f5687dd18c96db249e0abe7ad79a673.zip |
chore: typescript conversion of some minor utilities
Also removed 'targz' unused package from runtime.
Diffstat (limited to 'src/helpers/recipe-helpers.js')
-rw-r--r-- | src/helpers/recipe-helpers.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/helpers/recipe-helpers.js b/src/helpers/recipe-helpers.js deleted file mode 100644 index 7e4bfa85a..000000000 --- a/src/helpers/recipe-helpers.js +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | import { parse } from 'path'; | ||
2 | import { userDataRecipesPath } from '../environment'; | ||
3 | |||
4 | export function getRecipeDirectory(id = '') { | ||
5 | return userDataRecipesPath(id); | ||
6 | } | ||
7 | |||
8 | export function getDevRecipeDirectory(id = '') { | ||
9 | return userDataRecipesPath('dev', id); | ||
10 | } | ||
11 | |||
12 | export function loadRecipeConfig(recipeId) { | ||
13 | try { | ||
14 | const configPath = `${recipeId}/package.json`; | ||
15 | // Delete module from cache | ||
16 | delete require.cache[require.resolve(configPath)]; | ||
17 | |||
18 | // eslint-disable-next-line | ||
19 | let config = require(configPath); | ||
20 | |||
21 | const moduleConfigPath = require.resolve(configPath); | ||
22 | config.path = parse(moduleConfigPath).dir; | ||
23 | |||
24 | return config; | ||
25 | } catch (e) { | ||
26 | console.error(e); | ||
27 | return null; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | module.paths.unshift( | ||
32 | getDevRecipeDirectory(), | ||
33 | getRecipeDirectory(), | ||
34 | ); | ||