@griddo/cx 1.75.110 → 1.75.112
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 +3 -3
- package/src/services/navigation.js +4 -2
- package/src/utils/sites.js +22 -16
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.
|
|
4
|
+
"version": "1.75.112",
|
|
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.
|
|
69
|
+
"@griddo/eslint-config-back": "^1.75.112",
|
|
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": "
|
|
101
|
+
"gitHead": "fe8ce6bd77a4e4a9e19214e5e6e4020db1a25955"
|
|
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')
|
|
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,
|
package/src/utils/sites.js
CHANGED
|
@@ -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 =>
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
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,22 @@ 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
|
|
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
|
+
buildData.publishIds = validPagesIds;
|
|
88
|
+
|
|
82
89
|
return {
|
|
83
|
-
buildData,
|
|
84
90
|
siteInfo,
|
|
85
91
|
validPagesIds,
|
|
86
92
|
siteHash,
|
|
@@ -122,18 +128,16 @@ const generateSitemaps = async sites => {
|
|
|
122
128
|
const response = await SitesService.getSiteMap(siteID);
|
|
123
129
|
const {
|
|
124
130
|
items: sitemapPagesGroup,
|
|
125
|
-
url: {
|
|
126
|
-
home,
|
|
127
|
-
},
|
|
131
|
+
url: { home },
|
|
128
132
|
} = response;
|
|
129
|
-
|
|
133
|
+
|
|
130
134
|
if (!home) continue;
|
|
131
135
|
|
|
132
136
|
const langDomain = site.domains.find(
|
|
133
137
|
domain => Object.keys(domain)[0] == lang.id
|
|
134
138
|
);
|
|
135
139
|
if (!langDomain) continue;
|
|
136
|
-
|
|
140
|
+
|
|
137
141
|
const slug = Object.values(langDomain)[0];
|
|
138
142
|
const sitemaps = [];
|
|
139
143
|
for (const templateId of Object.keys(sitemapPagesGroup)) {
|
|
@@ -155,7 +159,9 @@ const generateSitemaps = async sites => {
|
|
|
155
159
|
);
|
|
156
160
|
helpers.log('info', `sitemap file exact path ${exactPath}`);
|
|
157
161
|
await saveFile(exactPath, siteMap);
|
|
158
|
-
sitemaps.push(
|
|
162
|
+
sitemaps.push(
|
|
163
|
+
`${home.endsWith('/') ? home.slice(0, -1) : home}${sitemapName}`
|
|
164
|
+
);
|
|
159
165
|
}
|
|
160
166
|
if (!sitemaps.length) continue;
|
|
161
167
|
const siteMap = js2xmlparser.parse('sitemapindex', {
|