@griddo/cx 10.4.29 → 10.4.30

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.
@@ -61,7 +61,7 @@ interface RenderInfo {
61
61
  createdPages: Array<number>;
62
62
  sitesToPublish: Array<Site>;
63
63
  }
64
- type LifeCyclesNames = "Prepare" | "Restore" | "Data" | "SSG" | "Relocation" | "Meta" | "Archive" | "Clean" | "__DEBUG__";
64
+ type LifeCyclesNames = "Prepare" | "Restore" | "Data" | "SSG" | "Relocation" | "Meta" | "Archive" | "Clean" | "HealthCheck" | "__DEBUG__";
65
65
  type CXDir = "__exports" | "__caches" | "__cx" | "__ssg" | "__components" | "__root";
66
66
  interface CXConfig {
67
67
  proDomain: string;
@@ -28,11 +28,16 @@ import {
28
28
  } from "../../utils/folders";
29
29
  import { generateBuildReport, generateSitemaps } from "../../utils/sites";
30
30
 
31
+ const config = getConfig();
32
+ const { __cx } = config.paths();
33
+ const renderSentinelFile = path.join(__cx, ".render-sentinel");
34
+
31
35
  async function runGatsbyAdapter() {
32
36
  printExporterLogo("gatsby");
33
37
 
38
+ fs.writeFileSync(renderSentinelFile, new Date().toISOString());
39
+
34
40
  const domains = await getInstanceDomains();
35
- const config = getConfig();
36
41
 
37
42
  for (const domain of domains) {
38
43
  const { __ssg, __exports, __caches, __cx, __components } = config.paths(
@@ -240,6 +245,25 @@ async function runGatsbyAdapter() {
240
245
  () => pause("Clean LifeCycle"),
241
246
  ],
242
247
  });
248
+
249
+ await doLifeCycle({
250
+ name: "HealthCheck",
251
+ attempts: 1,
252
+ steps: [
253
+ () => {
254
+ if (!fs.existsSync(renderSentinelFile)) {
255
+ logBox(
256
+ `Something has happened and the rendering uuid cannot be read safely.
257
+ There was probably a instance deployment during the render and files were deleted.
258
+
259
+ The files generated in this render will not be published.`,
260
+ "Render UUID error"
261
+ );
262
+ throw new Error("Render sentinel file does not exist.");
263
+ }
264
+ },
265
+ ],
266
+ });
243
267
  }
244
268
  }
245
269
 
@@ -45,7 +45,7 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
45
45
  const { analyticsScript, analyticsDimensions } = composeAnalytics(
46
46
  siteScript,
47
47
  dimensions,
48
- generateAutomaticDimensions
48
+ generateAutomaticDimensions,
49
49
  );
50
50
 
51
51
  const analyticsScriptSrc =
@@ -67,7 +67,7 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
67
67
  // AX?
68
68
  const fixedAnalyticsCode = Array.isArray(analyticsCodeSnippet)
69
69
  ? analyticsCodeSnippet.find((item) => item.type === "script") ||
70
- emptyCodeScript
70
+ emptyCodeScript
71
71
  : analyticsCodeSnippet;
72
72
 
73
73
  const {
@@ -102,14 +102,14 @@ function GriddoIntegrations(props: GriddoIntegrationsProps) {
102
102
 
103
103
  if (integration.type === "analytics") {
104
104
  return (
105
- <React.Fragment>
105
+ <React.Fragment key={key}>
106
106
  {/* Analytics with UA- */}
107
107
  {analyticsScriptSrc && (
108
108
  <script key={key} src={analyticsScriptSrc}></script>
109
109
  )}
110
110
  {/* Analytics with js snippet */}
111
111
  {(analyticsScriptProps?.src || analyticsScriptCode) && (
112
- <script {...analyticsScriptProps} data-griddo-id={id} key={key}>
112
+ <script {...analyticsScriptProps} data-griddo-id={id}>
113
113
  {analyticsScriptCode}
114
114
  </script>
115
115
  )}
@@ -5,14 +5,15 @@ import { runGatsbyAdapter } from "./adapters";
5
5
  import { logBox, measureExecutionTime } from "./utils/core-utils";
6
6
 
7
7
  async function startRender() {
8
- const exeTime = await measureExecutionTime(runGatsbyAdapter).catch(() => {
8
+ try {
9
+ const exeTime = await measureExecutionTime(runGatsbyAdapter);
10
+ logBox(`All domains rendered in ${exeTime}s.`, "", 1, 0);
11
+ process.exit(0);
12
+ } catch (error) {
13
+ console.log(error);
9
14
  console.log("<[ Render will be reset ]>");
10
15
  process.exit(1);
11
- });
12
-
13
- logBox(`All domains rendered in ${exeTime}s.`, "", 1, 0);
14
-
15
- process.exit(0);
16
+ }
16
17
  }
17
18
 
18
19
  export { startRender };
@@ -85,6 +85,7 @@ type LifeCyclesNames =
85
85
  | "Meta"
86
86
  | "Archive"
87
87
  | "Clean"
88
+ | "HealthCheck"
88
89
  | "__DEBUG__";
89
90
 
90
91
  type CXDir =
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.29",
4
+ "version": "10.4.30",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -48,7 +48,7 @@
48
48
  "@babel/preset-env": "^7.14.5",
49
49
  "@babel/preset-react": "^7.14.5",
50
50
  "@babel/preset-typescript": "^7.16.5",
51
- "@griddo/core": "10.4.29",
51
+ "@griddo/core": "10.4.30",
52
52
  "@svgr/webpack": "^5.5.0",
53
53
  "babel-loader": "^8.0.6",
54
54
  "babel-plugin-transform-runtime": "^6.23.0",
@@ -119,5 +119,5 @@
119
119
  "publishConfig": {
120
120
  "access": "public"
121
121
  },
122
- "gitHead": "8aed7094dba5aa9e183f5babadbc5590267cfb0b"
122
+ "gitHead": "b9de29bad583d1e4f40f614cab7f3944d3f057f6"
123
123
  }