@griddo/cx 1.75.207 → 1.75.209
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/index.js +1 -1
- package/gatsby-node.ts +26 -30
- package/package.json +4 -4
- package/src/services/store.ts +2 -8
package/build/index.js
CHANGED
|
@@ -25,7 +25,7 @@ GFS4: `),console.error(e)});G[Q]||(ea=global[Q]||[],ra(G,ea),G.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)}}},hr=new On;var Yu=Y(Rn()),Xu=Y(mt()),Ku=Y(Gt());var fp=Y(mt()),Uu=Y(Gt()),hp=Y(eu()),Gu=Y($u());var Hu="1.75.
|
|
28
|
+
`)),process.exit(1)}}},hr=new On;var Yu=Y(Rn()),Xu=Y(mt()),Ku=Y(Gt());var fp=Y(mt()),Uu=Y(Gt()),hp=Y(eu()),Gu=Y($u());var Hu="1.75.209";Uu.default.config();var dp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS);function zu(...e){dp&&console.info(...e)}function Wu(e){return new Promise(t=>setTimeout(t,e))}function ai(e,t=3){return(e/1e3).toFixed(t)}function Ju(e){return"site"in e&&e.site?e?.site:void 0}function ci(...e){let t=performance.now();return e.forEach(r=>r()),ai(performance.now()-t)}function Vu(){let e=`
|
|
29
29
|
\xB7\xB7
|
|
30
30
|
\xB7\xB7
|
|
31
31
|
\xB7\xB7
|
package/gatsby-node.ts
CHANGED
|
@@ -30,18 +30,18 @@ const envVars: Record<string, any> = {};
|
|
|
30
30
|
export const onPreInit = async () => {
|
|
31
31
|
console.log("Envs");
|
|
32
32
|
Object.keys(process.env)
|
|
33
|
-
.filter((key) => key.startsWith("GRIDDO_"))
|
|
33
|
+
.filter((key) => key.startsWith("GRIDDO_") || key.startsWith("GATSBY"))
|
|
34
34
|
.forEach((key) => (envVars[key] = process.env[key]));
|
|
35
35
|
console.log(envVars);
|
|
36
36
|
|
|
37
37
|
splash();
|
|
38
38
|
initCache();
|
|
39
39
|
prepareStaticFolder();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
StoreService.init(STORE_DIR_PATH, {
|
|
41
|
+
sanitize: GRIDDO_SANITIZE_PAGES,
|
|
42
|
+
mode: GRIDDO_STORE_MODE,
|
|
43
|
+
});
|
|
44
|
+
await StoreService.createBuildSource();
|
|
45
45
|
|
|
46
46
|
console.log("\n✨ onPreInit\n");
|
|
47
47
|
};
|
|
@@ -52,37 +52,33 @@ export const onPreInit = async () => {
|
|
|
52
52
|
export const createPages: GatsbyNode["createPages"] = async ({
|
|
53
53
|
actions: { createPage },
|
|
54
54
|
}) => {
|
|
55
|
-
StoreService.
|
|
56
|
-
sanitize: GRIDDO_SANITIZE_PAGES,
|
|
57
|
-
mode: GRIDDO_STORE_MODE,
|
|
58
|
-
});
|
|
59
|
-
await StoreService.createBuildSource(createPage);
|
|
55
|
+
const pages = StoreService.getPages();
|
|
60
56
|
|
|
61
|
-
|
|
57
|
+
let totalPagesSize = 0;
|
|
62
58
|
|
|
63
|
-
//
|
|
64
|
-
//
|
|
65
|
-
//
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
// We need to use a `for..of` to iterate over `pages` since it could be a
|
|
60
|
+
// generator and for example a `forEach` doesn't work on it. Besides a
|
|
61
|
+
// `for..of` is probably the best performance option.
|
|
62
|
+
for (const page of pages) {
|
|
63
|
+
const startTime = performance.now();
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
createPage(page);
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
const {
|
|
68
|
+
size: pageSize,
|
|
69
|
+
context: { id },
|
|
70
|
+
path: pagePath,
|
|
71
|
+
} = page;
|
|
72
|
+
const duration = msToSec(performance.now() - startTime);
|
|
73
|
+
const size = logPageSize(Math.round(pageSize));
|
|
78
74
|
|
|
79
|
-
|
|
75
|
+
logInfo(`Creating page ${pagePath} - ${duration}s - ${id} - ${size}`);
|
|
80
76
|
|
|
81
|
-
|
|
82
|
-
|
|
77
|
+
totalPagesSize += pageSize;
|
|
78
|
+
}
|
|
83
79
|
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
const totalPagesSizeMsg = (totalPagesSize / 1024).toFixed(3);
|
|
81
|
+
console.info(`Total page-data.json size: ${totalPagesSizeMsg}MB`);
|
|
86
82
|
|
|
87
83
|
console.log("\n✨ createPages\n");
|
|
88
84
|
};
|
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.209",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@babel/preset-env": "^7.14.5",
|
|
34
34
|
"@babel/preset-react": "^7.14.5",
|
|
35
35
|
"@babel/preset-typescript": "^7.16.5",
|
|
36
|
-
"@griddo/core": "^1.75.
|
|
36
|
+
"@griddo/core": "^1.75.209",
|
|
37
37
|
"@svgr/webpack": "^5.5.0",
|
|
38
38
|
"babel-loader": "^8.0.6",
|
|
39
39
|
"babel-plugin-styled-components": "^1.10.7",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"react-helmet": "^6.0.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@griddo/eslint-config-back": "^1.75.
|
|
66
|
+
"@griddo/eslint-config-back": "^1.75.209",
|
|
67
67
|
"@types/babel__core": "^7.20.0",
|
|
68
68
|
"@types/babel__preset-env": "^7.9.2",
|
|
69
69
|
"@types/csvtojson": "^2.0.0",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"publishConfig": {
|
|
112
112
|
"access": "public"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "dd50cdda90640e925165bbaebb9e729af53daacb"
|
|
115
115
|
}
|
package/src/services/store.ts
CHANGED
|
@@ -141,7 +141,7 @@ class StoreService {
|
|
|
141
141
|
/**
|
|
142
142
|
* Create a complete build fetching the necessary data from API.
|
|
143
143
|
*/
|
|
144
|
-
public static async createBuildSource(
|
|
144
|
+
public static async createBuildSource() {
|
|
145
145
|
try {
|
|
146
146
|
// Get sites objects to publish and unpublish.
|
|
147
147
|
const { sitesToPublish, sitesToUnpublish } = await checkSites();
|
|
@@ -357,16 +357,10 @@ class StoreService {
|
|
|
357
357
|
BUILD_PROCESS_DATA[siteId].publishHashes.push(page.hash);
|
|
358
358
|
|
|
359
359
|
// Save build data to store
|
|
360
|
-
|
|
360
|
+
await this.savePages(gatsbyPageObjects); // gatsbyPageObjects is always an array regardless of whether it's just one page
|
|
361
361
|
this.saveSitesToPublish(sitesToPublish);
|
|
362
362
|
this.saveBuildProcessData(BUILD_PROCESS_DATA);
|
|
363
363
|
this.saveCreatedPages(CREATED_PAGES);
|
|
364
|
-
|
|
365
|
-
// Create Gatsby Page
|
|
366
|
-
// TODO: Testing purposes
|
|
367
|
-
gatsbyPageObjects.forEach((gatsbyPageObject) => {
|
|
368
|
-
createPage(gatsbyPageObject);
|
|
369
|
-
});
|
|
370
364
|
};
|
|
371
365
|
|
|
372
366
|
const griddoCxThreads = parseInt(GRIDDO_API_CONCURRENCY_COUNT || "10");
|