@bigbinary/neeto-commons-frontend 4.13.92-beta.4 → 4.13.92-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,21 @@
1
1
  /* eslint-disable @bigbinary/neeto/no-dangling-constants */
2
2
  /* eslint-disable import/extensions */
3
- const translationImports = require("@bigbinary/neeto-commons-frontend/configs/scripts/buildTranslationImports.js");
4
- const englishTranslations = require("@bigbinary/neeto-commons-frontend/configs/scripts/getEnglishTranslation.js");
3
+
4
+ const getUncachedTranslationImports = () => {
5
+ delete require.cache[
6
+ require.resolve("../../scripts/buildTranslationImports.js")
7
+ ];
8
+
9
+ return require("../../scripts/buildTranslationImports.js");
10
+ };
11
+
12
+ const getUncachedEnglishTranslations = () => {
13
+ delete require.cache[
14
+ require.resolve("../../scripts/getEnglishTranslation.js")
15
+ ];
16
+
17
+ return require("../../scripts/getEnglishTranslation.js");
18
+ };
5
19
 
6
20
  const PREVAL_IMPORT_TRANSLATION_IMPORTS =
7
21
  'preval.require("../../configs/scripts/buildTranslationImports.js")';
@@ -22,10 +36,13 @@ const prevalPlugin = () => ({
22
36
  const contents = await fs.readFile(args.path, "utf8");
23
37
 
24
38
  const transformedContent = contents
25
- .replace(PREVAL_IMPORT_TRANSLATION_IMPORTS, translationImports)
39
+ .replace(
40
+ PREVAL_IMPORT_TRANSLATION_IMPORTS,
41
+ getUncachedTranslationImports()
42
+ )
26
43
  .replace(
27
44
  PREVAL_IMPORT_ENGLISH_TRANSLATIONS,
28
- JSON.stringify(englishTranslations)
45
+ JSON.stringify(getUncachedEnglishTranslations())
29
46
  );
30
47
 
31
48
  return { contents: transformedContent, loader: "js" };
@@ -2,9 +2,6 @@ const fs = require("fs");
2
2
  const path = require("path");
3
3
 
4
4
  const translationsDir = path.resolve("dist/translations");
5
- if (!fs.existsSync(translationsDir)) {
6
- fs.mkdirSync(translationsDir, { recursive: true });
7
- }
8
5
 
9
6
  const files = fs
10
7
  .readdirSync(translationsDir)
@@ -3,15 +3,7 @@ const path = require("path");
3
3
 
4
4
  const filePath = path.resolve(process.cwd(), "dist/translations/en.json");
5
5
 
6
- let englishTranslations = {};
7
-
8
- try {
9
- if (fs.existsSync(filePath)) {
10
- const content = fs.readFileSync(filePath, "utf8");
11
- englishTranslations = JSON.parse(content);
12
- }
13
- } catch {
14
- englishTranslations = {};
15
- }
6
+ const content = fs.readFileSync(filePath, "utf8");
7
+ const englishTranslations = JSON.parse(content);
16
8
 
17
9
  module.exports = englishTranslations;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "4.13.92-beta.4",
3
+ "version": "4.13.92-beta.5",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",