@griddo/cx 10.2.10 → 10.2.12
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/build/build-complete.js +1 -1
- package/build/index.js +1 -1
- package/package.json +3 -3
- package/src/services/distributors.ts +4 -1
- package/src/services/robots.ts +20 -11
- package/src/services/sites.ts +8 -3
package/build/build-complete.js
CHANGED
|
@@ -43,4 +43,4 @@ ${p}
|
|
|
43
43
|
${y}
|
|
44
44
|
|
|
45
45
|
=============
|
|
46
|
-
`))}Xc.default.config();var pi=process.env.API_URL,Ie=`${pi}/site/`,Ee={GET_ALL:`${pi}/sites/all`,GET_PAGE:[`${pi}/page/`,""],INFO:[`${Ie}`,"/all"],LANGUAGES:[`${Ie}`,"/languages"],BUILD_START:[`${Ie}`,"/build/start"],BUILD_END:[`${Ie}`,"/build/end"],GET_DISTRIBUTOR_DATA:[`${Ie}`,"/distributor"],GET_SITEMAP:[`${Ie}`,"/sitemap"],SOCIALS:[`${Ie}`,"/socials"],GET_PAGES:[`${Ie}`,"/pages?pagination=false"]},Nr=class{static async getAll(){let{GET_ALL:t}=Ee;return await Te({endpoint:t})}static async getPage(t,r){let{GET_PAGE:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getInfo(t,r=""){let{INFO:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getLanguages(t,r=""){let{LANGUAGES:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async startSiteRender(t){let{BUILD_START:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async endSiteRender(t,r){let{BUILD_END:[n,i]}=Ee;return await di({endpoint:`${n}${t}${i}`,body:r})}static async getDistributorData(t,r,n){let{GET_DISTRIBUTOR_DATA:[
|
|
46
|
+
`))}Xc.default.config();var pi=process.env.API_URL,Ie=`${pi}/site/`,Ee={GET_ALL:`${pi}/sites/all`,GET_PAGE:[`${pi}/page/`,""],INFO:[`${Ie}`,"/all"],LANGUAGES:[`${Ie}`,"/languages"],BUILD_START:[`${Ie}`,"/build/start"],BUILD_END:[`${Ie}`,"/build/end"],GET_DISTRIBUTOR_DATA:[`${Ie}`,"/distributor"],GET_SITEMAP:[`${Ie}`,"/sitemap"],SOCIALS:[`${Ie}`,"/socials"],GET_PAGES:[`${Ie}`,"/pages?pagination=false"]},Nr=class{static async getAll(){let{GET_ALL:t}=Ee;return await Te({endpoint:t})}static async getPage(t,r){let{GET_PAGE:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getInfo(t,r=""){let{INFO:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async getLanguages(t,r=""){let{LANGUAGES:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}static async startSiteRender(t){let{BUILD_START:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async endSiteRender(t,r){let{BUILD_END:[n,i]}=Ee;return await di({endpoint:`${n}${t}${i}`,body:r})}static async getDistributorData(t,r,n,i,s){let{GET_DISTRIBUTOR_DATA:[o,a]}=Ee,u=i||t.site,d=s||t.language;return await di({endpoint:`${o}${u}${a}`,body:r,headers:{lang:d},cacheKey:n})}static async getSitemap(t){let{GET_SITEMAP:[r,n]}=Ee;return await Te({endpoint:`${r}${t}${n}`})}static async getSocials(t,r=""){let{SOCIALS:[n,i]}=Ee;return await Te({endpoint:`${n}${t}${i}`,cacheKey:r})}};var fp=Qc.default.sync(Lr.default.resolve(__dirname,"../..")),Zc=Lr.default.resolve(fp,"exports/sites");async function el(e){await cr.login();let t=e.sites.map(r=>{let{siteId:n,...i}=r;return ft(`Deploying ending call to site ${n}:`),Nr.endSiteRender(n,i)});await Promise.all(t),ft(`Build end signal sent for ${e.sites.length} site(s)`)}function hp(){return jr.default.readdirSync(Zc)}function dp(e){let t=[];for(let r of e){let n=Lr.default.resolve(Zc,r,"dist","__build-report__.json");if(!jr.default.existsSync(n)){console.log(`Build report "${n}" not found.`);continue}let i=JSON.parse(jr.default.readFileSync(n,"utf-8"));t.push(i)}return t}async function pp(){let e=hp(),t=dp(e);for(let r of t)await el(r)}pp();0&&(module.exports={buildComplete});
|
package/build/index.js
CHANGED
|
@@ -25,7 +25,7 @@ GFS4: `),console.error(e)});z[Z]||(ws=global[Z]||[],xs(z,ws),z.close=function(e)
|
|
|
25
25
|
\u2502 Access credentials failure \u2502
|
|
26
26
|
\u2502 Check that the login details are correct in your .env file \u2502
|
|
27
27
|
\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
|
|
28
|
-
`)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.2.
|
|
28
|
+
`)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.2.12";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
|
|
29
29
|
`,s=`
|
|
30
30
|
\u2570${"\u2500".repeat(r)}\u256F`,o=`\u2502${n}${e}${n}\u2502`;console.log(`${i}${o}${s}`)}function fi(e){vp&&console.info(e.replace(/(\s)\s+/g,"$1"))}function Xu(e){return new Promise(t=>setTimeout(t,e))}function Dr(e,t=3){return(e/1e3).toFixed(t)}function hi(e){return"site"in e&&e.site?e?.site:void 0}function di(...e){let t=performance.now();return e.forEach(r=>r()),Dr(performance.now()-t)}function Qu(){let e=`
|
|
31
31
|
\xB7\xB7
|
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": "10.2.
|
|
4
|
+
"version": "10.2.12",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"react-helmet": "^6.0.0"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@griddo/eslint-config-back": "^10.2.
|
|
71
|
+
"@griddo/eslint-config-back": "^10.2.12",
|
|
72
72
|
"@types/babel__core": "^7.20.0",
|
|
73
73
|
"@types/babel__preset-env": "^7.9.2",
|
|
74
74
|
"@types/csvtojson": "^2.0.0",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"publishConfig": {
|
|
117
117
|
"access": "public"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "7985f1e2650c017b4fd9873cf942bae0fd1e2670"
|
|
120
120
|
}
|
|
@@ -87,6 +87,7 @@ class DistributorService {
|
|
|
87
87
|
component: { data },
|
|
88
88
|
cacheKey,
|
|
89
89
|
} = props;
|
|
90
|
+
const { site, lang } = data;
|
|
90
91
|
|
|
91
92
|
// Distrubutor with `hasDistributorDat: true` but without `data` prop
|
|
92
93
|
if (!data) {
|
|
@@ -101,7 +102,9 @@ class DistributorService {
|
|
|
101
102
|
const response = await SitesService.getDistributorData(
|
|
102
103
|
page,
|
|
103
104
|
body,
|
|
104
|
-
cacheKey
|
|
105
|
+
cacheKey,
|
|
106
|
+
site,
|
|
107
|
+
lang
|
|
105
108
|
);
|
|
106
109
|
|
|
107
110
|
return response;
|
package/src/services/robots.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { Robots } from "../types/global";
|
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
5
5
|
|
|
6
|
+
dotenv.config();
|
|
7
|
+
|
|
8
|
+
import dotenv from "dotenv";
|
|
9
|
+
|
|
6
10
|
import { get } from "../utils/api";
|
|
7
11
|
|
|
8
12
|
/**
|
|
@@ -45,18 +49,23 @@ class RobotsService {
|
|
|
45
49
|
* TODO: JSDoc
|
|
46
50
|
*/
|
|
47
51
|
async writeFiles(basePath: string) {
|
|
48
|
-
for
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
// Takes Robot for the current rendering domain
|
|
53
|
+
const robot = this.robots.find(
|
|
54
|
+
({ path }) => path === `/${process.env.DOMAIN}`
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
if (!robot) {
|
|
58
|
+
console.log(`Robots not found for ${process.env.DOMAIN}`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
62
|
+
if (fs.existsSync(basePath)) {
|
|
63
|
+
const fileLocation = process.env.GRIDDO_EXPORT_STRIP_DOMAIN_FROM_PATH
|
|
64
|
+
? path.join(basePath, "robots.txt")
|
|
65
|
+
: path.join(basePath, robot.path, "robots.txt");
|
|
66
|
+
fs.writeFileSync(fileLocation, robot?.content);
|
|
67
|
+
} else {
|
|
68
|
+
console.log(`${basePath} not found`);
|
|
60
69
|
}
|
|
61
70
|
}
|
|
62
71
|
}
|
package/src/services/sites.ts
CHANGED
|
@@ -128,14 +128,19 @@ class SitesService {
|
|
|
128
128
|
static async getDistributorData(
|
|
129
129
|
page: Core.Page,
|
|
130
130
|
body: DistributorBody,
|
|
131
|
-
cacheKey: string
|
|
131
|
+
cacheKey: string,
|
|
132
|
+
dataSiteId?: number,
|
|
133
|
+
dataLangID?: number
|
|
132
134
|
) {
|
|
133
135
|
const {
|
|
134
136
|
GET_DISTRIBUTOR_DATA: [prefix, suffix],
|
|
135
137
|
} = ENDPOINTS;
|
|
136
|
-
|
|
138
|
+
|
|
139
|
+
const site = dataSiteId || page.site;
|
|
140
|
+
const lang = dataLangID || page.language;
|
|
141
|
+
|
|
137
142
|
const response = await post<DistributorResponse>({
|
|
138
|
-
endpoint: `${prefix}${
|
|
143
|
+
endpoint: `${prefix}${site}${suffix}`,
|
|
139
144
|
body,
|
|
140
145
|
headers: { lang },
|
|
141
146
|
cacheKey,
|