@griddo/cx 11.1.0 → 11.1.1
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 +21 -21
- package/build/end-render.js.map +4 -4
- package/build/index.js +32 -31
- package/build/index.js.map +4 -4
- package/build/reset-render.js +20 -20
- package/build/reset-render.js.map +4 -4
- package/build/run-start-render.js +32 -31
- package/build/run-start-render.js.map +4 -4
- package/build/start-render.js +32 -31
- package/build/start-render.js.map +4 -4
- package/build/upload-search-content.js +23 -23
- package/build/upload-search-content.js.map +4 -4
- package/build/utils/core-utils.d.ts +2 -1
- package/build/utils/folders.d.ts +2 -1
- package/exporter/adapters/gatsby/index.ts +6 -1
- package/exporter/artifacts/index.ts +2 -1
- package/exporter/utils/core-utils.ts +56 -0
- package/exporter/utils/folders.ts +11 -0
- package/exporter/utils/loggin.ts +8 -3
- package/package.json +3 -3
|
@@ -104,4 +104,5 @@ declare function doLifeCycle(name: LifeCyclesNames, options: {
|
|
|
104
104
|
*/
|
|
105
105
|
declare function createRenderMetadata(domain: string): Promise<void>;
|
|
106
106
|
declare function removeAllSiteDirsFromStore(): void;
|
|
107
|
-
|
|
107
|
+
declare function saveBuildEndLogs(): void;
|
|
108
|
+
export { createRenderMetadata, delay, doLifeCycle, getConfig, getSafeSiteId, instanceRootDir, isTruthy, measureExecutionTime, msToSec, pause, removeAllSiteDirsFromStore, removeProperties, sanitizeAPICacheDir, saveBuildEndLogs, walk, walkStore, };
|
package/build/utils/folders.d.ts
CHANGED
|
@@ -55,4 +55,5 @@ declare function removeVirtualPagesFromStore(): Promise<void>;
|
|
|
55
55
|
* @deprecated - This funcion is deprecated.
|
|
56
56
|
*/
|
|
57
57
|
declare function clearSitemapsFromDirs(initialFolder: string): void;
|
|
58
|
-
|
|
58
|
+
declare function prependFileSync(filePath: string, content: string): void;
|
|
59
|
+
export { clearEmptyDirs, clearSitemapsFromDirs, copyArtifacts, createArtifacts, moveArtifacts, prependFileSync, removeArtifacts, removeVirtualPagesFromStore, renameArtifact, };
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
createRenderMetadata,
|
|
13
13
|
doLifeCycle,
|
|
14
14
|
getConfig,
|
|
15
|
+
saveBuildEndLogs,
|
|
15
16
|
} from "../../utils/core-utils";
|
|
16
17
|
import { createBuildData } from "../../utils/create-build-data";
|
|
17
18
|
import { getInstanceDomains } from "../../utils/domains";
|
|
@@ -113,7 +114,11 @@ export async function renderDomainsWithGatsbyAdapter() {
|
|
|
113
114
|
});
|
|
114
115
|
|
|
115
116
|
await doLifeCycle("Meta", {
|
|
116
|
-
steps: [
|
|
117
|
+
steps: [
|
|
118
|
+
//
|
|
119
|
+
() => createRenderMetadata(domain),
|
|
120
|
+
() => saveBuildEndLogs(),
|
|
121
|
+
],
|
|
117
122
|
});
|
|
118
123
|
|
|
119
124
|
await doLifeCycle("Archive", {
|
|
@@ -23,9 +23,10 @@ function getCxArtifacts(domain: string): Artifacts {
|
|
|
23
23
|
path.join(__cx, "apiCache"),
|
|
24
24
|
path.join(__cx, "render-metadata.json"),
|
|
25
25
|
path.join(__cx, "dist"),
|
|
26
|
+
path.join(__cx, "debug"),
|
|
26
27
|
],
|
|
27
28
|
cacheables: ["apiCache", "store"],
|
|
28
|
-
archivables: ["dist", "assets"],
|
|
29
|
+
archivables: ["dist", "assets", "debug"],
|
|
29
30
|
};
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -12,6 +12,7 @@ import pkgDir from "pkg-dir";
|
|
|
12
12
|
|
|
13
13
|
import { envs } from "../constants";
|
|
14
14
|
import { throwError } from "../errors";
|
|
15
|
+
import { prependFileSync } from "./folders";
|
|
15
16
|
import { boxLog, infoLog, successLog } from "./loggin";
|
|
16
17
|
import { generateBuildReport, generateSitemaps } from "./sites";
|
|
17
18
|
import { LifecycleExecutionError } from "../errors/errors-data";
|
|
@@ -393,6 +394,60 @@ function removeAllSiteDirsFromStore() {
|
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
396
|
|
|
397
|
+
function getFormattedDateTime() {
|
|
398
|
+
const now = new Date();
|
|
399
|
+
const date = [
|
|
400
|
+
String(now.getDate()).padStart(2, "0"),
|
|
401
|
+
String(now.getMonth() + 1).padStart(2, "0"),
|
|
402
|
+
now.getFullYear(),
|
|
403
|
+
].join("-");
|
|
404
|
+
|
|
405
|
+
const time = [
|
|
406
|
+
String(now.getHours()).padStart(2, "0"),
|
|
407
|
+
String(now.getMinutes()).padStart(2, "0"),
|
|
408
|
+
String(now.getSeconds()).padStart(2, "0"),
|
|
409
|
+
].join(":");
|
|
410
|
+
|
|
411
|
+
return `${date}_${time}`;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
function saveBuildEndLogs() {
|
|
415
|
+
const { __cx } = config.paths();
|
|
416
|
+
const { sitesToPublish, createdPages, buildProcessData } = fsx.readJSONSync(
|
|
417
|
+
path.join(__cx, "render-metadata.json"),
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
const dateString = getFormattedDateTime();
|
|
421
|
+
const buildEndLogsDir = path.join(__cx, "debug", "build-end");
|
|
422
|
+
|
|
423
|
+
if (!fs.existsSync(buildEndLogsDir)) {
|
|
424
|
+
fs.mkdirSync(buildEndLogsDir, { recursive: true });
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Log
|
|
428
|
+
fs.writeFileSync(
|
|
429
|
+
path.join(buildEndLogsDir, `${dateString}.json`),
|
|
430
|
+
JSON.stringify(
|
|
431
|
+
{
|
|
432
|
+
date: new Date().toLocaleString(),
|
|
433
|
+
log: {
|
|
434
|
+
sitesToPublish,
|
|
435
|
+
createdPages,
|
|
436
|
+
buildProcessData,
|
|
437
|
+
},
|
|
438
|
+
},
|
|
439
|
+
null,
|
|
440
|
+
2,
|
|
441
|
+
),
|
|
442
|
+
);
|
|
443
|
+
|
|
444
|
+
// Update index
|
|
445
|
+
prependFileSync(
|
|
446
|
+
path.join(buildEndLogsDir, "index.html"),
|
|
447
|
+
`<pre><a href="${dateString}.json">${dateString}</a></pre>\n`,
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
|
|
396
451
|
export {
|
|
397
452
|
createRenderMetadata,
|
|
398
453
|
delay,
|
|
@@ -407,6 +462,7 @@ export {
|
|
|
407
462
|
removeAllSiteDirsFromStore,
|
|
408
463
|
removeProperties,
|
|
409
464
|
sanitizeAPICacheDir,
|
|
465
|
+
saveBuildEndLogs,
|
|
410
466
|
walk,
|
|
411
467
|
walkStore,
|
|
412
468
|
};
|
|
@@ -339,12 +339,23 @@ function clearSitemapsFromDirs(initialFolder: string) {
|
|
|
339
339
|
removeXmlFiles(initialFolder);
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
function prependFileSync(filePath: string, content: string) {
|
|
343
|
+
let currentContent = "";
|
|
344
|
+
|
|
345
|
+
if (fs.existsSync(filePath)) {
|
|
346
|
+
currentContent = fs.readFileSync(filePath, "utf8");
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
fs.writeFileSync(filePath, content + currentContent, "utf8");
|
|
350
|
+
}
|
|
351
|
+
|
|
342
352
|
export {
|
|
343
353
|
clearEmptyDirs,
|
|
344
354
|
clearSitemapsFromDirs,
|
|
345
355
|
copyArtifacts,
|
|
346
356
|
createArtifacts,
|
|
347
357
|
moveArtifacts,
|
|
358
|
+
prependFileSync,
|
|
348
359
|
removeArtifacts,
|
|
349
360
|
removeVirtualPagesFromStore,
|
|
350
361
|
renameArtifact,
|
package/exporter/utils/loggin.ts
CHANGED
|
@@ -143,13 +143,18 @@ function showExporterVersion() {
|
|
|
143
143
|
|
|
144
144
|
function listSitesLog(title: string, sites: Array<Site>) {
|
|
145
145
|
const maxline = Math.max(
|
|
146
|
-
...sites.map(
|
|
146
|
+
...sites.map(
|
|
147
|
+
(s) =>
|
|
148
|
+
s.name.length + (s.shouldBeUpdated ? 1 : 0) + s.id.toString().length,
|
|
149
|
+
),
|
|
147
150
|
);
|
|
148
151
|
|
|
149
152
|
const sitesStr = sites.map((s) => {
|
|
150
|
-
const
|
|
153
|
+
const shouldBeUpdated = s.shouldBeUpdated ? "*" : "";
|
|
154
|
+
const lineLen =
|
|
155
|
+
s.name.length + shouldBeUpdated.length + s.id.toString().length;
|
|
151
156
|
const padding = " ".repeat(maxline - lineLen);
|
|
152
|
-
return `${kleur.bold(s.name)} ${kleur.dim("(" + s.id + ")")} ${padding}${kleur.dim("-")} ${kleur.dim(s.slug)}`;
|
|
157
|
+
return `${kleur.bold(s.name)} ${kleur.dim("(" + s.id + ")")} ${shouldBeUpdated} ${padding}${kleur.dim("-")} ${kleur.dim(s.slug)}`;
|
|
153
158
|
});
|
|
154
159
|
|
|
155
160
|
console.log(`
|
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.1.
|
|
4
|
+
"version": "11.1.1",
|
|
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.26.0",
|
|
61
61
|
"@babel/preset-react": "7.26.3",
|
|
62
62
|
"@babel/preset-typescript": "7.26.0",
|
|
63
|
-
"@griddo/core": "11.1.
|
|
63
|
+
"@griddo/core": "11.1.1",
|
|
64
64
|
"@svgr/webpack": "5.5.0",
|
|
65
65
|
"axios": "1.7.9",
|
|
66
66
|
"babel-loader": "9.2.1",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"publishConfig": {
|
|
127
127
|
"access": "public"
|
|
128
128
|
},
|
|
129
|
-
"gitHead": "
|
|
129
|
+
"gitHead": "54be62448614043e86f35762e4972facb2dc902d"
|
|
130
130
|
}
|