@griddo/cx 11.7.10 → 11.7.12-rc.0
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/README.md +27 -226
- package/build/adapters/gatsby/actions/clean.js +10 -0
- package/build/adapters/gatsby/actions/clean.js.map +1 -0
- package/build/adapters/gatsby/actions/close.js +14 -0
- package/build/adapters/gatsby/actions/close.js.map +1 -0
- package/build/adapters/gatsby/actions/data.js +18 -0
- package/build/adapters/gatsby/actions/data.js.map +1 -0
- package/build/adapters/gatsby/actions/healthCheck.js +10 -0
- package/build/adapters/gatsby/actions/healthCheck.js.map +1 -0
- package/build/adapters/gatsby/actions/init.js +22 -0
- package/build/adapters/gatsby/actions/init.js.map +1 -0
- package/build/adapters/gatsby/actions/logs.js +9 -0
- package/build/adapters/gatsby/actions/logs.js.map +1 -0
- package/build/adapters/gatsby/actions/meta.js +13 -0
- package/build/adapters/gatsby/actions/meta.js.map +1 -0
- package/build/adapters/gatsby/actions/prepare.js +9 -0
- package/build/adapters/gatsby/actions/prepare.js.map +1 -0
- package/build/adapters/gatsby/actions/relocation.js +15 -0
- package/build/adapters/gatsby/actions/relocation.js.map +1 -0
- package/build/adapters/gatsby/actions/restore.js +26 -0
- package/build/adapters/gatsby/actions/restore.js.map +1 -0
- package/build/adapters/gatsby/actions/ssg.js +9 -0
- package/build/adapters/gatsby/actions/ssg.js.map +1 -0
- package/build/adapters/gatsby/actions/sync.js +51 -0
- package/build/adapters/gatsby/actions/sync.js.map +1 -0
- package/build/adapters/gatsby/index.js +78 -0
- package/build/adapters/gatsby/index.js.map +1 -0
- package/build/adapters/gatsby/shared/artifacts.js +20 -0
- package/build/adapters/gatsby/shared/artifacts.js.map +1 -0
- package/build/adapters/gatsby/shared/context.js +31 -0
- package/build/adapters/gatsby/shared/context.js.map +1 -0
- package/build/adapters/gatsby/shared/diff-assets.js +101 -0
- package/build/adapters/gatsby/shared/diff-assets.js.map +1 -0
- package/build/adapters/gatsby/shared/extract-assets.js +58 -0
- package/build/adapters/gatsby/shared/extract-assets.js.map +1 -0
- package/build/adapters/gatsby/shared/gatsby-build.js +55 -0
- package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
- package/build/adapters/gatsby/shared/sync-render.js +210 -0
- package/build/adapters/gatsby/shared/sync-render.js.map +1 -0
- package/build/adapters/gatsby/shared/types.js +3 -0
- package/build/adapters/gatsby/shared/types.js.map +1 -0
- package/build/commands/end-render.js +87 -0
- package/build/commands/end-render.js.map +1 -0
- package/build/commands/prepare-assets-directory.js +30 -0
- package/build/commands/prepare-assets-directory.js.map +1 -0
- package/build/commands/prepare-domains-render.js +133 -0
- package/build/commands/prepare-domains-render.js.map +1 -0
- package/build/commands/reset-render.js +21 -0
- package/build/commands/reset-render.js.map +1 -0
- package/build/commands/start-render.js +44 -0
- package/build/commands/start-render.js.map +1 -0
- package/build/commands/upload-search-content.js +180 -0
- package/build/commands/upload-search-content.js.map +1 -0
- package/build/constants/endpoints.js +43 -0
- package/build/constants/endpoints.js.map +1 -0
- package/build/constants/envs.js +68 -0
- package/build/constants/envs.js.map +1 -0
- package/build/constants/errors.js +81 -0
- package/build/constants/errors.js.map +1 -0
- package/build/services/auth.js +40 -0
- package/build/services/auth.js.map +1 -0
- package/build/services/db-class.js +49 -0
- package/build/services/db-class.js.map +1 -0
- package/build/services/db.js +34 -0
- package/build/services/db.js.map +1 -0
- package/build/services/navigation.js +96 -0
- package/build/services/navigation.js.map +1 -0
- package/build/services/reference-fields.js +131 -0
- package/build/services/reference-fields.js.map +1 -0
- package/build/services/robots.js +60 -0
- package/build/services/robots.js.map +1 -0
- package/build/services/sites.js +110 -0
- package/build/services/sites.js.map +1 -0
- package/build/services/store.js +257 -0
- package/build/services/store.js.map +1 -0
- package/build/types/api.js +3 -0
- package/build/types/api.js.map +1 -0
- package/build/types/global.js +3 -0
- package/build/types/global.js.map +1 -0
- package/build/types/navigation.js +3 -0
- package/build/types/navigation.js.map +1 -0
- package/build/types/pages.js +3 -0
- package/build/types/pages.js.map +1 -0
- package/build/types/render.js +10 -0
- package/build/types/render.js.map +1 -0
- package/build/types/sites.js +3 -0
- package/build/types/sites.js.map +1 -0
- package/build/types/templates.js +3 -0
- package/build/types/templates.js.map +1 -0
- package/build/utils/api.js +165 -0
- package/build/utils/api.js.map +1 -0
- package/build/utils/artifacts.js +38 -0
- package/build/utils/artifacts.js.map +1 -0
- package/build/utils/brush.js +30 -0
- package/build/utils/brush.js.map +1 -0
- package/build/utils/cache.js +106 -0
- package/build/utils/cache.js.map +1 -0
- package/build/utils/check-environment-health.js +69 -0
- package/build/utils/check-environment-health.js.map +1 -0
- package/build/utils/core-utils.js +270 -0
- package/build/utils/core-utils.js.map +1 -0
- package/build/utils/domains.js +37 -0
- package/build/utils/domains.js.map +1 -0
- package/build/utils/errors.js +30 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/folders.js +341 -0
- package/build/utils/folders.js.map +1 -0
- package/build/utils/images.js +45 -0
- package/build/utils/images.js.map +1 -0
- package/build/utils/instance.js +66 -0
- package/build/utils/instance.js.map +1 -0
- package/build/utils/loggin.js +119 -0
- package/build/utils/loggin.js.map +1 -0
- package/build/utils/npm-deps/find-up-simple.js +75 -0
- package/build/utils/npm-deps/find-up-simple.js.map +1 -0
- package/build/utils/npm-deps/pkg-dir.js +20 -0
- package/build/utils/npm-deps/pkg-dir.js.map +1 -0
- package/build/utils/npm-deps/xml-parser.js +49 -0
- package/build/utils/npm-deps/xml-parser.js.map +1 -0
- package/build/utils/pages.js +359 -0
- package/build/utils/pages.js.map +1 -0
- package/build/utils/render.js +168 -0
- package/build/utils/render.js.map +1 -0
- package/build/utils/sitemaps.js +110 -0
- package/build/utils/sitemaps.js.map +1 -0
- package/build/utils/sites.js +105 -0
- package/build/utils/sites.js.map +1 -0
- package/build/utils/store.js +193 -0
- package/build/utils/store.js.map +1 -0
- package/exporter/adapters/gatsby/actions/clean.ts +14 -0
- package/exporter/adapters/gatsby/actions/close.ts +20 -0
- package/exporter/adapters/gatsby/actions/data.ts +25 -0
- package/exporter/adapters/gatsby/actions/healthCheck.ts +10 -0
- package/exporter/adapters/gatsby/actions/init.ts +26 -0
- package/exporter/adapters/gatsby/actions/logs.ts +10 -0
- package/exporter/adapters/gatsby/actions/meta.ts +16 -0
- package/exporter/adapters/gatsby/actions/prepare.ts +9 -0
- package/exporter/adapters/gatsby/actions/relocation.ts +15 -0
- package/exporter/adapters/gatsby/actions/restore.ts +36 -0
- package/exporter/adapters/gatsby/actions/ssg.ts +12 -0
- package/exporter/adapters/gatsby/actions/sync.ts +71 -0
- package/exporter/adapters/gatsby/index.ts +73 -153
- package/exporter/adapters/gatsby/shared/artifacts.ts +16 -0
- package/exporter/adapters/gatsby/shared/context.ts +50 -0
- package/exporter/adapters/gatsby/shared/diff-assets.ts +113 -0
- package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
- package/exporter/adapters/gatsby/shared/gatsby-build.ts +58 -0
- package/exporter/adapters/gatsby/shared/sync-render.ts +276 -0
- package/exporter/adapters/gatsby/shared/types.ts +35 -0
- package/exporter/build-esbuild.noop +42 -0
- package/exporter/build.sh +4 -38
- package/exporter/commands/end-render.ts +72 -70
- package/exporter/commands/prepare-assets-directory.ts +30 -0
- package/exporter/commands/prepare-domains-render.ts +143 -31
- package/exporter/commands/reset-render.ts +10 -3
- package/exporter/commands/start-render.ts +22 -45
- package/exporter/commands/upload-search-content.ts +194 -21
- package/exporter/constants/endpoints.ts +2 -1
- package/exporter/constants/envs.ts +57 -55
- package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -14
- package/exporter/services/auth.ts +7 -6
- package/exporter/services/db-class.ts +54 -0
- package/exporter/services/db.ts +32 -0
- package/exporter/services/navigation.ts +4 -10
- package/exporter/services/reference-fields.ts +9 -24
- package/exporter/services/robots.ts +9 -16
- package/exporter/services/sites.ts +36 -24
- package/exporter/services/store.ts +107 -96
- package/exporter/types/api.ts +27 -28
- package/exporter/types/global.ts +8 -11
- package/exporter/types/navigation.ts +1 -1
- package/exporter/types/pages.ts +2 -3
- package/exporter/types/render.ts +59 -0
- package/exporter/types/sites.ts +1 -2
- package/exporter/utils/api.ts +55 -75
- package/exporter/utils/artifacts.ts +38 -0
- package/exporter/utils/brush.ts +34 -0
- package/exporter/utils/cache.ts +37 -62
- package/exporter/utils/check-environment-health.ts +80 -0
- package/exporter/utils/core-utils.ts +133 -272
- package/exporter/utils/domains.ts +10 -7
- package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
- package/exporter/utils/folders.ts +163 -98
- package/exporter/utils/images.ts +1 -6
- package/exporter/utils/instance.ts +9 -13
- package/exporter/utils/loggin.ts +44 -91
- package/exporter/utils/npm-deps/find-up-simple.ts +100 -0
- package/exporter/utils/npm-deps/pkg-dir.ts +17 -0
- package/exporter/utils/npm-deps/xml-parser.ts +57 -0
- package/exporter/utils/pages.ts +23 -88
- package/exporter/utils/render.ts +180 -48
- package/exporter/utils/sitemaps.ts +129 -0
- package/exporter/utils/sites.ts +19 -197
- package/exporter/utils/store.ts +87 -180
- package/gatsby-browser.tsx +41 -58
- package/gatsby-config.ts +10 -17
- package/gatsby-node.ts +17 -78
- package/gatsby-ssr.tsx +2 -1
- package/package.json +35 -86
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
- package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
- package/react/DynamicScript/index.tsx +33 -0
- package/{exporter/react → react}/Favicon/index.tsx +1 -7
- package/{exporter/react → react}/GriddoIntegrations/index.tsx +16 -22
- package/{exporter/react → react}/GriddoIntegrations/utils.ts +21 -9
- package/{build/react/index.d.ts → react/index.tsx} +1 -0
- package/src/components/Head.tsx +13 -46
- package/src/components/template.tsx +8 -30
- package/src/gatsby-node-utils.ts +73 -2
- package/src/html.tsx +2 -11
- package/src/types.ts +5 -5
- package/tsconfig.commands.json +36 -0
- package/tsconfig.exporter.json +19 -0
- package/tsconfig.json +5 -3
- package/build/adapters/gatsby/index.d.ts +0 -4
- package/build/adapters/gatsby/utils.d.ts +0 -22
- package/build/artifacts/index.d.ts +0 -6
- package/build/commands/end-render.d.ts +0 -2
- package/build/commands/move-assets.d.ts +0 -1
- package/build/commands/prepare-domains-render.d.ts +0 -1
- package/build/commands/reset-render.d.ts +0 -2
- package/build/commands/start-render.d.ts +0 -2
- package/build/commands/upload-search-content.d.ts +0 -2
- package/build/constants/endpoints.d.ts +0 -19
- package/build/constants/envs.d.ts +0 -37
- package/build/constants/index.d.ts +0 -57
- package/build/end-render.js +0 -74
- package/build/end-render.js.map +0 -7
- package/build/errors/errors-data.d.ts +0 -22
- package/build/errors/index.d.ts +0 -15
- package/build/index.d.ts +0 -29
- package/build/index.js +0 -73
- package/build/index.js.map +0 -7
- package/build/prepare-domains-render.js +0 -73
- package/build/prepare-domains-render.js.map +0 -7
- package/build/react/Favicon/index.d.ts +0 -5
- package/build/react/Favicon/utils.d.ts +0 -9
- package/build/react/GriddoIntegrations/index.d.ts +0 -20
- package/build/react/GriddoIntegrations/utils.d.ts +0 -26
- package/build/react/index.js +0 -3
- package/build/registers/api.d.ts +0 -9
- package/build/registers/gatsby.d.ts +0 -9
- package/build/registers/index.d.ts +0 -3
- package/build/reset-render.js +0 -74
- package/build/reset-render.js.map +0 -7
- package/build/services/auth.d.ts +0 -10
- package/build/services/domains.d.ts +0 -6
- package/build/services/navigation.d.ts +0 -50
- package/build/services/reference-fields.d.ts +0 -20
- package/build/services/register.d.ts +0 -36
- package/build/services/robots.d.ts +0 -19
- package/build/services/settings.d.ts +0 -4
- package/build/services/sites.d.ts +0 -29
- package/build/services/store.d.ts +0 -6
- package/build/start-render.js +0 -100
- package/build/start-render.js.map +0 -7
- package/build/types/api.d.ts +0 -142
- package/build/types/global.d.ts +0 -84
- package/build/types/navigation.d.ts +0 -28
- package/build/types/pages.d.ts +0 -144
- package/build/types/sites.d.ts +0 -57
- package/build/types/templates.d.ts +0 -8
- package/build/upload-search-content.js +0 -74
- package/build/upload-search-content.js.map +0 -7
- package/build/utils/alerts.d.ts +0 -3
- package/build/utils/api.d.ts +0 -23
- package/build/utils/cache.d.ts +0 -35
- package/build/utils/core-utils.d.ts +0 -107
- package/build/utils/create-build-data.d.ts +0 -8
- package/build/utils/domains.d.ts +0 -13
- package/build/utils/folders.d.ts +0 -53
- package/build/utils/health-checks.d.ts +0 -7
- package/build/utils/images.d.ts +0 -16
- package/build/utils/instance.d.ts +0 -21
- package/build/utils/loggin.d.ts +0 -51
- package/build/utils/pages.d.ts +0 -34
- package/build/utils/render.d.ts +0 -13
- package/build/utils/searches.d.ts +0 -15
- package/build/utils/sites.d.ts +0 -31
- package/build/utils/store.d.ts +0 -81
- package/cx.config.d.ts +0 -5
- package/cx.config.js +0 -36
- package/exporter/adapters/gatsby/utils.ts +0 -161
- package/exporter/artifacts/README.md +0 -34
- package/exporter/artifacts/index.ts +0 -33
- package/exporter/commands/move-assets.ts +0 -11
- package/exporter/constants/index.ts +0 -129
- package/exporter/index.ts +0 -82
- package/exporter/react/index.tsx +0 -11
- package/exporter/registers/api.ts +0 -14
- package/exporter/registers/gatsby.ts +0 -14
- package/exporter/registers/index.ts +0 -4
- package/exporter/services/domains.ts +0 -16
- package/exporter/services/register.ts +0 -113
- package/exporter/services/settings.ts +0 -17
- package/exporter/utils/alerts.ts +0 -29
- package/exporter/utils/create-build-data.ts +0 -17
- package/exporter/utils/health-checks.ts +0 -64
- package/exporter/utils/searches.ts +0 -156
- package/src/README.md +0 -7
- package/start-render.js +0 -7
- /package/{exporter/react → react}/Favicon/utils.ts +0 -0
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { boxLog } from "./loggin";
|
|
2
|
-
import { envs } from "../constants";
|
|
3
|
-
|
|
4
|
-
const GRIDDO_ENVS_VARS: ReadonlyArray<string> = [];
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Check if the environment is secure to launch a render.
|
|
8
|
-
* If something fails then log an error message and exit from the process.
|
|
9
|
-
* Otherwise just return true.
|
|
10
|
-
*/
|
|
11
|
-
function checkRenderHealthOrExit() {
|
|
12
|
-
// Bypass the check using this env var, handy for local renders.
|
|
13
|
-
if (envs.GRIDDO_SKIP_BUILD_CHECKS) {
|
|
14
|
-
console.info("Build health check skipped");
|
|
15
|
-
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Checklist
|
|
20
|
-
const envsVars = checkEnvsVars(GRIDDO_ENVS_VARS);
|
|
21
|
-
|
|
22
|
-
// Render is safe if...
|
|
23
|
-
const renderingIsSave = envsVars;
|
|
24
|
-
|
|
25
|
-
// The environment is suitable for a build-render
|
|
26
|
-
if (renderingIsSave) {
|
|
27
|
-
console.info("Build health check passed");
|
|
28
|
-
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Error
|
|
33
|
-
boxLog(
|
|
34
|
-
"Error. The environment is not suitable for a build.",
|
|
35
|
-
"Not valid environment",
|
|
36
|
-
);
|
|
37
|
-
process.exit(1);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Check if a list of environments variables exist with any value.
|
|
42
|
-
*
|
|
43
|
-
* @todo Also check the value.
|
|
44
|
-
* @param envs An array of environments variables
|
|
45
|
-
* @returns exists with (1) if there are missing envs vars
|
|
46
|
-
*/
|
|
47
|
-
function checkEnvsVars(envs: ReadonlyArray<string>) {
|
|
48
|
-
const missingEnvs = envs.filter((envName) => {
|
|
49
|
-
return !process.env[envName];
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
if (missingEnvs.length) {
|
|
53
|
-
const missingEnvsMsg = missingEnvs.join("\n");
|
|
54
|
-
console.error(
|
|
55
|
-
`Env check failed. These envs vars are missing: \n\n${missingEnvsMsg}`,
|
|
56
|
-
);
|
|
57
|
-
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { checkRenderHealthOrExit };
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import type { PostSearchInfoResponse } from "../types/api";
|
|
2
|
-
import type {
|
|
3
|
-
AIEmbeddingsResponse,
|
|
4
|
-
PostSearchInfoProps,
|
|
5
|
-
} from "../types/global";
|
|
6
|
-
|
|
7
|
-
import fs from "node:fs";
|
|
8
|
-
import path from "node:path";
|
|
9
|
-
|
|
10
|
-
import { post } from "./api";
|
|
11
|
-
import { getConfig } from "./core-utils";
|
|
12
|
-
import { getBuildPagesFromCachedStore } from "./store";
|
|
13
|
-
import { endpoints } from "../constants";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Save in the BBDD the content of a page parsed without HTML tags.
|
|
17
|
-
*
|
|
18
|
-
* @param props Object with parts of the final page object to be saved in the BBDD.
|
|
19
|
-
*/
|
|
20
|
-
async function postSearchInfo(props: PostSearchInfoProps) {
|
|
21
|
-
const {
|
|
22
|
-
title,
|
|
23
|
-
description,
|
|
24
|
-
image,
|
|
25
|
-
pageId,
|
|
26
|
-
languageId,
|
|
27
|
-
siteId,
|
|
28
|
-
url,
|
|
29
|
-
content,
|
|
30
|
-
template,
|
|
31
|
-
} = props;
|
|
32
|
-
|
|
33
|
-
const response = await post<PostSearchInfoResponse>({
|
|
34
|
-
endpoint: endpoints.SEARCH,
|
|
35
|
-
body: {
|
|
36
|
-
title,
|
|
37
|
-
description,
|
|
38
|
-
image,
|
|
39
|
-
pageId,
|
|
40
|
-
languageId,
|
|
41
|
-
siteId,
|
|
42
|
-
url,
|
|
43
|
-
template,
|
|
44
|
-
content,
|
|
45
|
-
},
|
|
46
|
-
useApiCacheDir: false,
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
return response;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Remove the every cntent inside some HTML tags including them.
|
|
54
|
-
*
|
|
55
|
-
* @param content A string with the content.
|
|
56
|
-
*/
|
|
57
|
-
function prepareHTMLContentForSearch(content: string): string {
|
|
58
|
-
// 1. Remove script, style, and other unwanted block tags and their content.
|
|
59
|
-
// The regex looks for <tag...>...</tag> where tag is one of the specified ones.
|
|
60
|
-
const tagsToRemove = [
|
|
61
|
-
"meta",
|
|
62
|
-
"link",
|
|
63
|
-
"style",
|
|
64
|
-
"script",
|
|
65
|
-
"noscript",
|
|
66
|
-
"nav",
|
|
67
|
-
"header",
|
|
68
|
-
"footer",
|
|
69
|
-
];
|
|
70
|
-
const removeTagsRegex = new RegExp(
|
|
71
|
-
`<(${tagsToRemove.join("|")})\\b[^>]*>.*?<\\/\\1>`,
|
|
72
|
-
"gis",
|
|
73
|
-
);
|
|
74
|
-
let processedContent = content.replace(removeTagsRegex, "");
|
|
75
|
-
|
|
76
|
-
// 2. Strip all remaining HTML tags.
|
|
77
|
-
processedContent = processedContent.replace(/<[^>]+>/g, " ");
|
|
78
|
-
|
|
79
|
-
// 3. Normalize whitespace: replace multiple spaces/newlines with a single space and trim.
|
|
80
|
-
processedContent = processedContent.replace(/\s+/g, " ").trim();
|
|
81
|
-
|
|
82
|
-
return processedContent;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Function that search in the `/public` dir the content info of the pages and
|
|
87
|
-
* send it to the search table in the ddbb using the API.
|
|
88
|
-
*/
|
|
89
|
-
async function uploadRenderedSearchContentToAPI(
|
|
90
|
-
distDomainPath: string,
|
|
91
|
-
domain: string,
|
|
92
|
-
) {
|
|
93
|
-
const config = getConfig();
|
|
94
|
-
const { __cache } = config.paths(domain);
|
|
95
|
-
|
|
96
|
-
// Extraemos el path de la carpeta store dentro de un dominio
|
|
97
|
-
const storeFolder = path.join(__cache, "store");
|
|
98
|
-
|
|
99
|
-
// Este caso sería que el dominio existe en la instancia pero no hay sites
|
|
100
|
-
// renderizardos bajo el mismo. Por lo que `store` no existe.
|
|
101
|
-
if (!fs.existsSync(storeFolder)) {
|
|
102
|
-
console.log(
|
|
103
|
-
`Skipping uploading content to the search endpoint for the domain ${domain}, it has not exported sites.`,
|
|
104
|
-
);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Obtenemos las páginas del store cacheado de un dominio
|
|
109
|
-
const storePages = getBuildPagesFromCachedStore(domain);
|
|
110
|
-
|
|
111
|
-
for await (const store of storePages) {
|
|
112
|
-
const {
|
|
113
|
-
context: { page, openGraph, pageMetadata },
|
|
114
|
-
} = store;
|
|
115
|
-
|
|
116
|
-
const { compose } = page.fullPath;
|
|
117
|
-
|
|
118
|
-
const contextPath = path.resolve(`${distDomainPath}/${compose}/index.html`);
|
|
119
|
-
|
|
120
|
-
const content = fs.readFileSync(contextPath).toString();
|
|
121
|
-
|
|
122
|
-
const pageObject: PostSearchInfoProps = {
|
|
123
|
-
siteId: page.site,
|
|
124
|
-
pageId: page.id,
|
|
125
|
-
// `pageMetadata.title` has already a fallback `metatitle ||
|
|
126
|
-
// pageTitle` so probably `title` never will be take the
|
|
127
|
-
// `openGraph?.title` value. Only when the `metatitle` and
|
|
128
|
-
// `pageTitle` are empty.
|
|
129
|
-
title: pageMetadata?.title || openGraph?.title,
|
|
130
|
-
languageId: page.language,
|
|
131
|
-
url: page.fullUrl,
|
|
132
|
-
template: page.template.templateType || page.templateId,
|
|
133
|
-
description: pageMetadata?.description || openGraph?.description,
|
|
134
|
-
image: openGraph.image,
|
|
135
|
-
content: prepareHTMLContentForSearch(content),
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
await postSearchInfo(pageObject);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
async function startAIEmbeddings() {
|
|
143
|
-
try {
|
|
144
|
-
await post<AIEmbeddingsResponse>({
|
|
145
|
-
endpoint: endpoints.AI_EMBEDDINGS,
|
|
146
|
-
useApiCacheDir: false,
|
|
147
|
-
});
|
|
148
|
-
} catch (error) {
|
|
149
|
-
console.warn(
|
|
150
|
-
"There was an error with the ai embeddings",
|
|
151
|
-
(error as Error).message,
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export { postSearchInfo, startAIEmbeddings, uploadRenderedSearchContentToAPI };
|
package/src/README.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# Griddo CX + Gatsby
|
|
2
|
-
|
|
3
|
-
The `/src` dir and almost every file in the root dir is now 100% Gatsby related code along with the historical `/public`, `/dist`, `/apiCache`, `/store`, etc.. render dirs.
|
|
4
|
-
|
|
5
|
-
Griddo CX code (the business logic) is now in `/exporter` dir.
|
|
6
|
-
|
|
7
|
-
In the future, Griddo CX and Gatsby will split int their own packages dirs inside the mono-repo.
|
package/start-render.js
DELETED
|
File without changes
|