@griddo/cx 1.72.6 → 1.72.9

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.
package/gatsby-config.js CHANGED
@@ -32,6 +32,7 @@ const CONFIG = {
32
32
 
33
33
  if (assetPrefix) {
34
34
  CONFIG.assetPrefix = assetPrefix;
35
+ CONFIG.pathPrefix = null;
35
36
  }
36
37
 
37
38
  module.exports = CONFIG;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/cx",
3
3
  "description": "Griddo SSG based on Gatsby",
4
- "version": "1.72.6",
4
+ "version": "1.72.9",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -65,7 +65,7 @@
65
65
  "react-helmet": "^6.0.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@griddo/eslint-config-back": "^1.72.6",
68
+ "@griddo/eslint-config-back": "^1.72.9",
69
69
  "eslint": "^7.5.0",
70
70
  "eslint-plugin-node": "^11.1.0",
71
71
  "eslint-plugin-react": "7.14.3",
@@ -97,5 +97,5 @@
97
97
  "publishConfig": {
98
98
  "access": "public"
99
99
  },
100
- "gitHead": "3e2f071c47d8a8f4dbd4d6d2220b77796158a115"
100
+ "gitHead": "396779b881366e8c42f01146bf2f276eff5aba77"
101
101
  }
@@ -3,40 +3,44 @@ const path = require('path');
3
3
  const crypto = require('crypto');
4
4
 
5
5
  const apiCacheDirectory = './apiCache';
6
+ const gatsbyCacheDirectory = path.resolve(__dirname, './../../.cache');
6
7
 
7
8
  const initCache = () => {
8
- // TODO: Make a domain-based cache to store and restore
9
- fs.rmdirSync(path.resolve(__dirname, './../../.cache'), {
10
- force: true,
11
- recursive: true,
12
- })
13
- if (!fs.existsSync(apiCacheDirectory)) {
14
- fs.mkdirSync(apiCacheDirectory);
15
- }
9
+ // TODO: Make a domain-based cache to store and restore
10
+ if (fs.existsSync(gatsbyCacheDirectory)) {
11
+ fs.rmSync(gatsbyCacheDirectory, {
12
+ force: true,
13
+ recursive: true,
14
+ });
15
+ }
16
+ if (!fs.existsSync(apiCacheDirectory)) {
17
+ fs.mkdirSync(apiCacheDirectory);
18
+ }
16
19
  };
17
20
 
18
- const generateFilename = (petition) => {
19
- const hashSum = crypto.createHash('sha256');
20
- hashSum.update(JSON.stringify(petition));
21
- return `${apiCacheDirectory}/${hashSum.digest('hex')}`;
21
+ const generateFilename = petition => {
22
+ const hashSum = crypto.createHash('sha256');
23
+ hashSum.update(JSON.stringify(petition));
24
+ return `${apiCacheDirectory}/${hashSum.digest('hex')}`;
22
25
  };
23
26
 
24
27
  const saveCache = (petition, content = '') => {
25
- const rightContent = typeof (content) === 'object' ? JSON.stringify(content) : content;
26
- fs.writeFileSync(generateFilename(petition), rightContent, 'utf8');
28
+ const rightContent =
29
+ typeof content === 'object' ? JSON.stringify(content) : content;
30
+ fs.writeFileSync(generateFilename(petition), rightContent, 'utf8');
27
31
  };
28
32
 
29
- const getCache = (petition) => {
30
- try {
31
- const content = fs.readFileSync(generateFilename(petition));
32
- return JSON.parse(content);
33
- } catch {
34
- return null;
35
- }
33
+ const getCache = petition => {
34
+ try {
35
+ const content = fs.readFileSync(generateFilename(petition));
36
+ return JSON.parse(content);
37
+ } catch {
38
+ return null;
39
+ }
36
40
  };
37
41
 
38
42
  module.exports = {
39
- initCache,
40
- saveCache,
41
- getCache,
42
- };
43
+ initCache,
44
+ saveCache,
45
+ getCache,
46
+ };
@@ -129,6 +129,8 @@ const generateSitemaps = async sites => {
129
129
  const langDomain = site.domains.find(
130
130
  domain => Object.keys(domain)[0] == lang.id
131
131
  );
132
+ if (!langDomain) continue;
133
+
132
134
  const slug = Object.values(langDomain)[0];
133
135
  const sitemaps = [];
134
136
  for (const templateId of Object.keys(sitemapPagesGroup)) {