@griddo/cx 11.0.4 → 11.0.5

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,6 +1,5 @@
1
1
  import type { APIResponses } from "../types/api";
2
2
  import type { CXConfig, LifeCyclesNames } from "../types/global";
3
- import type { Site } from "../types/sites";
4
3
  declare const instanceRootDir: string;
5
4
  /**
6
5
  * Returns the configuration file content.
@@ -57,12 +56,6 @@ declare function getSafeSiteId(response: APIResponses): number | undefined;
57
56
  * @param props An array of props to be removed
58
57
  */
59
58
  declare function removeProperties(obj: Record<string, unknown>, props: Array<string>): void;
60
- /**
61
- * Return a list of sites with their names and ids.
62
- *
63
- * @param sites An array of sites objects
64
- */
65
- declare function siteList(sites: Array<Site>): string;
66
59
  /**
67
60
  * Remove unused files (old) inside the `apiCache` dir
68
61
  *
@@ -111,4 +104,4 @@ declare function doLifeCycle(name: LifeCyclesNames, options: {
111
104
  */
112
105
  declare function createRenderMetadata(domain: string): Promise<void>;
113
106
  declare function removeAllSiteDirsFromStore(): void;
114
- export { createRenderMetadata, delay, doLifeCycle, getConfig, getSafeSiteId, instanceRootDir, isTruthy, measureExecutionTime, msToSec, pause, removeAllSiteDirsFromStore, removeProperties, sanitizeAPICacheDir, siteList, walk, walkStore, };
107
+ export { createRenderMetadata, delay, doLifeCycle, getConfig, getSafeSiteId, instanceRootDir, isTruthy, measureExecutionTime, msToSec, pause, removeAllSiteDirsFromStore, removeProperties, sanitizeAPICacheDir, walk, walkStore, };
@@ -1,4 +1,4 @@
1
- import type { Adapters } from "../adapters";
1
+ import type { Site } from "../types/sites";
2
2
  /**
3
3
  * Custom basic logging function controlled by a environment variable.
4
4
  *
@@ -45,5 +45,6 @@ declare function pageSizeLog(size: number, measure?: string): string;
45
45
  /**
46
46
  * Print Griddo, adapter and Node version.
47
47
  */
48
- declare function printExporterLogo(adapter: Adapters): void;
49
- export { boxLog, buildLog, debugLog, infoLog, pageSizeLog, printExporterLogo, successLog, verboseLog, };
48
+ declare function printExporterLogo(): void;
49
+ declare function listSitesLog(title: string, sites: Array<Site>): void;
50
+ export { boxLog, buildLog, debugLog, infoLog, listSitesLog, pageSizeLog, printExporterLogo, successLog, verboseLog, };
@@ -35,7 +35,7 @@ import {
35
35
  const config = getConfig();
36
36
 
37
37
  async function main() {
38
- printExporterLogo("gatsby");
38
+ printExporterLogo();
39
39
 
40
40
  const domains = await getInstanceDomains();
41
41
 
@@ -59,6 +59,15 @@ function runGatsbyBuildCommand(assetPrefixWithDomain: string) {
59
59
 
60
60
  const { __ssg } = config.paths();
61
61
 
62
+ // Remove `--openssl-legacy-provider` from NODE_OPTIONS because this value
63
+ // break Gataby render.
64
+ const nodeOptionsWithoutLegacyOpenSSL = process.env.NODE_OPTIONS
65
+ ? process.env.NODE_OPTIONS.replace(
66
+ /--openssl-legacy-provider\s*/g,
67
+ "",
68
+ ).trim()
69
+ : "";
70
+
62
71
  const command = spawnSync(
63
72
  "yarn",
64
73
  ["gatsby-build", envs.GRIDDO_SSG_VERBOSE_LOGS ? "--verbose" : ""],
@@ -70,6 +79,7 @@ function runGatsbyBuildCommand(assetPrefixWithDomain: string) {
70
79
  env: Object.assign(process.env, {
71
80
  GRIDDO_EXPORTER: "true",
72
81
  SPAWN_ASSET_PREFIX_WITH_DOMAIN: assetPrefixWithDomain,
82
+ NODE_OPTIONS: nodeOptionsWithoutLegacyOpenSSL,
73
83
  }),
74
84
  },
75
85
  );
@@ -18,12 +18,8 @@ import { getReferenceFieldData } from "./reference-fields";
18
18
  import { getAllSettings } from "./settings";
19
19
  import { getPage } from "./sites";
20
20
  import { updatedSiteHash } from "../utils/cache";
21
- import {
22
- getConfig,
23
- removeAllSiteDirsFromStore,
24
- siteList,
25
- } from "../utils/core-utils";
26
- import { buildLog, verboseLog } from "../utils/loggin";
21
+ import { getConfig, removeAllSiteDirsFromStore } from "../utils/core-utils";
22
+ import { buildLog, listSitesLog, verboseLog } from "../utils/loggin";
27
23
  import {
28
24
  createGriddoListPages,
29
25
  createGriddoMultiPages,
@@ -73,8 +69,8 @@ async function createStore(domain: string) {
73
69
  console.warn(`There are no sites to update in the domain ${domain}`);
74
70
  }
75
71
 
76
- console.info(`Sites to publish: ${siteList(sitesToPublish)}`);
77
- console.info(`Sites to unpublish: ${siteList(sitesToUnpublish)}`);
72
+ listSitesLog("Sites to publish:", sitesToPublish);
73
+ listSitesLog("Sites to unpublish:", sitesToUnpublish);
78
74
 
79
75
  // Send unpublished sites to API.
80
76
  // @todo ¿mover esta llamada al final del proceso de render?
@@ -184,15 +184,6 @@ function removeProperties(obj: Record<string, unknown>, props: Array<string>) {
184
184
  }
185
185
  }
186
186
 
187
- /**
188
- * Return a list of sites with their names and ids.
189
- *
190
- * @param sites An array of sites objects
191
- */
192
- function siteList(sites: Array<Site>) {
193
- return sites.map(({ name, id }) => `${name} (${id})`).join(", ");
194
- }
195
-
196
187
  /**
197
188
  * Remove unused files (old) inside the `apiCache` dir
198
189
  *
@@ -353,7 +344,7 @@ async function doLifeCycle(
353
344
  try {
354
345
  infoLog(`start ${name} life-cycle`);
355
346
  const exeTime = await measureExecutionTime(steps, delay);
356
- successLog(`${name} - ${exeTime}s`);
347
+ successLog(`${name} - ${exeTime}s\n`);
357
348
  // if no errors, print and go out
358
349
  await pause(`${name} LifeCycle`);
359
350
  break;
@@ -417,7 +408,6 @@ export {
417
408
  removeAllSiteDirsFromStore,
418
409
  removeProperties,
419
410
  sanitizeAPICacheDir,
420
- siteList,
421
411
  walk,
422
412
  walkStore,
423
413
  };
@@ -62,8 +62,6 @@ const clearEmptyDirs = (baseDir: string) => {
62
62
  fsx.rmdirSync(baseDir);
63
63
  return;
64
64
  }
65
-
66
- verboseLog("remove empty site directories");
67
65
  };
68
66
 
69
67
  /**
@@ -1,10 +1,9 @@
1
- import type { Adapters } from "../adapters";
1
+ import type { Site } from "../types/sites";
2
2
 
3
3
  import kleur from "kleur";
4
- import { version as reactVersion } from "react";
5
4
 
6
- import { getConfig } from "./core-utils";
7
5
  import { envs } from "../constants";
6
+ import { getConfig } from "./core-utils";
8
7
 
9
8
  /**
10
9
  * Custom basic logging function controlled by a environment variable.
@@ -130,28 +129,39 @@ function pageSizeLog(size: number, measure = "KB") {
130
129
  /**
131
130
  * Print Griddo, adapter and Node version.
132
131
  */
133
- function printExporterLogo(adapter: Adapters) {
132
+ function printExporterLogo() {
133
+ console.clear();
134
134
  const config = getConfig();
135
135
  const nodeVersion = process.version;
136
136
  const { griddoVersion } = config;
137
- const logo = `
138
- ··
139
- ·· Griddo ${griddoVersion}
140
- ··
141
- ·· Adapter: ${adapter}
142
- ·· Node: ${nodeVersion}
143
- ·· React: ${reactVersion}
144
- ··
145
- `;
137
+ const logo = `\n${kleur.bold("Griddo Exporter " + griddoVersion)} ${kleur.dim("~ node " + nodeVersion)}\n`;
146
138
 
147
139
  console.log(logo);
148
140
  }
149
141
 
142
+ function listSitesLog(title: string, sites: Array<Site>) {
143
+ const maxline = Math.max(
144
+ ...sites.map((s) => s.name.length + s.id.toString().length),
145
+ );
146
+
147
+ const sitesStr = sites.map((s) => {
148
+ const lineLen = s.name.length + s.id.toString().length;
149
+ const padding = " ".repeat(maxline - lineLen);
150
+ return `${kleur.bold(s.name)} ${kleur.dim("(" + s.id + ")")} ${padding}${kleur.dim("-")} ${kleur.dim(s.slug)}`;
151
+ });
152
+
153
+ console.log(`
154
+ ${title}
155
+
156
+ ${sitesStr.join("\n") || "---"}`);
157
+ }
158
+
150
159
  export {
151
160
  boxLog,
152
161
  buildLog,
153
162
  debugLog,
154
163
  infoLog,
164
+ listSitesLog,
155
165
  pageSizeLog,
156
166
  printExporterLogo,
157
167
  successLog,
package/gatsby-node.ts CHANGED
@@ -34,7 +34,7 @@ const pages = getBuildPagesFromStore<GatsbyPageObject>({
34
34
  const createPages: GatsbyNode["createPages"] = async ({ actions }) => {
35
35
  verboseLog(`read assetPrefixWithDomain=${assetPrefixWithDomain}`);
36
36
  verboseLog(`set needsAssetDomainPrefix=${needsAssetDomainPrefix}`);
37
- verboseLog(
37
+ console.log(
38
38
  `using this NODE_OPTIONS in gatsby-node.ts: ${process.env.NODE_OPTIONS}`,
39
39
  );
40
40
 
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": "11.0.4",
4
+ "version": "11.0.5",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -60,7 +60,7 @@
60
60
  "@babel/preset-env": "7.24.7",
61
61
  "@babel/preset-react": "7.24.7",
62
62
  "@babel/preset-typescript": "7.24.7",
63
- "@griddo/core": "11.0.4",
63
+ "@griddo/core": "11.0.5",
64
64
  "@svgr/webpack": "8.1.0",
65
65
  "axios": "^1.7.4",
66
66
  "babel-loader": "9.1.3",
@@ -127,5 +127,5 @@
127
127
  "publishConfig": {
128
128
  "access": "public"
129
129
  },
130
- "gitHead": "b97706dc29f2f8066e22ca49a9ee9c8959e8f820"
130
+ "gitHead": "b528c1933f0fe79e4feedacd2247336ab8f967a4"
131
131
  }