@griddo/cx 10.4.6 → 10.4.7

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.
@@ -1,4 +1,4 @@
1
- import { getGatsbyDomainRunner } from "./utils";
1
+ import { attempts, getGatsbyDomainRunner } from "./utils";
2
2
  import { getInstanceDomains } from "../../utils/domains";
3
3
  import { createBuildData } from "../../utils/download-build-data";
4
4
  import { clearEmptyDirs, removeMultiPagesFromStore } from "../../utils/folders";
@@ -20,6 +20,7 @@ async function runGatsbyAdapter() {
20
20
  */
21
21
  await doLifeCycle({
22
22
  name: "Restore",
23
+ attempts: attempts.restore,
23
24
  steps: [
24
25
  runner.init,
25
26
  () => pause("init done!"),
@@ -38,9 +39,10 @@ async function runGatsbyAdapter() {
38
39
  */
39
40
  await doLifeCycle({
40
41
  name: "Data",
42
+ attempts: attempts.data,
41
43
  steps: [
42
- async () => await createBuildData(domain),
43
- () => pause("Download data from API to `store` dir done!"),
44
+ () => createBuildData(domain),
45
+ () => pause("Download data from API to `store` done!"),
44
46
  ],
45
47
  });
46
48
 
@@ -53,6 +55,7 @@ async function runGatsbyAdapter() {
53
55
  */
54
56
  await doLifeCycle({
55
57
  name: "SSG",
58
+ attempts: attempts.ssg,
56
59
  steps: [runner.runGatsbyBuild, () => pause("Gatsby build done!")],
57
60
  });
58
61
 
@@ -67,6 +70,7 @@ async function runGatsbyAdapter() {
67
70
  );
68
71
  await doLifeCycle({
69
72
  name: "Meta",
73
+ attempts: attempts.meta,
70
74
  steps: [
71
75
  () => (shouldUploadSearchData ? uploadSearchContentToAPI() : undefined),
72
76
  ],
@@ -80,11 +84,12 @@ async function runGatsbyAdapter() {
80
84
  */
81
85
  await doLifeCycle({
82
86
  name: "Archive",
87
+ attempts: attempts.archive,
83
88
  steps: [
84
89
  // Elimina las páginas MultiPage del `store`. De este modo nos
85
90
  // aseguramos que se vuelven a crear por Gatsby siempre
86
91
  // actualizadas.
87
- removeMultiPagesFromStore, // penalizando optimización...
92
+ removeMultiPagesFromStore,
88
93
  () => pause("MultiPages removed from `store`"),
89
94
  () => clearEmptyDirs(),
90
95
  () => pause("Clean empty dirs done!"),
@@ -11,6 +11,20 @@ import { checkSites } from "../../utils/sites";
11
11
 
12
12
  dotenv.config();
13
13
 
14
+ const attempts = {
15
+ prepare: JSON.parse(process.env.GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS || "1"),
16
+ restore: JSON.parse(process.env.GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS || "1"),
17
+ data: JSON.parse(process.env.GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS || "1"),
18
+ ssg: JSON.parse(process.env.GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS || "1"),
19
+ relocation: JSON.parse(
20
+ process.env.GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS || "1"
21
+ ),
22
+ meta: JSON.parse(process.env.GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS || "1"),
23
+ archive: JSON.parse(process.env.GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS || "1"),
24
+ clean: JSON.parse(process.env.GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS || "1"),
25
+ };
26
+
27
+
14
28
  /**
15
29
  * Return a runner, a serie of functions to manage the Gatsby render artifacts.
16
30
  */
@@ -317,17 +331,6 @@ function getGatsbyDomainRunner(domain: string) {
317
331
  }
318
332
  };
319
333
 
320
- // TODO: Esto no debería hacerse desde infra
321
- // const movePublicToDist = () => {
322
- // const { currentExportWorkingPath: publicPath } = getArtifactPaths("public");
323
- // const { currentExportWorkingPath: distPath } = getArtifactPaths("dist");
324
-
325
- // if (fs.existsSync(publicPath)) {
326
- // console.log(`Moving ${publicPath} to ${distPath}`);
327
- // run(`mv ${publicPath} ${distPath}`);
328
- // }
329
- // };
330
-
331
334
  /**
332
335
  * Delete disposable artifacts between renders.
333
336
  */
@@ -344,11 +347,6 @@ function getGatsbyDomainRunner(domain: string) {
344
347
  }
345
348
  };
346
349
 
347
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
348
- const cleanAfterFail = () => {
349
- cleanDirtyArtifactPaths();
350
- };
351
-
352
350
  return {
353
351
  init,
354
352
  getArtifactPaths,
@@ -379,4 +377,5 @@ function getGatsbyAssetPrefixSlug(domain: string) {
379
377
  return `${assetPrefix}/${domain}`;
380
378
  }
381
379
 
382
- export { getGatsbyDomainRunner };
380
+ export { attempts, getGatsbyDomainRunner };
381
+
@@ -41,12 +41,11 @@ function runner(command: string, env: Env) {
41
41
 
42
42
  if (error) {
43
43
  console.error(error);
44
- process.exit(1);
44
+ throw new Error(error.toString());
45
45
  }
46
46
 
47
47
  if (status !== 0) {
48
- console.error(`Command \`${command}\` exited with code ${status}`);
49
- process.exit(1);
48
+ throw new Error(`Command \`${command}\` exited with code ${status}`);
50
49
  }
51
50
  }
52
51
 
@@ -327,8 +327,7 @@ async function doLifeCycle(args: {
327
327
  }) {
328
328
  const { steps, name, attempts } = args;
329
329
  let trysCount = 0;
330
- const maxTrysAccepted =
331
- Number(process.env.GRIDDO_LIFECYCLE_MAX_RETRY_ATTEMPTS) || attempts || 1;
330
+ const maxTrysAccepted = attempts || 1;
332
331
 
333
332
  while (trysCount < maxTrysAccepted) {
334
333
  try {
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.4.6",
4
+ "version": "10.4.7",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -47,22 +47,16 @@
47
47
  "babel-plugin-styled-components": "^1.10.7",
48
48
  "babel-plugin-transform-runtime": "^6.23.0",
49
49
  "babel-polyfill": "^6.26.0",
50
- "branch-name": "^1.0.0",
51
50
  "chalk": "^2.4.2",
52
- "csvtojson": "^2.0.10",
53
51
  "dotenv": "^8.1.0",
54
52
  "find-up": "^5.0.0",
55
53
  "fs-extra": "^9.0.1",
56
54
  "gatsby": "^4.8.0",
57
- "gatsby-plugin-polyfill-io": "^1.1.0",
58
55
  "gatsby-plugin-react-helmet": "^5.8.0",
59
- "gatsby-plugin-sass": "^5.21.0",
60
- "gatsby-plugin-styled-components": "^5.8.0",
61
56
  "gatsby-plugin-svgr-loader": "^0.1.0",
62
57
  "gradient-string": "^2.0.2",
63
58
  "html-react-parser": "^1.4.10",
64
59
  "js2xmlparser": "^4.0.1",
65
- "opn": "^6.0.0",
66
60
  "p-limit": "^3.0.0",
67
61
  "path-browserify": "^1.0.1",
68
62
  "pkg-dir": "^5.0.0",
@@ -70,10 +64,6 @@
70
64
  "react-helmet": "^6.0.0"
71
65
  },
72
66
  "devDependencies": {
73
- "@griddo/eslint-config-back": "^10.4.6",
74
- "@types/babel__core": "^7.20.0",
75
- "@types/babel__preset-env": "^7.9.2",
76
- "@types/csvtojson": "^2.0.0",
77
67
  "@types/eslint": "^7.29.0",
78
68
  "@types/fs-extra": "^9.0.13",
79
69
  "@types/gradient-string": "^1.1.2",
@@ -117,5 +107,5 @@
117
107
  "publishConfig": {
118
108
  "access": "public"
119
109
  },
120
- "gitHead": "bf836216af29607748b79d098210379423c6914f"
110
+ "gitHead": "0280c78de79a2b1f534c9aaaf16e6bb72bd5b652"
121
111
  }