aboutsummaryrefslogtreecommitdiffstats
path: root/src/helpers/recipe-helpers.js
diff options
context:
space:
mode:
authorLibravatar Vijay A <avijayr@protonmail.com>2021-08-15 17:15:09 +0530
committerLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-08-15 13:54:00 +0000
commitbc76d19c6f5687dd18c96db249e0abe7ad79a673 (patch)
treed4e977f99be77d723ce93bb3866468d8b63ec038 /src/helpers/recipe-helpers.js
parentchore: npm upgrades (diff)
downloadferdium-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.js34
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 @@
1import { parse } from 'path';
2import { userDataRecipesPath } from '../environment';
3
4export function getRecipeDirectory(id = '') {
5 return userDataRecipesPath(id);
6}
7
8export function getDevRecipeDirectory(id = '') {
9 return userDataRecipesPath('dev', id);
10}
11
12export 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
31module.paths.unshift(
32 getDevRecipeDirectory(),
33 getRecipeDirectory(),
34);