@griddo/cx 11.7.11 → 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.
Files changed (302) hide show
  1. package/README.md +27 -226
  2. package/build/adapters/gatsby/actions/clean.js +10 -0
  3. package/build/adapters/gatsby/actions/clean.js.map +1 -0
  4. package/build/adapters/gatsby/actions/close.js +14 -0
  5. package/build/adapters/gatsby/actions/close.js.map +1 -0
  6. package/build/adapters/gatsby/actions/data.js +18 -0
  7. package/build/adapters/gatsby/actions/data.js.map +1 -0
  8. package/build/adapters/gatsby/actions/healthCheck.js +10 -0
  9. package/build/adapters/gatsby/actions/healthCheck.js.map +1 -0
  10. package/build/adapters/gatsby/actions/init.js +22 -0
  11. package/build/adapters/gatsby/actions/init.js.map +1 -0
  12. package/build/adapters/gatsby/actions/logs.js +9 -0
  13. package/build/adapters/gatsby/actions/logs.js.map +1 -0
  14. package/build/adapters/gatsby/actions/meta.js +13 -0
  15. package/build/adapters/gatsby/actions/meta.js.map +1 -0
  16. package/build/adapters/gatsby/actions/prepare.js +9 -0
  17. package/build/adapters/gatsby/actions/prepare.js.map +1 -0
  18. package/build/adapters/gatsby/actions/relocation.js +15 -0
  19. package/build/adapters/gatsby/actions/relocation.js.map +1 -0
  20. package/build/adapters/gatsby/actions/restore.js +26 -0
  21. package/build/adapters/gatsby/actions/restore.js.map +1 -0
  22. package/build/adapters/gatsby/actions/ssg.js +9 -0
  23. package/build/adapters/gatsby/actions/ssg.js.map +1 -0
  24. package/build/adapters/gatsby/actions/sync.js +51 -0
  25. package/build/adapters/gatsby/actions/sync.js.map +1 -0
  26. package/build/adapters/gatsby/index.js +78 -0
  27. package/build/adapters/gatsby/index.js.map +1 -0
  28. package/build/adapters/gatsby/shared/artifacts.js +20 -0
  29. package/build/adapters/gatsby/shared/artifacts.js.map +1 -0
  30. package/build/adapters/gatsby/shared/context.js +31 -0
  31. package/build/adapters/gatsby/shared/context.js.map +1 -0
  32. package/build/adapters/gatsby/shared/diff-assets.js +101 -0
  33. package/build/adapters/gatsby/shared/diff-assets.js.map +1 -0
  34. package/build/adapters/gatsby/shared/extract-assets.js +58 -0
  35. package/build/adapters/gatsby/shared/extract-assets.js.map +1 -0
  36. package/build/adapters/gatsby/shared/gatsby-build.js +55 -0
  37. package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
  38. package/build/adapters/gatsby/shared/sync-render.js +210 -0
  39. package/build/adapters/gatsby/shared/sync-render.js.map +1 -0
  40. package/build/adapters/gatsby/shared/types.js +3 -0
  41. package/build/adapters/gatsby/shared/types.js.map +1 -0
  42. package/build/commands/end-render.js +87 -0
  43. package/build/commands/end-render.js.map +1 -0
  44. package/build/commands/prepare-assets-directory.js +30 -0
  45. package/build/commands/prepare-assets-directory.js.map +1 -0
  46. package/build/commands/prepare-domains-render.js +133 -0
  47. package/build/commands/prepare-domains-render.js.map +1 -0
  48. package/build/commands/reset-render.js +21 -0
  49. package/build/commands/reset-render.js.map +1 -0
  50. package/build/commands/start-render.js +44 -0
  51. package/build/commands/start-render.js.map +1 -0
  52. package/build/commands/upload-search-content.js +180 -0
  53. package/build/commands/upload-search-content.js.map +1 -0
  54. package/build/constants/endpoints.js +43 -0
  55. package/build/constants/endpoints.js.map +1 -0
  56. package/build/constants/envs.js +68 -0
  57. package/build/constants/envs.js.map +1 -0
  58. package/build/constants/errors.js +81 -0
  59. package/build/constants/errors.js.map +1 -0
  60. package/build/services/auth.js +40 -0
  61. package/build/services/auth.js.map +1 -0
  62. package/build/services/db-class.js +49 -0
  63. package/build/services/db-class.js.map +1 -0
  64. package/build/services/db.js +34 -0
  65. package/build/services/db.js.map +1 -0
  66. package/build/services/navigation.js +96 -0
  67. package/build/services/navigation.js.map +1 -0
  68. package/build/services/reference-fields.js +131 -0
  69. package/build/services/reference-fields.js.map +1 -0
  70. package/build/services/robots.js +60 -0
  71. package/build/services/robots.js.map +1 -0
  72. package/build/services/sites.js +110 -0
  73. package/build/services/sites.js.map +1 -0
  74. package/build/services/store.js +257 -0
  75. package/build/services/store.js.map +1 -0
  76. package/build/types/api.js +3 -0
  77. package/build/types/api.js.map +1 -0
  78. package/build/types/global.js +3 -0
  79. package/build/types/global.js.map +1 -0
  80. package/build/types/navigation.js +3 -0
  81. package/build/types/navigation.js.map +1 -0
  82. package/build/types/pages.js +3 -0
  83. package/build/types/pages.js.map +1 -0
  84. package/build/types/render.js +10 -0
  85. package/build/types/render.js.map +1 -0
  86. package/build/types/sites.js +3 -0
  87. package/build/types/sites.js.map +1 -0
  88. package/build/types/templates.js +3 -0
  89. package/build/types/templates.js.map +1 -0
  90. package/build/utils/api.js +165 -0
  91. package/build/utils/api.js.map +1 -0
  92. package/build/utils/artifacts.js +38 -0
  93. package/build/utils/artifacts.js.map +1 -0
  94. package/build/utils/brush.js +30 -0
  95. package/build/utils/brush.js.map +1 -0
  96. package/build/utils/cache.js +106 -0
  97. package/build/utils/cache.js.map +1 -0
  98. package/build/utils/check-environment-health.js +69 -0
  99. package/build/utils/check-environment-health.js.map +1 -0
  100. package/build/utils/core-utils.js +270 -0
  101. package/build/utils/core-utils.js.map +1 -0
  102. package/build/utils/domains.js +37 -0
  103. package/build/utils/domains.js.map +1 -0
  104. package/build/utils/errors.js +30 -0
  105. package/build/utils/errors.js.map +1 -0
  106. package/build/utils/folders.js +341 -0
  107. package/build/utils/folders.js.map +1 -0
  108. package/build/utils/images.js +45 -0
  109. package/build/utils/images.js.map +1 -0
  110. package/build/utils/instance.js +66 -0
  111. package/build/utils/instance.js.map +1 -0
  112. package/build/utils/loggin.js +119 -0
  113. package/build/utils/loggin.js.map +1 -0
  114. package/build/utils/npm-deps/find-up-simple.js +75 -0
  115. package/build/utils/npm-deps/find-up-simple.js.map +1 -0
  116. package/build/utils/npm-deps/pkg-dir.js +20 -0
  117. package/build/utils/npm-deps/pkg-dir.js.map +1 -0
  118. package/build/utils/npm-deps/xml-parser.js +49 -0
  119. package/build/utils/npm-deps/xml-parser.js.map +1 -0
  120. package/build/utils/pages.js +359 -0
  121. package/build/utils/pages.js.map +1 -0
  122. package/build/utils/render.js +168 -0
  123. package/build/utils/render.js.map +1 -0
  124. package/build/utils/sitemaps.js +110 -0
  125. package/build/utils/sitemaps.js.map +1 -0
  126. package/build/utils/sites.js +105 -0
  127. package/build/utils/sites.js.map +1 -0
  128. package/build/utils/store.js +193 -0
  129. package/build/utils/store.js.map +1 -0
  130. package/exporter/adapters/gatsby/actions/clean.ts +14 -0
  131. package/exporter/adapters/gatsby/actions/close.ts +20 -0
  132. package/exporter/adapters/gatsby/actions/data.ts +25 -0
  133. package/exporter/adapters/gatsby/actions/healthCheck.ts +10 -0
  134. package/exporter/adapters/gatsby/actions/init.ts +26 -0
  135. package/exporter/adapters/gatsby/actions/logs.ts +10 -0
  136. package/exporter/adapters/gatsby/actions/meta.ts +16 -0
  137. package/exporter/adapters/gatsby/actions/prepare.ts +9 -0
  138. package/exporter/adapters/gatsby/actions/relocation.ts +15 -0
  139. package/exporter/adapters/gatsby/actions/restore.ts +36 -0
  140. package/exporter/adapters/gatsby/actions/ssg.ts +12 -0
  141. package/exporter/adapters/gatsby/actions/sync.ts +71 -0
  142. package/exporter/adapters/gatsby/index.ts +73 -153
  143. package/exporter/adapters/gatsby/shared/artifacts.ts +16 -0
  144. package/exporter/adapters/gatsby/shared/context.ts +50 -0
  145. package/exporter/adapters/gatsby/shared/diff-assets.ts +113 -0
  146. package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
  147. package/exporter/adapters/gatsby/shared/gatsby-build.ts +58 -0
  148. package/exporter/adapters/gatsby/shared/sync-render.ts +276 -0
  149. package/exporter/adapters/gatsby/shared/types.ts +35 -0
  150. package/exporter/build-esbuild.noop +42 -0
  151. package/exporter/build.sh +4 -38
  152. package/exporter/commands/end-render.ts +72 -70
  153. package/exporter/commands/prepare-assets-directory.ts +30 -0
  154. package/exporter/commands/prepare-domains-render.ts +143 -31
  155. package/exporter/commands/reset-render.ts +10 -3
  156. package/exporter/commands/start-render.ts +22 -45
  157. package/exporter/commands/upload-search-content.ts +194 -21
  158. package/exporter/constants/endpoints.ts +2 -1
  159. package/exporter/constants/envs.ts +57 -55
  160. package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -14
  161. package/exporter/services/auth.ts +7 -6
  162. package/exporter/services/db-class.ts +54 -0
  163. package/exporter/services/db.ts +32 -0
  164. package/exporter/services/navigation.ts +4 -10
  165. package/exporter/services/reference-fields.ts +9 -24
  166. package/exporter/services/robots.ts +9 -16
  167. package/exporter/services/sites.ts +36 -24
  168. package/exporter/services/store.ts +107 -96
  169. package/exporter/types/api.ts +27 -28
  170. package/exporter/types/global.ts +8 -11
  171. package/exporter/types/navigation.ts +1 -1
  172. package/exporter/types/pages.ts +2 -3
  173. package/exporter/types/render.ts +59 -0
  174. package/exporter/types/sites.ts +1 -2
  175. package/exporter/utils/api.ts +55 -75
  176. package/exporter/utils/artifacts.ts +38 -0
  177. package/exporter/utils/brush.ts +34 -0
  178. package/exporter/utils/cache.ts +37 -62
  179. package/exporter/utils/check-environment-health.ts +80 -0
  180. package/exporter/utils/core-utils.ts +133 -272
  181. package/exporter/utils/domains.ts +10 -7
  182. package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
  183. package/exporter/utils/folders.ts +163 -98
  184. package/exporter/utils/images.ts +1 -6
  185. package/exporter/utils/instance.ts +9 -13
  186. package/exporter/utils/loggin.ts +44 -91
  187. package/exporter/utils/npm-deps/find-up-simple.ts +100 -0
  188. package/exporter/utils/npm-deps/pkg-dir.ts +17 -0
  189. package/exporter/utils/npm-deps/xml-parser.ts +57 -0
  190. package/exporter/utils/pages.ts +23 -88
  191. package/exporter/utils/render.ts +180 -48
  192. package/exporter/utils/sitemaps.ts +129 -0
  193. package/exporter/utils/sites.ts +19 -197
  194. package/exporter/utils/store.ts +87 -180
  195. package/gatsby-browser.tsx +41 -58
  196. package/gatsby-config.ts +10 -17
  197. package/gatsby-node.ts +17 -78
  198. package/gatsby-ssr.tsx +2 -1
  199. package/package.json +35 -86
  200. package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
  201. package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
  202. package/react/DynamicScript/index.tsx +33 -0
  203. package/{exporter/react → react}/Favicon/index.tsx +1 -7
  204. package/{exporter/react → react}/GriddoIntegrations/index.tsx +16 -22
  205. package/{exporter/react → react}/GriddoIntegrations/utils.ts +21 -9
  206. package/{build/react/index.d.ts → react/index.tsx} +1 -0
  207. package/src/components/Head.tsx +13 -46
  208. package/src/components/template.tsx +8 -30
  209. package/src/gatsby-node-utils.ts +73 -2
  210. package/src/html.tsx +2 -11
  211. package/src/types.ts +5 -5
  212. package/tsconfig.commands.json +36 -0
  213. package/tsconfig.exporter.json +19 -0
  214. package/tsconfig.json +5 -3
  215. package/build/adapters/gatsby/index.d.ts +0 -4
  216. package/build/adapters/gatsby/utils.d.ts +0 -22
  217. package/build/artifacts/index.d.ts +0 -6
  218. package/build/commands/end-render.d.ts +0 -2
  219. package/build/commands/move-assets.d.ts +0 -1
  220. package/build/commands/prepare-domains-render.d.ts +0 -1
  221. package/build/commands/reset-render.d.ts +0 -2
  222. package/build/commands/start-render.d.ts +0 -2
  223. package/build/commands/upload-search-content.d.ts +0 -2
  224. package/build/constants/endpoints.d.ts +0 -19
  225. package/build/constants/envs.d.ts +0 -37
  226. package/build/constants/index.d.ts +0 -57
  227. package/build/end-render.js +0 -74
  228. package/build/end-render.js.map +0 -7
  229. package/build/errors/errors-data.d.ts +0 -22
  230. package/build/errors/index.d.ts +0 -15
  231. package/build/index.d.ts +0 -29
  232. package/build/index.js +0 -73
  233. package/build/index.js.map +0 -7
  234. package/build/prepare-domains-render.js +0 -73
  235. package/build/prepare-domains-render.js.map +0 -7
  236. package/build/react/Favicon/index.d.ts +0 -5
  237. package/build/react/Favicon/utils.d.ts +0 -9
  238. package/build/react/GriddoIntegrations/index.d.ts +0 -20
  239. package/build/react/GriddoIntegrations/utils.d.ts +0 -26
  240. package/build/react/index.js +0 -3
  241. package/build/registers/api.d.ts +0 -9
  242. package/build/registers/gatsby.d.ts +0 -9
  243. package/build/registers/index.d.ts +0 -3
  244. package/build/reset-render.js +0 -74
  245. package/build/reset-render.js.map +0 -7
  246. package/build/services/auth.d.ts +0 -10
  247. package/build/services/domains.d.ts +0 -6
  248. package/build/services/navigation.d.ts +0 -50
  249. package/build/services/reference-fields.d.ts +0 -20
  250. package/build/services/register.d.ts +0 -36
  251. package/build/services/robots.d.ts +0 -19
  252. package/build/services/settings.d.ts +0 -4
  253. package/build/services/sites.d.ts +0 -29
  254. package/build/services/store.d.ts +0 -6
  255. package/build/start-render.js +0 -100
  256. package/build/start-render.js.map +0 -7
  257. package/build/types/api.d.ts +0 -142
  258. package/build/types/global.d.ts +0 -84
  259. package/build/types/navigation.d.ts +0 -28
  260. package/build/types/pages.d.ts +0 -144
  261. package/build/types/sites.d.ts +0 -57
  262. package/build/types/templates.d.ts +0 -8
  263. package/build/upload-search-content.js +0 -74
  264. package/build/upload-search-content.js.map +0 -7
  265. package/build/utils/alerts.d.ts +0 -3
  266. package/build/utils/api.d.ts +0 -23
  267. package/build/utils/cache.d.ts +0 -35
  268. package/build/utils/core-utils.d.ts +0 -107
  269. package/build/utils/create-build-data.d.ts +0 -8
  270. package/build/utils/domains.d.ts +0 -13
  271. package/build/utils/folders.d.ts +0 -53
  272. package/build/utils/health-checks.d.ts +0 -7
  273. package/build/utils/images.d.ts +0 -16
  274. package/build/utils/instance.d.ts +0 -21
  275. package/build/utils/loggin.d.ts +0 -51
  276. package/build/utils/pages.d.ts +0 -34
  277. package/build/utils/render.d.ts +0 -13
  278. package/build/utils/searches.d.ts +0 -15
  279. package/build/utils/sites.d.ts +0 -31
  280. package/build/utils/store.d.ts +0 -81
  281. package/cx.config.d.ts +0 -5
  282. package/cx.config.js +0 -36
  283. package/exporter/adapters/gatsby/utils.ts +0 -161
  284. package/exporter/artifacts/README.md +0 -34
  285. package/exporter/artifacts/index.ts +0 -33
  286. package/exporter/commands/move-assets.ts +0 -11
  287. package/exporter/constants/index.ts +0 -129
  288. package/exporter/index.ts +0 -82
  289. package/exporter/react/index.tsx +0 -11
  290. package/exporter/registers/api.ts +0 -14
  291. package/exporter/registers/gatsby.ts +0 -14
  292. package/exporter/registers/index.ts +0 -4
  293. package/exporter/services/domains.ts +0 -16
  294. package/exporter/services/register.ts +0 -113
  295. package/exporter/services/settings.ts +0 -17
  296. package/exporter/utils/alerts.ts +0 -29
  297. package/exporter/utils/create-build-data.ts +0 -17
  298. package/exporter/utils/health-checks.ts +0 -64
  299. package/exporter/utils/searches.ts +0 -156
  300. package/src/README.md +0 -7
  301. package/start-render.js +0 -7
  302. /package/{exporter/react → react}/Favicon/utils.ts +0 -0
@@ -1,6 +1,14 @@
1
1
  import type { GatsbyNode } from "gatsby";
2
+ import type { GriddoPageObject } from "../exporter/types/pages";
2
3
 
3
- import { componentLibraryPathAlias, isComponentLibrary } from "@griddo/cx";
4
+ import fsp from "node:fs/promises";
5
+ import path from "node:path";
6
+
7
+ import { ReadFromStoreError } from "../exporter/constants/errors";
8
+ import { walkStore } from "../exporter/utils/core-utils";
9
+ import { throwError } from "../exporter/utils/errors";
10
+ import { componentLibraryPathAlias, isComponentLibrary } from "../exporter/utils/instance";
11
+ import { getRenderPathsFromDB } from "../exporter/utils/render";
4
12
 
5
13
  const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = ({
6
14
  actions,
@@ -40,7 +48,70 @@ const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = ({
40
48
  // No sourcemaps on builds
41
49
  if (stage === "build-javascript") {
42
50
  actions.setWebpackConfig({ devtool: false });
51
+
52
+ // TODO: Hablar con infra para no invalidar cache de los assets
53
+ // const newWebpackConfig = {
54
+ // ...getConfig(),
55
+ // output: {
56
+ // filename: `[name].js`, // no contenthash
57
+ // chunkFilename: `[name].js`, // no contenthash
58
+ // path: getConfig().output.path,
59
+ // publicPath: getConfig().output.publicPath,
60
+ // },
61
+ // };
62
+
63
+ // actions.replaceWebpackConfig(newWebpackConfig);
43
64
  }
44
65
  };
45
66
 
46
- export { onCreateWebpackConfig };
67
+ /**
68
+ * Return a scale size colors with a number and a measure string (KB by default).
69
+ *
70
+ * @param size The page size in KB.
71
+ * @param measure The measure string to be added in the log.
72
+ */
73
+ function pageSizeLog(size: number, measure = "KB") {
74
+ return `${size}${measure}`;
75
+ }
76
+
77
+ /**
78
+ * Read all pages stored in the `store` Griddo directory and returns one by one
79
+ * with a generator.
80
+ *
81
+ * @param basePath - Base directory to get pages from.
82
+ * @param options.withSizeProp - Add size prop to the page object.
83
+ * @todo throw error if the basePath is not an store folder
84
+ */
85
+ async function* getBuildPagesFromStore<PageType extends GriddoPageObject>(args?: {
86
+ basePath?: string;
87
+ withSizeProp?: boolean;
88
+ dbFilePath?: string;
89
+ }): AsyncGenerator<PageType> {
90
+ const { basePath, withSizeProp, dbFilePath } = args || {};
91
+ const { __root } = await getRenderPathsFromDB({
92
+ dbFilePath,
93
+ });
94
+ const pagesDirPath = basePath || path.join(__root, "store");
95
+
96
+ // Procesamos archivos JSON uno por uno sin cargar todos los paths en memoria
97
+ for await (const filePath of walkStore(pagesDirPath)) {
98
+ try {
99
+ const fileContent = await fsp.readFile(filePath, "utf-8");
100
+ const page = JSON.parse(fileContent) as PageType;
101
+
102
+ if (withSizeProp) {
103
+ const fileStats = await fsp.stat(filePath);
104
+ page.size = fileStats.size / 1024;
105
+ }
106
+
107
+ // SECURITY: Only returns valid page objects
108
+ if (page.path) {
109
+ yield page;
110
+ }
111
+ } catch (error) {
112
+ throwError(ReadFromStoreError, error);
113
+ }
114
+ }
115
+ }
116
+
117
+ 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
- Site,
10
- SocialsResponse,
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 };
@@ -0,0 +1,36 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Opciones del Proyecto */
4
+ "target": "es2022", // Genera JavaScript compatible con versiones modernas de Node.js
5
+ "module": "commonjs", // El formato de módulo que usará Node.js para ejecutar los scripts
6
+ "outDir": "./build", // Directorio de salida para los archivos .js compilados
7
+ "rootDir": "./exporter", // Directorio raíz de los fuentes, para mantener la estructura en 'outDir'
8
+
9
+ /* Módulos */
10
+ "moduleResolution": "node", // Cómo se resuelven los módulos (estándar para Node)
11
+ "esModuleInterop": true, // Permite una mejor interoperabilidad entre CommonJS y ES Modules
12
+
13
+ // AÑADIDO: Permitir la importación de archivos .json como módulos.
14
+ // Esto soluciona el error con `import ... from "../../package.json"`.
15
+ "resolveJsonModule": true,
16
+
17
+ /* Opciones de Emisión */
18
+ "sourceMap": true, // Genera sourcemaps para facilitar el debugging
19
+
20
+ /* Chequeo de Tipos Estricto */
21
+ "strict": true, // Habilita todas las opciones de chequeo de tipos estrictas
22
+ "skipLibCheck": true, // Evita el chequeo de tipos en los archivos de declaración (.d.ts) de las dependencias
23
+
24
+ /* Opciones Adicionales */
25
+ "forceConsistentCasingInFileNames": true, // Asegura que las mayúsculas y minúsculas en los nombres de archivo sean consistentes
26
+ "types": ["node"]
27
+ },
28
+ "include": [
29
+ "exporter/**/*.ts", // Incluye todos los archivos .ts dentro de la carpeta exporter
30
+ "exporter/**/*.tsx"
31
+ ],
32
+ "exclude": [
33
+ "node_modules", // Excluye las dependencias
34
+ "**/*.test.ts" // Excluye los archivos de test
35
+ ]
36
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022",
4
+ "lib": ["dom", "esnext"],
5
+ "jsx": "react-jsx",
6
+ "module": "esnext",
7
+ "moduleResolution": "node",
8
+ "esModuleInterop": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "resolveJsonModule": true,
13
+ "outDir": "./build",
14
+ "sourceMap": true,
15
+ "inlineSourceMap": false,
16
+ "types": ["node"]
17
+ },
18
+ "include": ["./exporter/**/*.ts", "./exporter/**/*.tsx", "global.d.ts"]
19
+ }
package/tsconfig.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "esnext",
3
+ "target": "es2022",
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": [],
14
+ "sourceMap": true
13
15
  },
14
16
  "include": [
15
17
  "./exporter/**/*.ts",
@@ -1,4 +0,0 @@
1
- /**
2
- * Render every instance domain with the Gatsby adapter.
3
- */
4
- export declare function renderDomainsWithGatsbyAdapter(domain: string): Promise<void>;
@@ -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,6 +0,0 @@
1
- import type { Artifacts } from "../types/global";
2
- /**
3
- * Returns the artifacts of CX.
4
- */
5
- declare function getCxArtifacts(domain: string): Artifacts;
6
- export default getCxArtifacts;
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,19 +0,0 @@
1
- declare const AI_EMBEDDINGS: string;
2
- declare const ALERT: string;
3
- declare const DOMAINS: string;
4
- declare const GET_ALL: string;
5
- declare const GET_PAGE: string;
6
- declare const LOGIN: string;
7
- declare const RESET_RENDER: string;
8
- declare const ROBOTS: string;
9
- declare const SEARCH: string;
10
- declare const SETTINGS: string;
11
- declare const BUILD_END: string[];
12
- declare const BUILD_START: string[];
13
- declare const GET_PAGES: string[];
14
- declare const GET_REFERENCE_FIELD_DATA: string[];
15
- declare const GET_SITEMAP: string[];
16
- declare const INFO: string[];
17
- declare const LANGUAGES: string[];
18
- declare const SOCIALS: string[];
19
- export { AI_EMBEDDINGS, ALERT, BUILD_END, BUILD_START, DOMAINS, GET_ALL, GET_PAGE, GET_PAGES, GET_REFERENCE_FIELD_DATA, GET_SITEMAP, INFO, LANGUAGES, LOGIN, RESET_RENDER, ROBOTS, SEARCH, SETTINGS, SOCIALS, };
@@ -1,37 +0,0 @@
1
- /**
2
- * Here are all the environment variables that the CX code uses.
3
- */
4
- declare const GRIDDO_API_URL: string | undefined;
5
- declare const GRIDDO_PUBLIC_API_URL: string | undefined;
6
- declare const GRIDDO_BOT_USER: string | undefined;
7
- declare const GRIDDO_BOT_PASSWORD: string | undefined;
8
- declare const GRIDDO_API_CONCURRENCY_COUNT: number;
9
- declare const GRIDDO_RENDER_ALL_SITES: boolean;
10
- declare const GRIDDO_RENDER_SITE: number;
11
- declare const GRIDDO_RENDER_PAGES: number[];
12
- declare const GRIDDO_SKIP_BUILD_CHECKS: boolean;
13
- declare const GRIDDO_DEBUG_LOGS: boolean;
14
- declare const GRIDDO_BUILD_LOGS: boolean;
15
- declare const GRIDDO_RENDER_BREAKPOINTS_FEATURE: boolean;
16
- declare const GRIDDO_SSG_VERBOSE_LOGS: boolean;
17
- declare const GRIDDO_SEARCH_FEATURE: boolean;
18
- declare const GRIDDO_ASSET_PREFIX: string | undefined;
19
- declare const GRIDDO_REACT_APP_INSTANCE: string | undefined;
20
- declare const GRIDDO_AI_EMBEDDINGS: boolean;
21
- declare const GRIDDO_VERBOSE_LOGS: boolean;
22
- declare const GRIDDO_ALERT_FEATURE: boolean;
23
- declare const GRIDDO_API_MAX_RESPONSE_SIZE: number;
24
- declare const GRIDDO_SSG_MAX_PAGE_SIZE: number;
25
- declare const GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS: number;
26
- declare const GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS: number;
27
- declare const GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS: number;
28
- declare const GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS: number;
29
- declare const GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS: number;
30
- declare const GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS: number;
31
- declare const GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS: number;
32
- declare const GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS: number;
33
- declare const GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS: number;
34
- declare const GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS: number;
35
- declare const GRIDDO_FIXTURES_DOMAIN_NAMES: string | undefined;
36
- declare const GRIDDO_FIXTURES_SITE_NAMES: string | undefined;
37
- export { GRIDDO_AI_EMBEDDINGS, GRIDDO_ALERT_FEATURE, GRIDDO_API_CONCURRENCY_COUNT, GRIDDO_API_MAX_RESPONSE_SIZE, GRIDDO_API_URL, GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_ASSET_PREFIX, GRIDDO_BOT_PASSWORD, GRIDDO_BOT_USER, GRIDDO_BUILD_LOGS, GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_DEBUG_LOGS, GRIDDO_FIXTURES_DOMAIN_NAMES, GRIDDO_FIXTURES_SITE_NAMES, GRIDDO_INIT_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_PUBLIC_API_URL, GRIDDO_REACT_APP_INSTANCE, GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_RENDER_ALL_SITES, GRIDDO_RENDER_BREAKPOINTS_FEATURE, GRIDDO_RENDER_PAGES, GRIDDO_RENDER_SITE, GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_SEARCH_FEATURE, GRIDDO_SKIP_BUILD_CHECKS, GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS, GRIDDO_SSG_MAX_PAGE_SIZE, GRIDDO_SSG_VERBOSE_LOGS, GRIDDO_VERBOSE_LOGS, };
@@ -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 };