@griddo/cx 11.7.5 → 11.7.6-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 +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 +30 -89
- package/gatsby-ssr.tsx +2 -1
- package/package.json +32 -73
- 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
package/src/components/Head.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CustomHeadProps } from "../types";
|
|
2
2
|
|
|
3
|
-
import { Favicon
|
|
4
|
-
import
|
|
3
|
+
import { Favicon } from "../../react/Favicon";
|
|
4
|
+
import { GriddoIntegrations } from "../../react/GriddoIntegrations";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Gatsby Head API
|
|
@@ -12,13 +12,7 @@ const Head = (props: CustomHeadProps) => {
|
|
|
12
12
|
pageContext: {
|
|
13
13
|
locale,
|
|
14
14
|
openGraph,
|
|
15
|
-
page: {
|
|
16
|
-
disableHrefLangs,
|
|
17
|
-
fullUrl,
|
|
18
|
-
defaultLang,
|
|
19
|
-
integrations = [],
|
|
20
|
-
dimensions,
|
|
21
|
-
},
|
|
15
|
+
page: { disableHrefLangs, fullUrl, defaultLang, integrations = [], dimensions },
|
|
22
16
|
pageMetadata,
|
|
23
17
|
siteMetadata,
|
|
24
18
|
siteOptions,
|
|
@@ -31,19 +25,13 @@ const Head = (props: CustomHeadProps) => {
|
|
|
31
25
|
);
|
|
32
26
|
|
|
33
27
|
const showMetaRobots =
|
|
34
|
-
!!metaRobots &&
|
|
35
|
-
(siteOptions?.showBasicMetaRobots || metaRobots !== "index,follow");
|
|
28
|
+
!!metaRobots && (siteOptions?.showBasicMetaRobots || metaRobots !== "index,follow");
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
const cleanPageLanguages =
|
|
39
|
-
pageMetadata?.pageLanguages?.filter((item) => item.isLive) || [];
|
|
30
|
+
const cleanPageLanguages = pageMetadata?.pageLanguages?.filter((item) => item.isLive) || [];
|
|
40
31
|
|
|
41
32
|
const useCanonical =
|
|
42
33
|
!!pageMetadata?.canonical &&
|
|
43
|
-
!(
|
|
44
|
-
siteOptions?.avoidSelfReferenceCanonicals &&
|
|
45
|
-
pageMetadata?.canonical === fullUrl
|
|
46
|
-
);
|
|
34
|
+
!(siteOptions?.avoidSelfReferenceCanonicals && pageMetadata?.canonical === fullUrl);
|
|
47
35
|
|
|
48
36
|
const useHrefLangs =
|
|
49
37
|
!(
|
|
@@ -60,8 +48,7 @@ const Head = (props: CustomHeadProps) => {
|
|
|
60
48
|
(useHrefLangs &&
|
|
61
49
|
!siteOptions?.avoidHrefLangXDefault &&
|
|
62
50
|
defaultLangId &&
|
|
63
|
-
cleanPageLanguages.find((item) => item.languageId === defaultLangId)
|
|
64
|
-
?.url) ||
|
|
51
|
+
cleanPageLanguages.find((item) => item.languageId === defaultLangId)?.url) ||
|
|
65
52
|
null;
|
|
66
53
|
|
|
67
54
|
return (
|
|
@@ -72,12 +59,9 @@ const Head = (props: CustomHeadProps) => {
|
|
|
72
59
|
{!!pageMetadata?.description && (
|
|
73
60
|
<meta name="description" content={pageMetadata?.description} />
|
|
74
61
|
)}
|
|
75
|
-
{siteOptions?.useMetaTitle &&
|
|
76
|
-
<meta name="title" content={pageMetadata?.title} />
|
|
77
|
-
)}
|
|
62
|
+
{siteOptions?.useMetaTitle && <meta name="title" content={pageMetadata?.title} />}
|
|
78
63
|
{useCanonical && <link rel="canonical" href={pageMetadata?.canonical} />}
|
|
79
64
|
|
|
80
|
-
{/* Favicon images */}
|
|
81
65
|
<Favicon url={siteMetadata?.favicon} />
|
|
82
66
|
|
|
83
67
|
{/* Alternate, solo si se indexa la página y tiene traducciones */}
|
|
@@ -98,15 +82,11 @@ const Head = (props: CustomHeadProps) => {
|
|
|
98
82
|
{showMetaRobots && <meta name="robots" content={metaRobots} />}
|
|
99
83
|
|
|
100
84
|
{/* Open Graph */}
|
|
101
|
-
{
|
|
102
|
-
|
|
103
|
-
)}
|
|
85
|
+
{/* @todo: Create a <GriddoOpenGraph /> component */}
|
|
86
|
+
{!!siteMetadata?.title && <meta property="og:site_name" content={siteMetadata?.title} />}
|
|
104
87
|
{!!locale && <meta property="og:locale" content={locale} />}
|
|
105
88
|
{(!!openGraph?.title || !!pageMetadata?.title) && (
|
|
106
|
-
<meta
|
|
107
|
-
property="og:title"
|
|
108
|
-
content={openGraph?.title || pageMetadata?.title}
|
|
109
|
-
/>
|
|
89
|
+
<meta property="og:title" content={openGraph?.title || pageMetadata?.title} />
|
|
110
90
|
)}
|
|
111
91
|
<meta property="og:type" content={openGraph?.type || "website"} />
|
|
112
92
|
{(!!openGraph?.description || !!pageMetadata?.description) && (
|
|
@@ -115,13 +95,8 @@ const Head = (props: CustomHeadProps) => {
|
|
|
115
95
|
content={openGraph?.description || pageMetadata?.description}
|
|
116
96
|
/>
|
|
117
97
|
)}
|
|
118
|
-
{!!openGraph?.image &&
|
|
119
|
-
|
|
120
|
-
)}
|
|
121
|
-
<meta
|
|
122
|
-
property="og:url"
|
|
123
|
-
content={pageMetadata?.canonical || fullUrl || ""}
|
|
124
|
-
/>
|
|
98
|
+
{!!openGraph?.image && <meta property="og:image" content={openGraph?.image} />}
|
|
99
|
+
<meta property="og:url" content={pageMetadata?.canonical || fullUrl || ""} />
|
|
125
100
|
|
|
126
101
|
{/* Twitter */}
|
|
127
102
|
<meta property="twitter:card" content="summary_large_image" />
|
|
@@ -129,14 +104,6 @@ const Head = (props: CustomHeadProps) => {
|
|
|
129
104
|
<meta property="twitter:image" content={openGraph?.twitterImage} />
|
|
130
105
|
)}
|
|
131
106
|
|
|
132
|
-
{/* Debug */}
|
|
133
|
-
{/* {!siteOptions?.avoidDebugMetas && (
|
|
134
|
-
<meta
|
|
135
|
-
property="debug"
|
|
136
|
-
content={`Griddo v${griddoVersion} @ ${renderDate}}`}
|
|
137
|
-
/>
|
|
138
|
-
)} */}
|
|
139
|
-
|
|
140
107
|
{/* Keywords */}
|
|
141
108
|
{siteOptions?.useMetaKeywords && !!pageMetadata?.metaKeywords && (
|
|
142
109
|
<meta name="keywords" content={pageMetadata.metaKeywords} />
|
|
@@ -1,30 +1,17 @@
|
|
|
1
|
-
import type { TemplateProps } from "../types";
|
|
2
1
|
import type { Core } from "@griddo/core";
|
|
2
|
+
import type { TemplateProps } from "../types";
|
|
3
3
|
|
|
4
4
|
import { Page as RenderGriddoPage } from "@griddo/core";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
components,
|
|
8
|
-
SiteProvider,
|
|
9
|
-
templates,
|
|
10
|
-
formsTemplates,
|
|
11
|
-
} from "@griddo-instance";
|
|
5
|
+
import { components, formsTemplates, SiteProvider, templates } from "@griddo-instance";
|
|
12
6
|
import { Link, navigate } from "gatsby";
|
|
13
|
-
import * as React from "react";
|
|
14
7
|
|
|
15
|
-
|
|
8
|
+
import { GriddoIntegrations } from "../../react/GriddoIntegrations";
|
|
9
|
+
|
|
16
10
|
export { Head } from "./Head";
|
|
17
11
|
|
|
18
12
|
const Template = (data: TemplateProps) => {
|
|
19
13
|
const {
|
|
20
|
-
pageContext: {
|
|
21
|
-
cloudinaryName,
|
|
22
|
-
page,
|
|
23
|
-
siteLangs,
|
|
24
|
-
siteMetadata,
|
|
25
|
-
socials,
|
|
26
|
-
theme,
|
|
27
|
-
},
|
|
14
|
+
pageContext: { cloudinaryName, page, siteLangs, siteMetadata, socials, theme },
|
|
28
15
|
} = data;
|
|
29
16
|
|
|
30
17
|
const library = {
|
|
@@ -33,8 +20,6 @@ const Template = (data: TemplateProps) => {
|
|
|
33
20
|
formsTemplates,
|
|
34
21
|
};
|
|
35
22
|
|
|
36
|
-
const mappedTheme = theme || "default-theme";
|
|
37
|
-
|
|
38
23
|
const header = data.pageContext.header as Core.HeaderModule;
|
|
39
24
|
const footer = data.pageContext.footer as Core.FooterModule;
|
|
40
25
|
|
|
@@ -52,14 +37,10 @@ const Template = (data: TemplateProps) => {
|
|
|
52
37
|
siteLangs={siteLangs}
|
|
53
38
|
siteMetadata={siteMetadata}
|
|
54
39
|
socials={socials}
|
|
55
|
-
theme={
|
|
40
|
+
theme={theme}
|
|
56
41
|
>
|
|
57
|
-
<GriddoIntegrations
|
|
58
|
-
location="start-body"
|
|
59
|
-
integrations={page.integrations}
|
|
60
|
-
/>
|
|
42
|
+
<GriddoIntegrations location="start-body" integrations={page.integrations} />
|
|
61
43
|
|
|
62
|
-
{/* Render every page */}
|
|
63
44
|
<RenderGriddoPage
|
|
64
45
|
apiUrl={page.apiUrl}
|
|
65
46
|
content={page}
|
|
@@ -70,10 +51,7 @@ const Template = (data: TemplateProps) => {
|
|
|
70
51
|
pageLanguages={page.pageLanguages}
|
|
71
52
|
/>
|
|
72
53
|
|
|
73
|
-
<GriddoIntegrations
|
|
74
|
-
location="end-body"
|
|
75
|
-
integrations={page.integrations}
|
|
76
|
-
/>
|
|
54
|
+
<GriddoIntegrations location="end-body" integrations={page.integrations} />
|
|
77
55
|
</SiteProvider>
|
|
78
56
|
);
|
|
79
57
|
};
|
package/src/gatsby-node-utils.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { GatsbyNode } from "gatsby";
|
|
2
|
+
import type { GriddoPageObject } from "../exporter/types/pages";
|
|
2
3
|
|
|
3
|
-
import
|
|
4
|
+
import fsp from "node:fs/promises";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
|
|
7
|
+
import { ReadFromStoreError } from "../exporter/constants/errors";
|
|
8
|
+
import { brush } from "../exporter/utils/brush";
|
|
9
|
+
import { walkStore } from "../exporter/utils/core-utils";
|
|
10
|
+
import { throwError } from "../exporter/utils/errors";
|
|
11
|
+
import { componentLibraryPathAlias, isComponentLibrary } from "../exporter/utils/instance";
|
|
12
|
+
import { getRenderPathsFromDB } from "../exporter/utils/render";
|
|
4
13
|
|
|
5
14
|
const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = ({
|
|
6
15
|
actions,
|
|
@@ -40,7 +49,87 @@ const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = ({
|
|
|
40
49
|
// No sourcemaps on builds
|
|
41
50
|
if (stage === "build-javascript") {
|
|
42
51
|
actions.setWebpackConfig({ devtool: false });
|
|
52
|
+
|
|
53
|
+
// TODO: Hablar con infra para no invalidar cache de los assets
|
|
54
|
+
// const newWebpackConfig = {
|
|
55
|
+
// ...getConfig(),
|
|
56
|
+
// output: {
|
|
57
|
+
// filename: `[name].js`, // no contenthash
|
|
58
|
+
// chunkFilename: `[name].js`, // no contenthash
|
|
59
|
+
// path: getConfig().output.path,
|
|
60
|
+
// publicPath: getConfig().output.publicPath,
|
|
61
|
+
// },
|
|
62
|
+
// };
|
|
63
|
+
|
|
64
|
+
// actions.replaceWebpackConfig(newWebpackConfig);
|
|
43
65
|
}
|
|
44
66
|
};
|
|
45
67
|
|
|
46
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Return a scale size colors with a number and a measure string (KB by default).
|
|
70
|
+
*
|
|
71
|
+
* @param size The page size in KB.
|
|
72
|
+
* @param measure The measure string to be added in the log.
|
|
73
|
+
*/
|
|
74
|
+
function pageSizeLog(size: number, measure = "KB") {
|
|
75
|
+
const sizeScale = {
|
|
76
|
+
low: 50,
|
|
77
|
+
mid: 80,
|
|
78
|
+
large: 130,
|
|
79
|
+
extraLarge: 210,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// Ternary pawa!
|
|
83
|
+
const color =
|
|
84
|
+
size > sizeScale.large
|
|
85
|
+
? "red"
|
|
86
|
+
: size > sizeScale.mid
|
|
87
|
+
? "magenta"
|
|
88
|
+
: size > sizeScale.low
|
|
89
|
+
? "blue"
|
|
90
|
+
: "green";
|
|
91
|
+
|
|
92
|
+
return brush[color](`${size}${measure}`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Read all pages stored in the `store` Griddo directory and returns one by one
|
|
97
|
+
* with a generator.
|
|
98
|
+
*
|
|
99
|
+
* @param basePath - Base directory to get pages from.
|
|
100
|
+
* @param options.withSizeProp - Add size prop to the page object.
|
|
101
|
+
* @todo throw error if the basePath is not an store folder
|
|
102
|
+
*/
|
|
103
|
+
async function* getBuildPagesFromStore<PageType extends GriddoPageObject>(args?: {
|
|
104
|
+
basePath?: string;
|
|
105
|
+
withSizeProp?: boolean;
|
|
106
|
+
dbFilePath?: string;
|
|
107
|
+
}): AsyncGenerator<PageType> {
|
|
108
|
+
const { basePath, withSizeProp, dbFilePath } = args || {};
|
|
109
|
+
const { __cx } = await getRenderPathsFromDB({
|
|
110
|
+
dbFilePath,
|
|
111
|
+
});
|
|
112
|
+
const pagesDirPath = basePath || path.join(__cx, "store");
|
|
113
|
+
|
|
114
|
+
// Procesamos archivos JSON uno por uno sin cargar todos los paths en memoria
|
|
115
|
+
for await (const filePath of walkStore(pagesDirPath)) {
|
|
116
|
+
try {
|
|
117
|
+
const fileContent = await fsp.readFile(filePath, "utf-8");
|
|
118
|
+
const page = JSON.parse(fileContent) as PageType;
|
|
119
|
+
|
|
120
|
+
if (withSizeProp) {
|
|
121
|
+
const fileStats = await fsp.stat(filePath);
|
|
122
|
+
page.size = fileStats.size / 1024;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// SECURITY: Only returns valid page objects
|
|
126
|
+
if (page.path) {
|
|
127
|
+
yield page;
|
|
128
|
+
}
|
|
129
|
+
} catch (error) {
|
|
130
|
+
throwError(ReadFromStoreError, error);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export { getBuildPagesFromStore, onCreateWebpackConfig, pageSizeLog };
|
package/src/html.tsx
CHANGED
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import type { HtmlProps } from "./types";
|
|
2
2
|
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
|
|
5
3
|
function HTML(props: HtmlProps) {
|
|
6
4
|
return (
|
|
7
5
|
<html {...props.htmlAttributes}>
|
|
8
6
|
<head>
|
|
9
7
|
<meta charSet="utf-8" />
|
|
10
8
|
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
|
|
11
|
-
<meta
|
|
12
|
-
name="viewport"
|
|
13
|
-
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
|
14
|
-
/>
|
|
9
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
15
10
|
{props.headComponents}
|
|
16
11
|
</head>
|
|
17
12
|
<body {...props.bodyAttributes}>
|
|
18
13
|
{props.preBodyComponents}
|
|
19
|
-
<div
|
|
20
|
-
key={"body"}
|
|
21
|
-
id="___gatsby"
|
|
22
|
-
dangerouslySetInnerHTML={{ __html: props.body }}
|
|
23
|
-
/>
|
|
14
|
+
<div key={"body"} id="___gatsby" dangerouslySetInnerHTML={{ __html: props.body }} />
|
|
24
15
|
<div id="modal" />
|
|
25
16
|
{props.postBodyComponents}
|
|
26
17
|
</body>
|
package/src/types.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Core } from "@griddo/core";
|
|
2
|
+
import type { HeadProps } from "gatsby";
|
|
3
|
+
import type { SocialsResponse } from "../exporter/types/api";
|
|
2
4
|
import type {
|
|
3
5
|
AdditionalInfo,
|
|
4
6
|
Dimensions,
|
|
@@ -6,10 +8,8 @@ import type {
|
|
|
6
8
|
GriddoMultiPage,
|
|
7
9
|
GriddoPageObject,
|
|
8
10
|
GriddoSinglePage,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "@griddo/cx";
|
|
12
|
-
import type { HeadProps } from "gatsby";
|
|
11
|
+
} from "../exporter/types/pages";
|
|
12
|
+
import type { Site } from "../exporter/types/sites";
|
|
13
13
|
|
|
14
14
|
interface CustomHeadProps extends HeadProps {
|
|
15
15
|
pageContext: GriddoPageObject["context"] & {
|
|
@@ -89,4 +89,4 @@ type GatsbyPageObject = {
|
|
|
89
89
|
};
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
export { CustomHeadProps, GatsbyPageObject, HtmlProps, TemplateProps };
|
|
92
|
+
export type { CustomHeadProps, GatsbyPageObject, HtmlProps, TemplateProps };
|
package/start-render.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable node/shebang */
|
|
3
|
-
/* eslint-disable node/no-missing-require */
|
|
4
2
|
|
|
5
3
|
// This is the "bin" for the griddo-cx package used by "infra" to trigger a
|
|
6
4
|
// render running `npm run griddo-cx`.
|
|
7
|
-
require("./build/start-render.js");
|
|
5
|
+
require("./build/commands/start-render.js");
|
package/tsconfig.json
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "esnext",
|
|
4
4
|
"lib": ["dom", "esnext"],
|
|
5
|
-
"jsx": "react",
|
|
5
|
+
"jsx": "react-jsx",
|
|
6
6
|
"module": "NodeNext",
|
|
7
7
|
"moduleResolution": "NodeNext",
|
|
8
8
|
"esModuleInterop": true,
|
|
9
9
|
"forceConsistentCasingInFileNames": true,
|
|
10
10
|
"strict": true,
|
|
11
11
|
"skipLibCheck": true,
|
|
12
|
-
"resolveJsonModule": true
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"typeRoots": []
|
|
13
14
|
},
|
|
14
15
|
"include": [
|
|
15
16
|
"./exporter/**/*.ts",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Return the assetPrefix with the domain concatenated `assetPrefix/domain` only
|
|
3
|
-
* if the domain is "pro-" **and** there is a env `GRIDDO_ASSET_PREFIX` with any
|
|
4
|
-
* value different from `null`, `undefined` or `empty string`
|
|
5
|
-
*
|
|
6
|
-
* else...
|
|
7
|
-
* - If assetPrefix or domain is falsy, returns ""
|
|
8
|
-
* - If the domain is not "pro-", returns ""
|
|
9
|
-
*/
|
|
10
|
-
declare function getGatsbyAssetPrefixWithDomain(domain: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Spawn a new node process `yarn gatsby-build`
|
|
13
|
-
* @note This proccess (`yarn gatsby-build`) can not access to the custom Griddo
|
|
14
|
-
* `process.env` so it needs variables passed to it via the `env` prop.
|
|
15
|
-
*/
|
|
16
|
-
declare function runGatsbyBuildCommand(assetPrefixWithDomain: string): void;
|
|
17
|
-
/**
|
|
18
|
-
* Update the Griddo's `/dist` dir with the contents from `public` dir only
|
|
19
|
-
* with files of type: js, json and css.
|
|
20
|
-
*/
|
|
21
|
-
declare function createDistFromGatsbyPublic(domain: string, needsAssetPrefix: boolean): Promise<void>;
|
|
22
|
-
export { createDistFromGatsbyPublic, getGatsbyAssetPrefixWithDomain, runGatsbyBuildCommand, };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { LifeCyclesNames } from "../types/global";
|
|
2
|
-
declare const endpoints: {
|
|
3
|
-
ALERT: string;
|
|
4
|
-
AI_EMBEDDINGS: string;
|
|
5
|
-
BUILD_END: string[];
|
|
6
|
-
BUILD_START: string[];
|
|
7
|
-
DOMAINS: string;
|
|
8
|
-
GET_ALL: string;
|
|
9
|
-
GET_PAGE: string;
|
|
10
|
-
GET_PAGES: string[];
|
|
11
|
-
GET_REFERENCE_FIELD_DATA: string[];
|
|
12
|
-
GET_SITEMAP: string[];
|
|
13
|
-
INFO: string[];
|
|
14
|
-
LANGUAGES: string[];
|
|
15
|
-
LOGIN: string;
|
|
16
|
-
RESET_RENDER: string;
|
|
17
|
-
ROBOTS: string;
|
|
18
|
-
SEARCH: string;
|
|
19
|
-
SETTINGS: string;
|
|
20
|
-
SOCIALS: string[];
|
|
21
|
-
};
|
|
22
|
-
declare const envs: {
|
|
23
|
-
GRIDDO_AI_EMBEDDINGS: boolean;
|
|
24
|
-
GRIDDO_ALERT_FEATURE: boolean;
|
|
25
|
-
GRIDDO_API_CONCURRENCY_COUNT: number;
|
|
26
|
-
GRIDDO_API_MAX_RESPONSE_SIZE: number;
|
|
27
|
-
GRIDDO_API_URL: string | undefined;
|
|
28
|
-
GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
29
|
-
GRIDDO_ASSET_PREFIX: string | undefined;
|
|
30
|
-
GRIDDO_BOT_PASSWORD: string | undefined;
|
|
31
|
-
GRIDDO_BOT_USER: string | undefined;
|
|
32
|
-
GRIDDO_BUILD_LOGS: boolean;
|
|
33
|
-
GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
34
|
-
GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
35
|
-
GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
36
|
-
GRIDDO_DEBUG_LOGS: boolean;
|
|
37
|
-
GRIDDO_FIXTURES_DOMAIN_NAMES: string | undefined;
|
|
38
|
-
GRIDDO_FIXTURES_SITE_NAMES: string | undefined;
|
|
39
|
-
GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
40
|
-
GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
41
|
-
GRIDDO_PUBLIC_API_URL: string | undefined;
|
|
42
|
-
GRIDDO_REACT_APP_INSTANCE: string | undefined;
|
|
43
|
-
GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
44
|
-
GRIDDO_RENDER_ALL_SITES: boolean;
|
|
45
|
-
GRIDDO_RENDER_BREAKPOINTS_FEATURE: boolean;
|
|
46
|
-
GRIDDO_RENDER_PAGES: number[];
|
|
47
|
-
GRIDDO_RENDER_SITE: number;
|
|
48
|
-
GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
49
|
-
GRIDDO_SEARCH_FEATURE: boolean;
|
|
50
|
-
GRIDDO_SKIP_BUILD_CHECKS: boolean;
|
|
51
|
-
GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS: number;
|
|
52
|
-
GRIDDO_SSG_MAX_PAGE_SIZE: number;
|
|
53
|
-
GRIDDO_SSG_VERBOSE_LOGS: boolean;
|
|
54
|
-
GRIDDO_VERBOSE_LOGS: boolean;
|
|
55
|
-
};
|
|
56
|
-
declare const lifeCycleNames: Record<LifeCyclesNames, LifeCyclesNames>;
|
|
57
|
-
export { endpoints, envs, lifeCycleNames };
|