diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-08-08 00:01:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-08 05:31:37 +0530 |
commit | 97d51a7763b14c92ee71ff9a012311dd9498d803 (patch) | |
tree | bd36005031ecb1148f27aa541e7a92a5e3aa4c0c /src/stores/RecipesStore.js | |
parent | 5.6.1-nightly.17 [skip ci] (diff) | |
download | ferdium-app-97d51a7763b14c92ee71ff9a012311dd9498d803.tar.gz ferdium-app-97d51a7763b14c92ee71ff9a012311dd9498d803.tar.zst ferdium-app-97d51a7763b14c92ee71ff9a012311dd9498d803.zip |
refactor: path-references refactoring and using 'import' instead of 'require' (#1752)
* refactor references to 'userData' and 'appData' directories to move hardcoding into single location
* convert to es6 for lower memory usage as per https://codesource.io/the-difference-between-import-and-require-in-javascript/
Diffstat (limited to 'src/stores/RecipesStore.js')
-rw-r--r-- | src/stores/RecipesStore.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/stores/RecipesStore.js b/src/stores/RecipesStore.js index c7c4c1deb..d2acebb75 100644 --- a/src/stores/RecipesStore.js +++ b/src/stores/RecipesStore.js | |||
@@ -1,13 +1,12 @@ | |||
1 | import { action, computed, observable } from 'mobx'; | 1 | import { action, computed, observable } from 'mobx'; |
2 | import fs from 'fs-extra'; | 2 | import { readJSONSync } from 'fs-extra'; |
3 | import path from 'path'; | ||
4 | import semver from 'semver'; | 3 | import semver from 'semver'; |
5 | 4 | ||
6 | import Store from './lib/Store'; | 5 | import Store from './lib/Store'; |
7 | import CachedRequest from './lib/CachedRequest'; | 6 | import CachedRequest from './lib/CachedRequest'; |
8 | import Request from './lib/Request'; | 7 | import Request from './lib/Request'; |
9 | import { matchRoute } from '../helpers/routing-helpers'; | 8 | import { matchRoute } from '../helpers/routing-helpers'; |
10 | import { RECIPES_PATH } from '../environment'; | 9 | import { asarRecipesPath } from '../environment'; |
11 | 10 | ||
12 | const debug = require('debug')('Ferdi:RecipeStore'); | 11 | const debug = require('debug')('Ferdi:RecipeStore'); |
13 | 12 | ||
@@ -90,8 +89,8 @@ export default class RecipesStore extends Store { | |||
90 | const remoteUpdates = await this.getRecipeUpdatesRequest.execute(recipes)._promise; | 89 | const remoteUpdates = await this.getRecipeUpdatesRequest.execute(recipes)._promise; |
91 | 90 | ||
92 | // Check for local updates | 91 | // Check for local updates |
93 | const allJsonFile = path.join(RECIPES_PATH, 'all.json'); | 92 | const allJsonFile = asarRecipesPath('all.json'); |
94 | const allJson = await fs.readJSON(allJsonFile); | 93 | const allJson = readJSONSync(allJsonFile); |
95 | const localUpdates = []; | 94 | const localUpdates = []; |
96 | 95 | ||
97 | Object.keys(recipes).forEach((recipe) => { | 96 | Object.keys(recipes).forEach((recipe) => { |