@griddo/cx 11.7.5 → 11.7.6-rc.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/README.md +25 -228
- 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 +12 -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 +9 -0
- package/build/adapters/gatsby/actions/init.js.map +1 -0
- package/build/adapters/gatsby/actions/meta.js +14 -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 +50 -0
- package/build/adapters/gatsby/actions/sync.js.map +1 -0
- package/build/adapters/gatsby/index.js +74 -0
- package/build/adapters/gatsby/index.js.map +1 -0
- package/build/adapters/gatsby/shared/context.js +25 -0
- package/build/adapters/gatsby/shared/context.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 +49 -0
- package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
- package/build/adapters/gatsby/shared/sync-render.js +208 -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 +63 -0
- package/build/commands/end-render.js.map +1 -0
- package/build/commands/prepare-assets-directory.js +32 -0
- package/build/commands/prepare-assets-directory.js.map +1 -0
- package/build/commands/prepare-domains-render.js +138 -0
- package/build/commands/prepare-domains-render.js.map +1 -0
- package/build/commands/reset-render.js +22 -0
- package/build/commands/reset-render.js.map +1 -0
- package/build/commands/start-render.js +35 -0
- package/build/commands/start-render.js.map +1 -0
- package/build/commands/upload-search-content.js +189 -0
- package/build/commands/upload-search-content.js.map +1 -0
- package/build/constants/endpoints.js +42 -0
- package/build/constants/endpoints.js.map +1 -0
- package/build/constants/envs.js +73 -0
- package/build/constants/envs.js.map +1 -0
- package/build/constants/errors.js +89 -0
- package/build/constants/errors.js.map +1 -0
- package/build/exporter/adapters/gatsby/actions/clean.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/close.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/data.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/healthCheck.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/init.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/meta.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/prepare.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/relocation.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/restore.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/ssg.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/sync.d.ts +3 -0
- package/build/exporter/adapters/gatsby/index.d.ts +9 -0
- package/build/exporter/adapters/gatsby/shared/context.d.ts +38 -0
- package/build/exporter/adapters/gatsby/shared/extract-assets.d.ts +7 -0
- package/build/exporter/adapters/gatsby/shared/gatsby-build.d.ts +7 -0
- package/build/exporter/adapters/gatsby/shared/sync-render.d.ts +36 -0
- package/build/exporter/adapters/gatsby/shared/types.d.ts +34 -0
- package/build/exporter/commands/start-render.d.ts +2 -0
- package/build/exporter/commands/upload-search-content.d.ts +2 -0
- package/build/{constants → exporter/constants}/envs.d.ts +1 -7
- package/build/{errors/errors-data.d.ts → exporter/constants/errors.d.ts} +5 -3
- package/build/{services → exporter/services}/auth.d.ts +1 -1
- package/build/exporter/services/db.d.ts +4 -0
- package/build/{services → exporter/services}/robots.d.ts +0 -6
- package/build/{services → exporter/services}/sites.d.ts +5 -2
- package/build/exporter/services/store.d.ts +15 -0
- package/build/{types → exporter/types}/api.d.ts +3 -4
- package/build/{types → exporter/types}/global.d.ts +6 -6
- package/build/{types → exporter/types}/navigation.d.ts +1 -1
- package/build/exporter/types/render.d.ts +50 -0
- package/build/{types → exporter/types}/sites.d.ts +1 -2
- package/build/exporter/utils/artifacts.d.ts +6 -0
- package/build/exporter/utils/brush.d.ts +18 -0
- package/build/{utils → exporter/utils}/cache.d.ts +7 -12
- package/build/{utils/health-checks.d.ts → exporter/utils/check-health.d.ts} +2 -2
- package/build/exporter/utils/core-utils.d.ts +77 -0
- package/build/{utils → exporter/utils}/domains.d.ts +1 -1
- package/build/{errors/index.d.ts → exporter/utils/errors.d.ts} +3 -3
- package/build/exporter/utils/folders.d.ts +66 -0
- package/build/{utils → exporter/utils}/loggin.d.ts +2 -16
- package/build/{utils → exporter/utils}/pages.d.ts +2 -2
- package/build/exporter/utils/render.d.ts +49 -0
- package/build/{utils → exporter/utils}/sites.d.ts +3 -3
- package/build/{utils → exporter/utils}/store.d.ts +10 -38
- package/build/services/auth.js +39 -0
- package/build/services/auth.js.map +1 -0
- package/build/services/db.js +34 -0
- package/build/services/db.js.map +1 -0
- package/build/services/navigation.js +93 -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 +58 -0
- package/build/services/robots.js.map +1 -0
- package/build/services/sites.js +109 -0
- package/build/services/sites.js.map +1 -0
- package/build/services/store.js +282 -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 +161 -0
- package/build/utils/api.js.map +1 -0
- package/build/utils/artifacts.js +34 -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-health.js +68 -0
- package/build/utils/check-health.js.map +1 -0
- package/build/utils/core-utils.js +251 -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 +339 -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 +102 -0
- package/build/utils/loggin.js.map +1 -0
- package/build/utils/pages.js +359 -0
- package/build/utils/pages.js.map +1 -0
- package/build/utils/render.js +144 -0
- package/build/utils/render.js.map +1 -0
- package/build/utils/sites.js +239 -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 +17 -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 +12 -0
- package/exporter/adapters/gatsby/actions/meta.ts +18 -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 +70 -0
- package/exporter/adapters/gatsby/index.ts +60 -146
- package/exporter/adapters/gatsby/shared/context.ts +50 -0
- package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
- package/exporter/adapters/gatsby/shared/gatsby-build.ts +54 -0
- package/exporter/adapters/gatsby/shared/sync-render.ts +294 -0
- package/exporter/adapters/gatsby/shared/types.ts +35 -0
- package/exporter/build-esbuild.noop +42 -0
- package/exporter/build.sh +5 -38
- package/exporter/commands/end-render.ts +56 -81
- package/exporter/commands/prepare-assets-directory.ts +33 -0
- package/exporter/commands/prepare-domains-render.ts +149 -31
- package/exporter/commands/reset-render.ts +12 -3
- package/exporter/commands/start-render.ts +18 -47
- package/exporter/commands/upload-search-content.ts +206 -21
- package/exporter/constants/envs.ts +59 -51
- package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -15
- package/exporter/services/auth.ts +7 -6
- package/exporter/services/db.ts +32 -0
- package/exporter/services/navigation.ts +4 -10
- package/exporter/services/reference-fields.ts +8 -23
- package/exporter/services/robots.ts +8 -15
- package/exporter/services/sites.ts +35 -24
- package/exporter/services/store.ts +118 -76
- package/exporter/types/api.ts +24 -27
- package/exporter/types/global.ts +8 -10
- 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 +46 -82
- package/exporter/{artifacts/index.ts → utils/artifacts.ts} +9 -8
- package/exporter/utils/brush.ts +34 -0
- package/exporter/utils/cache.ts +34 -59
- package/exporter/utils/check-health.ts +79 -0
- package/exporter/utils/core-utils.ts +86 -247
- package/exporter/utils/domains.ts +10 -7
- package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
- package/exporter/utils/folders.ts +161 -92
- package/exporter/utils/images.ts +1 -6
- package/exporter/utils/instance.ts +9 -12
- package/exporter/utils/loggin.ts +24 -89
- package/exporter/utils/pages.ts +23 -88
- package/exporter/utils/render.ts +147 -48
- package/exporter/utils/sites.ts +67 -77
- package/exporter/utils/store.ts +85 -178
- package/gatsby-browser.tsx +41 -58
- package/gatsby-config.ts +6 -12
- package/gatsby-node.ts +15 -77
- package/gatsby-ssr.tsx +2 -1
- package/package.json +33 -74
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
- package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
- package/{exporter/react → react}/Favicon/index.tsx +1 -7
- package/{exporter/react → react}/GriddoIntegrations/index.tsx +6 -14
- package/{exporter/react → react}/GriddoIntegrations/utils.ts +4 -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 +91 -2
- package/src/html.tsx +2 -11
- package/src/types.ts +5 -5
- package/start-render.js +1 -3
- package/tsconfig.json +3 -2
- 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/move-assets.d.ts +0 -1
- package/build/commands/prepare-domains-render.d.ts +0 -1
- 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/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/domains.d.ts +0 -6
- package/build/services/register.d.ts +0 -36
- package/build/services/settings.d.ts +0 -4
- 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/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/core-utils.d.ts +0 -107
- package/build/utils/create-build-data.d.ts +0 -8
- package/build/utils/folders.d.ts +0 -53
- package/build/utils/render.d.ts +0 -13
- package/build/utils/searches.d.ts +0 -15
- 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/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 -179
- package/src/README.md +0 -7
- package/build/{commands → exporter/commands}/end-render.d.ts +0 -0
- package/build/{commands/reset-render.d.ts → exporter/commands/prepare-assets-directory.d.ts} +0 -0
- package/build/{commands/start-render.d.ts → exporter/commands/prepare-domains-render.d.ts} +0 -0
- package/build/{commands/upload-search-content.d.ts → exporter/commands/reset-render.d.ts} +0 -0
- package/build/{constants → exporter/constants}/endpoints.d.ts +0 -0
- package/build/{services → exporter/services}/navigation.d.ts +0 -0
- package/build/{services → exporter/services}/reference-fields.d.ts +0 -0
- package/build/{types → exporter/types}/pages.d.ts +1 -1
- /package/build/{types → exporter/types}/templates.d.ts +0 -0
- /package/build/{utils → exporter/utils}/api.d.ts +0 -0
- /package/build/{utils → exporter/utils}/images.d.ts +0 -0
- /package/build/{utils → exporter/utils}/instance.d.ts +0 -0
- /package/{exporter/react → react}/Favicon/utils.ts +0 -0
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MemoryRegister, Register } from "../services/register";
|
|
2
|
-
|
|
3
|
-
const entries = {
|
|
4
|
-
API_RESPONSE_TOO_BIG: {
|
|
5
|
-
title: "API response size is too large",
|
|
6
|
-
description:
|
|
7
|
-
"API response size is too large and may affect rendering performance",
|
|
8
|
-
entries: [],
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const register = new Register(new MemoryRegister(entries));
|
|
13
|
-
|
|
14
|
-
export default register;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { MemoryRegister, Register } from "../services/register";
|
|
2
|
-
|
|
3
|
-
const entries = {
|
|
4
|
-
GATSBY_PAGE_SIZE_TOO_BIG: {
|
|
5
|
-
title: "Gatsby JSON page size is too large",
|
|
6
|
-
description:
|
|
7
|
-
"The JSON of some Gatsby pages (page-data folder) are too large and may affect rendering performance",
|
|
8
|
-
entries: [],
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const register = new Register(new MemoryRegister(entries));
|
|
13
|
-
|
|
14
|
-
export default register;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Domains } from "../types/global";
|
|
2
|
-
|
|
3
|
-
import { endpoints } from "../constants";
|
|
4
|
-
import { get } from "../utils/api";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get an array of available domain.
|
|
8
|
-
*/
|
|
9
|
-
async function getAllDomains() {
|
|
10
|
-
return get<Domains>({
|
|
11
|
-
endpoint: endpoints.DOMAINS,
|
|
12
|
-
useApiCacheDir: false,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { getAllDomains };
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import fsx from "fs-extra";
|
|
2
|
-
|
|
3
|
-
type Entry = Record<string, unknown>;
|
|
4
|
-
|
|
5
|
-
type EntryData = {
|
|
6
|
-
title: string;
|
|
7
|
-
description: string;
|
|
8
|
-
entries: Array<Entry>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
type Entries = Record<string, EntryData>;
|
|
12
|
-
|
|
13
|
-
interface RegisterBase<T extends Entries> {
|
|
14
|
-
insert(name: keyof T, entry: Entry): void;
|
|
15
|
-
get(name: keyof T): EntryData;
|
|
16
|
-
getAll(): T;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
class MemoryRegister<T extends Entries> implements RegisterBase<T> {
|
|
20
|
-
entries: T;
|
|
21
|
-
|
|
22
|
-
constructor(entries: T) {
|
|
23
|
-
this.entries = entries;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
insert(name: keyof T, entry: Entry) {
|
|
27
|
-
this.entries[name].entries.push(entry);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
get(name: keyof T) {
|
|
31
|
-
return this.entries[name];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getAll() {
|
|
35
|
-
return this.entries;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class FileRegister<T extends Entries> implements RegisterBase<T> {
|
|
40
|
-
private readonly filePath: string;
|
|
41
|
-
entries: T;
|
|
42
|
-
|
|
43
|
-
constructor(filePath: string, entries: T) {
|
|
44
|
-
this.entries = entries;
|
|
45
|
-
this.filePath = filePath;
|
|
46
|
-
try {
|
|
47
|
-
fsx.writeJSONSync(this.filePath, this.entries);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
console.error(`Error writing ${this.filePath}`, e);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
private getCurrentEntries(): T {
|
|
54
|
-
return fsx.readJSONSync(this.filePath, "utf8") as T;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
insert(name: keyof T, entry: Entry) {
|
|
58
|
-
try {
|
|
59
|
-
const currentEntries = this.getCurrentEntries();
|
|
60
|
-
currentEntries[name].entries.push(entry);
|
|
61
|
-
fsx.writeJSONSync(this.filePath, currentEntries);
|
|
62
|
-
} catch (e) {
|
|
63
|
-
console.error(e);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get(name: keyof T) {
|
|
68
|
-
try {
|
|
69
|
-
return fsx.readJSONSync(this.filePath, "utf8")[name] as EntryData;
|
|
70
|
-
} catch (e) {
|
|
71
|
-
console.error(e);
|
|
72
|
-
throw new Error(`Error reading ${this.filePath}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
getAll() {
|
|
77
|
-
try {
|
|
78
|
-
return fsx.readJSONSync(this.filePath, "utf8") as T;
|
|
79
|
-
} catch (e) {
|
|
80
|
-
console.error(e);
|
|
81
|
-
throw new Error(`Error reading ${this.filePath}`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
class Register<T extends Entries> {
|
|
87
|
-
private strategy: RegisterBase<T>;
|
|
88
|
-
|
|
89
|
-
constructor(strategy: RegisterBase<T>) {
|
|
90
|
-
this.strategy = strategy;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
insert<K extends keyof T>(name: K, entry: Entry) {
|
|
94
|
-
this.strategy.insert(name, entry);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
get<K extends keyof T>(name: K) {
|
|
98
|
-
return this.strategy.get(name);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
getAll() {
|
|
102
|
-
return this.strategy.getAll();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export {
|
|
107
|
-
FileRegister,
|
|
108
|
-
MemoryRegister,
|
|
109
|
-
Register,
|
|
110
|
-
type Entries,
|
|
111
|
-
type Entry,
|
|
112
|
-
type EntryData,
|
|
113
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { Settings } from "../types/global";
|
|
2
|
-
|
|
3
|
-
import { endpoints } from "../constants";
|
|
4
|
-
import { get, post } from "../utils/api";
|
|
5
|
-
|
|
6
|
-
async function getAllSettings() {
|
|
7
|
-
return get<Settings>({ endpoint: endpoints.SETTINGS });
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async function resetRender() {
|
|
11
|
-
await post({
|
|
12
|
-
endpoint: endpoints.RESET_RENDER,
|
|
13
|
-
useApiCacheDir: false,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { getAllSettings, resetRender };
|
package/exporter/utils/alerts.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { GriddoAlertRegisterProps } from "@griddo/core";
|
|
2
|
-
|
|
3
|
-
import axios from "axios";
|
|
4
|
-
|
|
5
|
-
import { endpoints } from "../constants";
|
|
6
|
-
|
|
7
|
-
// Esta función está duplicada de core de manera intencionada por si esta recibe
|
|
8
|
-
// cambios necesitados solo por CX.
|
|
9
|
-
// Nota: Sí estamos reutilizando el type.
|
|
10
|
-
async function insertAlert({
|
|
11
|
-
area,
|
|
12
|
-
description,
|
|
13
|
-
fullData,
|
|
14
|
-
instantNotification = false,
|
|
15
|
-
level,
|
|
16
|
-
}: Omit<GriddoAlertRegisterProps, "publicApiUrl">) {
|
|
17
|
-
const url = endpoints.ALERT;
|
|
18
|
-
const body = { level, area, description, fullData, instantNotification };
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
await axios.post(url, body, {
|
|
22
|
-
headers: { "Content-Type": "application/json", Connection: "close" },
|
|
23
|
-
});
|
|
24
|
-
} catch (error) {
|
|
25
|
-
console.error("Error creating Griddo alert:", error);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { insertAlert };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createAPICacheDir } from "./cache";
|
|
2
|
-
import { sanitizeAPICacheDir } from "./core-utils";
|
|
3
|
-
import { createStore } from "../services/store";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Download all data: sites, pages etc.. from the instance private Griddo API.
|
|
7
|
-
* Then you can use the generator funcion `getBuildPagesFromStore()` to get the pages and
|
|
8
|
-
* `getBuildMetadata()` to get build and sites metadata as objects. Both from
|
|
9
|
-
* exporter utils sites dir.
|
|
10
|
-
*/
|
|
11
|
-
async function createDomainRenderData(domain: string) {
|
|
12
|
-
createAPICacheDir();
|
|
13
|
-
await createStore(domain);
|
|
14
|
-
sanitizeAPICacheDir();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { createDomainRenderData };
|
|
@@ -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,179 +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: prepareHTMLContentForSearch(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) {
|
|
58
|
-
const noTagsContent = removeHTMLTags(
|
|
59
|
-
["meta", "link", "style", "script", "noscript", "nav", "header", "footer"],
|
|
60
|
-
content,
|
|
61
|
-
);
|
|
62
|
-
const plainTextContent = stripHTMLTags(noTagsContent);
|
|
63
|
-
|
|
64
|
-
return stripSpaces(plainTextContent);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Removes (replacing with empty string) the content for the HTML tags and the tags themself from the content string.
|
|
69
|
-
*
|
|
70
|
-
* @param tags An array of HTML tags without the <>.
|
|
71
|
-
* @param content The content string.
|
|
72
|
-
*/
|
|
73
|
-
function removeHTMLTags(tags: Array<string>, content: string) {
|
|
74
|
-
let filteredContent = content;
|
|
75
|
-
|
|
76
|
-
for (const tag of tags) {
|
|
77
|
-
filteredContent = filteredContent
|
|
78
|
-
// eslint-disable-next-line no-useless-escape
|
|
79
|
-
.replace(new RegExp(`<${tag}.*?>.*?<\/${tag}>`, "gis"), " ")
|
|
80
|
-
.replace(new RegExp(`(<${tag}([^>]+)>)`, "gis"), " ");
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return filteredContent;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Remove every HTML tags from the content
|
|
88
|
-
*
|
|
89
|
-
* @param content The string to be processed.
|
|
90
|
-
* @param replaceWith The string to replace the remove HTML tags.
|
|
91
|
-
*/
|
|
92
|
-
function stripHTMLTags(content: string) {
|
|
93
|
-
return content.replace(/(<([^>]+)>)/gis, " ");
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Removes duplicate whitespaces
|
|
98
|
-
*
|
|
99
|
-
* @param str The string to remove white spaces
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* stripSpaces(" Lorem ipsum dolor ") // " Lorem ipsum dolor "
|
|
103
|
-
*/
|
|
104
|
-
function stripSpaces(str: string) {
|
|
105
|
-
return str.replace(/\s+/g, " ");
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Function that search in the `/public` dir the content info of the pages and
|
|
110
|
-
* send it to the search table in the ddbb using the API.
|
|
111
|
-
*/
|
|
112
|
-
async function uploadRenderedSearchContentToAPI(
|
|
113
|
-
distDomainPath: string,
|
|
114
|
-
domain: string,
|
|
115
|
-
) {
|
|
116
|
-
const config = getConfig();
|
|
117
|
-
const { __cache } = config.paths(domain);
|
|
118
|
-
|
|
119
|
-
// Extraemos el path de la carpeta store dentro de un dominio
|
|
120
|
-
const storeFolder = path.join(__cache, "store");
|
|
121
|
-
|
|
122
|
-
// Este caso sería que el dominio existe en la instancia pero no hay sites
|
|
123
|
-
// renderizardos bajo el mismo. Por lo que `store` no existe.
|
|
124
|
-
if (!fs.existsSync(storeFolder)) {
|
|
125
|
-
console.log(
|
|
126
|
-
`Skipping uploading content to the search endpoint for the domain ${domain}, it has not exported sites.`,
|
|
127
|
-
);
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Obtenemos las páginas del store cacheado de un dominio
|
|
132
|
-
const storePages = getBuildPagesFromCachedStore(domain);
|
|
133
|
-
|
|
134
|
-
for await (const store of storePages) {
|
|
135
|
-
const {
|
|
136
|
-
context: { page, openGraph, pageMetadata },
|
|
137
|
-
} = store;
|
|
138
|
-
|
|
139
|
-
const { compose } = page.fullPath;
|
|
140
|
-
|
|
141
|
-
const contextPath = path.resolve(`${distDomainPath}/${compose}/index.html`);
|
|
142
|
-
|
|
143
|
-
const content = fs.readFileSync(contextPath).toString();
|
|
144
|
-
|
|
145
|
-
const pageObject: PostSearchInfoProps = {
|
|
146
|
-
siteId: page.site,
|
|
147
|
-
pageId: page.id,
|
|
148
|
-
// `pageMetadata.title` has already a fallback `metatitle ||
|
|
149
|
-
// pageTitle` so probably `title` never will be take the
|
|
150
|
-
// `openGraph?.title` value. Only when the `metatitle` and
|
|
151
|
-
// `pageTitle` are empty.
|
|
152
|
-
title: pageMetadata?.title || openGraph?.title,
|
|
153
|
-
languageId: page.language,
|
|
154
|
-
url: page.fullUrl,
|
|
155
|
-
template: page.template.templateType || page.templateId,
|
|
156
|
-
description: pageMetadata?.description || openGraph?.description,
|
|
157
|
-
image: openGraph.image,
|
|
158
|
-
content,
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
await postSearchInfo(pageObject);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
async function startAIEmbeddings() {
|
|
166
|
-
try {
|
|
167
|
-
await post<AIEmbeddingsResponse>({
|
|
168
|
-
endpoint: endpoints.AI_EMBEDDINGS,
|
|
169
|
-
useApiCacheDir: false,
|
|
170
|
-
});
|
|
171
|
-
} catch (error) {
|
|
172
|
-
console.warn(
|
|
173
|
-
"There was an error with the ai embeddings",
|
|
174
|
-
(error as Error).message,
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
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.
|
|
File without changes
|
package/build/{commands/reset-render.d.ts → exporter/commands/prepare-assets-directory.d.ts}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { Core, Fields } from "@griddo/core";
|
|
1
2
|
import type { SocialsResponse } from "./api";
|
|
2
3
|
import type { Settings } from "./global";
|
|
3
4
|
import type { Site } from "./sites";
|
|
4
|
-
import type { Core, Fields } from "@griddo/core";
|
|
5
5
|
export type APIPageObject = Core.Page & {
|
|
6
6
|
id: number;
|
|
7
7
|
} & {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|