@griddo/cx 1.75.66 → 1.75.69

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.
Files changed (2) hide show
  1. package/gatsby-node.js +14 -2
  2. package/package.json +4 -3
package/gatsby-node.js CHANGED
@@ -24,6 +24,7 @@ const publicBaseUrl = process.env.PUBLIC_API_URL;
24
24
  const instance = process.env.REACT_APP_INSTANCE;
25
25
  const IS_SERVE = !!process.env.IS_SERVE && JSON.parse(process.env.IS_SERVE);
26
26
  const BUILD_MODE = process.env.CXBRANCH;
27
+ const GATSBY_THREADS = process.env.GATSBY_THREADS;
27
28
 
28
29
  // Share info between actions (createPages and onPostBuild)
29
30
  let updatedSites;
@@ -178,7 +179,7 @@ exports.createPages = async ({ actions }) => {
178
179
 
179
180
  helpers.log('info', 'VALID PAGES -->', validPagesIds);
180
181
 
181
- for (const pageId of validPagesIds) {
182
+ const renderPageProcess = async pageId => {
182
183
  createdPages.push(pageId);
183
184
 
184
185
  // Get page data
@@ -231,7 +232,18 @@ exports.createPages = async ({ actions }) => {
231
232
  );
232
233
 
233
234
  buildProcessData[siteId].publishHashes.push(page.hash);
234
- }
235
+ };
236
+
237
+ const gatsbyThreads = GATSBY_THREADS && parseInt(GATSBY_THREADS) || 10;
238
+ helpers.log('info', `Processing createPages with ${gatsbyThreads} threads`);
239
+
240
+ await import('p-limit').then(async pLimit => {
241
+ const limit = pLimit.default(gatsbyThreads);
242
+ const pagesToRender = validPagesIds.map(id =>
243
+ limit(() => renderPageProcess(id))
244
+ );
245
+ await Promise.all(pagesToRender);
246
+ });
235
247
  }
236
248
  };
237
249
 
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.66",
4
+ "version": "1.75.69",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -59,13 +59,14 @@
59
59
  "js2xmlparser": "^4.0.1",
60
60
  "node-sass": "^6.0.0",
61
61
  "opn": "^6.0.0",
62
+ "p-limit": "^4.0.0",
62
63
  "path-browserify": "^1.0.1",
63
64
  "pkg-dir": "^5.0.0",
64
65
  "process": "^0.11.10",
65
66
  "react-helmet": "^6.0.0"
66
67
  },
67
68
  "devDependencies": {
68
- "@griddo/eslint-config-back": "^1.75.66",
69
+ "@griddo/eslint-config-back": "^1.75.69",
69
70
  "eslint": "^7.5.0",
70
71
  "eslint-plugin-node": "^11.1.0",
71
72
  "eslint-plugin-react": "7.14.3",
@@ -97,5 +98,5 @@
97
98
  "publishConfig": {
98
99
  "access": "public"
99
100
  },
100
- "gitHead": "af5a8bca86793e66f772fb2dc6c8f0e0eb824f9d"
101
+ "gitHead": "78ef3fa0d2aa6ef7dcdef5259667039c9a16e140"
101
102
  }