@griddo/cx 1.75.111 → 1.75.113

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/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.75.111",
4
+ "version": "1.75.113",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -66,7 +66,7 @@
66
66
  "react-helmet": "^6.0.0"
67
67
  },
68
68
  "devDependencies": {
69
- "@griddo/eslint-config-back": "^1.75.111",
69
+ "@griddo/eslint-config-back": "^1.75.113",
70
70
  "eslint": "^7.5.0",
71
71
  "eslint-plugin-node": "^11.1.0",
72
72
  "eslint-plugin-react": "7.14.3",
@@ -98,5 +98,5 @@
98
98
  "publishConfig": {
99
99
  "access": "public"
100
100
  },
101
- "gitHead": "24761f41153335ee6834574396b72745588d0e62"
101
+ "gitHead": "24868cd1c999ba5e9ced2c13ea63fdb12e89f6b2"
102
102
  }
@@ -60,8 +60,10 @@ class NavigationService {
60
60
  // Los navigations serían el que tenga la página,
61
61
  // si no el que tenga definido para esa template
62
62
  // si no el que tenga definido para ese paquete de datos
63
- const getFineNavigation = values =>
64
- values.find(item => typeof item === 'number') || null;
63
+ const getFineNavigation = values => {
64
+ const fineNavigation = values.find(item => typeof item === 'number');
65
+ return typeof fineNavigation === 'number' ? fineNavigation : null;
66
+ };
65
67
 
66
68
  const headerID = getFineNavigation([
67
69
  pageHeader,
@@ -9,6 +9,7 @@ const folders = require('./folders');
9
9
 
10
10
  const baseUrl = process.env.API_URL;
11
11
  const testSite = process.env.testSite && parseInt(process.env.testSite);
12
+ const testPage = process.env.testPage && parseInt(process.env.testPage);
12
13
  const BYPASSRENDER = JSON.parse(process.env.BYPASSRENDER || false);
13
14
  const updateAllSitesAlways = process.env.updateAllSites === 'on';
14
15
 
@@ -20,10 +21,10 @@ const checkSites = async () => {
20
21
  const sites = await SitesService.getAll();
21
22
 
22
23
  const updatedSites = updateAllSitesAlways
23
- ?
24
- sites.filter(site => !testSite || site.id === testSite)
25
- :
26
- sites.filter(site => testSite ? site.id === testSite : !!site.shouldBeUpdated);
24
+ ? sites.filter(site => !testSite || site.id === testSite)
25
+ : sites.filter(site =>
26
+ testSite ? site.id === testSite : !!site.shouldBeUpdated
27
+ );
27
28
 
28
29
  if (updatedSites.length) {
29
30
  for (const updatedSite of updatedSites) {
@@ -40,7 +41,9 @@ const checkSites = async () => {
40
41
  }
41
42
 
42
43
  const sitesToRender = updatedSites.filter(site =>
43
- testSite ? site.id === testSite : !!site.isPublished && site.domains.length > 0
44
+ testSite
45
+ ? site.id === testSite
46
+ : !!site.isPublished && site.domains.length > 0
44
47
  );
45
48
  const sitesToUnpublish = updatedSites.filter(site => !site.isPublished);
46
49
 
@@ -68,19 +71,21 @@ const getSiteData = async (siteID, cached) => {
68
71
 
69
72
  helpers.log('success', 'PAGE RENDER STARTS', buildData);
70
73
 
71
- const siteInfo = await SitesService.getInfo(siteID,cached);
74
+ const siteInfo = await SitesService.getInfo(siteID, cached);
72
75
  const siteLangs = await SitesService.getLanguages(siteID, cached);
73
76
  const socials = await SitesService.getSocials(siteID, cached);
74
77
  const siteLangsInfo = siteLangs.items;
75
78
  const defaultLang = siteLangsInfo.find(lang => lang.isDefault);
76
79
  const sitePages = await SitesService.getPages(siteID, cached);
77
80
 
78
- const validPagesIds = buildData.publishIds;
79
- const { siteHash, unpublishHashes } = buildData;
81
+ const { siteHash, unpublishHashes, publishIds } = buildData;
80
82
  const { headers, footers } = siteInfo;
81
-
83
+
84
+ const validPagesIds = testPage
85
+ ? (publishIds.includes(testPage) ? [testPage] : [])
86
+ : publishIds;
87
+
82
88
  return {
83
- buildData,
84
89
  siteInfo,
85
90
  validPagesIds,
86
91
  siteHash,
@@ -122,18 +127,16 @@ const generateSitemaps = async sites => {
122
127
  const response = await SitesService.getSiteMap(siteID);
123
128
  const {
124
129
  items: sitemapPagesGroup,
125
- url: {
126
- home,
127
- },
130
+ url: { home },
128
131
  } = response;
129
-
132
+
130
133
  if (!home) continue;
131
134
 
132
135
  const langDomain = site.domains.find(
133
136
  domain => Object.keys(domain)[0] == lang.id
134
137
  );
135
138
  if (!langDomain) continue;
136
-
139
+
137
140
  const slug = Object.values(langDomain)[0];
138
141
  const sitemaps = [];
139
142
  for (const templateId of Object.keys(sitemapPagesGroup)) {
@@ -155,7 +158,9 @@ const generateSitemaps = async sites => {
155
158
  );
156
159
  helpers.log('info', `sitemap file exact path ${exactPath}`);
157
160
  await saveFile(exactPath, siteMap);
158
- sitemaps.push(`${home.endsWith('/') ? home.slice(0, -1) : home}${sitemapName}`);
161
+ sitemaps.push(
162
+ `${home.endsWith('/') ? home.slice(0, -1) : home}${sitemapName}`
163
+ );
159
164
  }
160
165
  if (!sitemaps.length) continue;
161
166
  const siteMap = js2xmlparser.parse('sitemapindex', {