@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.
- package/build/end-render.js +34 -78
- package/build/end-render.js.map +4 -4
- package/build/index.js +48 -93
- package/build/index.js.map +4 -4
- package/build/reset-render.js +34 -78
- package/build/reset-render.js.map +4 -4
- package/build/run-start-render.js +48 -93
- package/build/run-start-render.js.map +4 -4
- package/build/start-render.js +48 -93
- package/build/start-render.js.map +4 -4
- package/build/upload-search-content.js +34 -78
- package/build/upload-search-content.js.map +4 -4
- package/build/utils/core-utils.d.ts +1 -8
- package/build/utils/loggin.d.ts +4 -3
- package/exporter/adapters/gatsby/index.ts +1 -1
- package/exporter/adapters/gatsby/utils.ts +10 -0
- package/exporter/services/store.ts +4 -8
- package/exporter/utils/core-utils.ts +1 -11
- package/exporter/utils/folders.ts +0 -2
- package/exporter/utils/loggin.ts +23 -13
- package/gatsby-node.ts +1 -1
- package/package.json +3 -3
|
@@ -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,
|
|
107
|
+
export { createRenderMetadata, delay, doLifeCycle, getConfig, getSafeSiteId, instanceRootDir, isTruthy, measureExecutionTime, msToSec, pause, removeAllSiteDirsFromStore, removeProperties, sanitizeAPICacheDir, walk, walkStore, };
|
package/build/utils/loggin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
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(
|
|
49
|
-
|
|
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, };
|
|
@@ -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
|
-
|
|
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
|
-
|
|
77
|
-
|
|
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
|
};
|
package/exporter/utils/loggin.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import type {
|
|
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(
|
|
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
|
-
|
|
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
|
+
"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.
|
|
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": "
|
|
130
|
+
"gitHead": "b528c1933f0fe79e4feedacd2247336ab8f967a4"
|
|
131
131
|
}
|