@griddo/cx 11.7.4 → 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.
Files changed (300) hide show
  1. package/README.md +25 -228
  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 +12 -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 +9 -0
  11. package/build/adapters/gatsby/actions/init.js.map +1 -0
  12. package/build/adapters/gatsby/actions/meta.js +14 -0
  13. package/build/adapters/gatsby/actions/meta.js.map +1 -0
  14. package/build/adapters/gatsby/actions/prepare.js +9 -0
  15. package/build/adapters/gatsby/actions/prepare.js.map +1 -0
  16. package/build/adapters/gatsby/actions/relocation.js +15 -0
  17. package/build/adapters/gatsby/actions/relocation.js.map +1 -0
  18. package/build/adapters/gatsby/actions/restore.js +26 -0
  19. package/build/adapters/gatsby/actions/restore.js.map +1 -0
  20. package/build/adapters/gatsby/actions/ssg.js +9 -0
  21. package/build/adapters/gatsby/actions/ssg.js.map +1 -0
  22. package/build/adapters/gatsby/actions/sync.js +50 -0
  23. package/build/adapters/gatsby/actions/sync.js.map +1 -0
  24. package/build/adapters/gatsby/index.js +74 -0
  25. package/build/adapters/gatsby/index.js.map +1 -0
  26. package/build/adapters/gatsby/shared/context.js +25 -0
  27. package/build/adapters/gatsby/shared/context.js.map +1 -0
  28. package/build/adapters/gatsby/shared/extract-assets.js +58 -0
  29. package/build/adapters/gatsby/shared/extract-assets.js.map +1 -0
  30. package/build/adapters/gatsby/shared/gatsby-build.js +49 -0
  31. package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
  32. package/build/adapters/gatsby/shared/sync-render.js +208 -0
  33. package/build/adapters/gatsby/shared/sync-render.js.map +1 -0
  34. package/build/adapters/gatsby/shared/types.js +3 -0
  35. package/build/adapters/gatsby/shared/types.js.map +1 -0
  36. package/build/commands/end-render.js +63 -0
  37. package/build/commands/end-render.js.map +1 -0
  38. package/build/commands/prepare-assets-directory.js +32 -0
  39. package/build/commands/prepare-assets-directory.js.map +1 -0
  40. package/build/commands/prepare-domains-render.js +138 -0
  41. package/build/commands/prepare-domains-render.js.map +1 -0
  42. package/build/commands/reset-render.js +22 -0
  43. package/build/commands/reset-render.js.map +1 -0
  44. package/build/commands/start-render.js +35 -0
  45. package/build/commands/start-render.js.map +1 -0
  46. package/build/commands/upload-search-content.js +189 -0
  47. package/build/commands/upload-search-content.js.map +1 -0
  48. package/build/constants/endpoints.js +42 -0
  49. package/build/constants/endpoints.js.map +1 -0
  50. package/build/constants/envs.js +73 -0
  51. package/build/constants/envs.js.map +1 -0
  52. package/build/constants/errors.js +89 -0
  53. package/build/constants/errors.js.map +1 -0
  54. package/build/exporter/adapters/gatsby/actions/clean.d.ts +3 -0
  55. package/build/exporter/adapters/gatsby/actions/close.d.ts +3 -0
  56. package/build/exporter/adapters/gatsby/actions/data.d.ts +2 -0
  57. package/build/exporter/adapters/gatsby/actions/healthCheck.d.ts +2 -0
  58. package/build/exporter/adapters/gatsby/actions/init.d.ts +2 -0
  59. package/build/exporter/adapters/gatsby/actions/meta.d.ts +2 -0
  60. package/build/exporter/adapters/gatsby/actions/prepare.d.ts +2 -0
  61. package/build/exporter/adapters/gatsby/actions/relocation.d.ts +2 -0
  62. package/build/exporter/adapters/gatsby/actions/restore.d.ts +3 -0
  63. package/build/exporter/adapters/gatsby/actions/ssg.d.ts +3 -0
  64. package/build/exporter/adapters/gatsby/actions/sync.d.ts +3 -0
  65. package/build/exporter/adapters/gatsby/index.d.ts +9 -0
  66. package/build/exporter/adapters/gatsby/shared/context.d.ts +38 -0
  67. package/build/exporter/adapters/gatsby/shared/extract-assets.d.ts +7 -0
  68. package/build/exporter/adapters/gatsby/shared/gatsby-build.d.ts +7 -0
  69. package/build/exporter/adapters/gatsby/shared/sync-render.d.ts +36 -0
  70. package/build/exporter/adapters/gatsby/shared/types.d.ts +34 -0
  71. package/build/exporter/commands/start-render.d.ts +2 -0
  72. package/build/exporter/commands/upload-search-content.d.ts +2 -0
  73. package/build/{constants → exporter/constants}/envs.d.ts +1 -7
  74. package/build/{errors/errors-data.d.ts → exporter/constants/errors.d.ts} +5 -3
  75. package/build/{services → exporter/services}/auth.d.ts +1 -1
  76. package/build/exporter/services/db.d.ts +4 -0
  77. package/build/{services → exporter/services}/robots.d.ts +0 -6
  78. package/build/{services → exporter/services}/sites.d.ts +5 -2
  79. package/build/exporter/services/store.d.ts +15 -0
  80. package/build/{types → exporter/types}/api.d.ts +3 -4
  81. package/build/{types → exporter/types}/global.d.ts +6 -6
  82. package/build/{types → exporter/types}/navigation.d.ts +1 -1
  83. package/build/exporter/types/render.d.ts +50 -0
  84. package/build/{types → exporter/types}/sites.d.ts +1 -2
  85. package/build/exporter/utils/artifacts.d.ts +6 -0
  86. package/build/exporter/utils/brush.d.ts +18 -0
  87. package/build/{utils → exporter/utils}/cache.d.ts +7 -12
  88. package/build/{utils/health-checks.d.ts → exporter/utils/check-health.d.ts} +2 -2
  89. package/build/exporter/utils/core-utils.d.ts +77 -0
  90. package/build/{utils → exporter/utils}/domains.d.ts +1 -1
  91. package/build/{errors/index.d.ts → exporter/utils/errors.d.ts} +3 -3
  92. package/build/exporter/utils/folders.d.ts +66 -0
  93. package/build/{utils → exporter/utils}/loggin.d.ts +2 -16
  94. package/build/{utils → exporter/utils}/pages.d.ts +2 -2
  95. package/build/exporter/utils/render.d.ts +49 -0
  96. package/build/{utils → exporter/utils}/sites.d.ts +3 -3
  97. package/build/{utils → exporter/utils}/store.d.ts +10 -38
  98. package/build/services/auth.js +39 -0
  99. package/build/services/auth.js.map +1 -0
  100. package/build/services/db.js +34 -0
  101. package/build/services/db.js.map +1 -0
  102. package/build/services/navigation.js +93 -0
  103. package/build/services/navigation.js.map +1 -0
  104. package/build/services/reference-fields.js +131 -0
  105. package/build/services/reference-fields.js.map +1 -0
  106. package/build/services/robots.js +58 -0
  107. package/build/services/robots.js.map +1 -0
  108. package/build/services/sites.js +109 -0
  109. package/build/services/sites.js.map +1 -0
  110. package/build/services/store.js +282 -0
  111. package/build/services/store.js.map +1 -0
  112. package/build/types/api.js +3 -0
  113. package/build/types/api.js.map +1 -0
  114. package/build/types/global.js +3 -0
  115. package/build/types/global.js.map +1 -0
  116. package/build/types/navigation.js +3 -0
  117. package/build/types/navigation.js.map +1 -0
  118. package/build/types/pages.js +3 -0
  119. package/build/types/pages.js.map +1 -0
  120. package/build/types/render.js +10 -0
  121. package/build/types/render.js.map +1 -0
  122. package/build/types/sites.js +3 -0
  123. package/build/types/sites.js.map +1 -0
  124. package/build/types/templates.js +3 -0
  125. package/build/types/templates.js.map +1 -0
  126. package/build/utils/api.js +161 -0
  127. package/build/utils/api.js.map +1 -0
  128. package/build/utils/artifacts.js +34 -0
  129. package/build/utils/artifacts.js.map +1 -0
  130. package/build/utils/brush.js +30 -0
  131. package/build/utils/brush.js.map +1 -0
  132. package/build/utils/cache.js +106 -0
  133. package/build/utils/cache.js.map +1 -0
  134. package/build/utils/check-health.js +68 -0
  135. package/build/utils/check-health.js.map +1 -0
  136. package/build/utils/core-utils.js +251 -0
  137. package/build/utils/core-utils.js.map +1 -0
  138. package/build/utils/domains.js +37 -0
  139. package/build/utils/domains.js.map +1 -0
  140. package/build/utils/errors.js +30 -0
  141. package/build/utils/errors.js.map +1 -0
  142. package/build/utils/folders.js +339 -0
  143. package/build/utils/folders.js.map +1 -0
  144. package/build/utils/images.js +45 -0
  145. package/build/utils/images.js.map +1 -0
  146. package/build/utils/instance.js +66 -0
  147. package/build/utils/instance.js.map +1 -0
  148. package/build/utils/loggin.js +102 -0
  149. package/build/utils/loggin.js.map +1 -0
  150. package/build/utils/pages.js +359 -0
  151. package/build/utils/pages.js.map +1 -0
  152. package/build/utils/render.js +144 -0
  153. package/build/utils/render.js.map +1 -0
  154. package/build/utils/sites.js +239 -0
  155. package/build/utils/sites.js.map +1 -0
  156. package/build/utils/store.js +193 -0
  157. package/build/utils/store.js.map +1 -0
  158. package/exporter/adapters/gatsby/actions/clean.ts +14 -0
  159. package/exporter/adapters/gatsby/actions/close.ts +17 -0
  160. package/exporter/adapters/gatsby/actions/data.ts +25 -0
  161. package/exporter/adapters/gatsby/actions/healthCheck.ts +10 -0
  162. package/exporter/adapters/gatsby/actions/init.ts +12 -0
  163. package/exporter/adapters/gatsby/actions/meta.ts +18 -0
  164. package/exporter/adapters/gatsby/actions/prepare.ts +9 -0
  165. package/exporter/adapters/gatsby/actions/relocation.ts +15 -0
  166. package/exporter/adapters/gatsby/actions/restore.ts +36 -0
  167. package/exporter/adapters/gatsby/actions/ssg.ts +12 -0
  168. package/exporter/adapters/gatsby/actions/sync.ts +70 -0
  169. package/exporter/adapters/gatsby/index.ts +60 -146
  170. package/exporter/adapters/gatsby/shared/context.ts +50 -0
  171. package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
  172. package/exporter/adapters/gatsby/shared/gatsby-build.ts +54 -0
  173. package/exporter/adapters/gatsby/shared/sync-render.ts +294 -0
  174. package/exporter/adapters/gatsby/shared/types.ts +35 -0
  175. package/exporter/build-esbuild.noop +42 -0
  176. package/exporter/build.sh +5 -38
  177. package/exporter/commands/end-render.ts +56 -81
  178. package/exporter/commands/prepare-assets-directory.ts +33 -0
  179. package/exporter/commands/prepare-domains-render.ts +149 -31
  180. package/exporter/commands/reset-render.ts +12 -3
  181. package/exporter/commands/start-render.ts +18 -47
  182. package/exporter/commands/upload-search-content.ts +206 -21
  183. package/exporter/constants/envs.ts +59 -51
  184. package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -15
  185. package/exporter/services/auth.ts +7 -6
  186. package/exporter/services/db.ts +32 -0
  187. package/exporter/services/navigation.ts +4 -10
  188. package/exporter/services/reference-fields.ts +8 -23
  189. package/exporter/services/robots.ts +8 -15
  190. package/exporter/services/sites.ts +35 -24
  191. package/exporter/services/store.ts +118 -76
  192. package/exporter/types/api.ts +24 -27
  193. package/exporter/types/global.ts +8 -10
  194. package/exporter/types/navigation.ts +1 -1
  195. package/exporter/types/pages.ts +2 -3
  196. package/exporter/types/render.ts +59 -0
  197. package/exporter/types/sites.ts +1 -2
  198. package/exporter/utils/api.ts +46 -82
  199. package/exporter/{artifacts/index.ts → utils/artifacts.ts} +9 -8
  200. package/exporter/utils/brush.ts +34 -0
  201. package/exporter/utils/cache.ts +34 -59
  202. package/exporter/utils/check-health.ts +79 -0
  203. package/exporter/utils/core-utils.ts +86 -247
  204. package/exporter/utils/domains.ts +10 -7
  205. package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
  206. package/exporter/utils/folders.ts +161 -92
  207. package/exporter/utils/images.ts +1 -6
  208. package/exporter/utils/instance.ts +9 -12
  209. package/exporter/utils/loggin.ts +24 -89
  210. package/exporter/utils/pages.ts +23 -88
  211. package/exporter/utils/render.ts +147 -48
  212. package/exporter/utils/sites.ts +67 -77
  213. package/exporter/utils/store.ts +85 -178
  214. package/gatsby-browser.tsx +41 -58
  215. package/gatsby-config.ts +6 -12
  216. package/gatsby-node.ts +30 -89
  217. package/gatsby-ssr.tsx +2 -1
  218. package/package.json +32 -73
  219. package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
  220. package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
  221. package/{exporter/react → react}/Favicon/index.tsx +1 -7
  222. package/{exporter/react → react}/GriddoIntegrations/index.tsx +6 -14
  223. package/{exporter/react → react}/GriddoIntegrations/utils.ts +4 -9
  224. package/{build/react/index.d.ts → react/index.tsx} +1 -0
  225. package/src/components/Head.tsx +13 -46
  226. package/src/components/template.tsx +8 -30
  227. package/src/gatsby-node-utils.ts +91 -2
  228. package/src/html.tsx +2 -11
  229. package/src/types.ts +5 -5
  230. package/start-render.js +1 -3
  231. package/tsconfig.json +3 -2
  232. package/build/adapters/gatsby/index.d.ts +0 -4
  233. package/build/adapters/gatsby/utils.d.ts +0 -22
  234. package/build/artifacts/index.d.ts +0 -6
  235. package/build/commands/move-assets.d.ts +0 -1
  236. package/build/commands/prepare-domains-render.d.ts +0 -1
  237. package/build/constants/index.d.ts +0 -57
  238. package/build/end-render.js +0 -74
  239. package/build/end-render.js.map +0 -7
  240. package/build/index.d.ts +0 -29
  241. package/build/index.js +0 -73
  242. package/build/index.js.map +0 -7
  243. package/build/prepare-domains-render.js +0 -73
  244. package/build/prepare-domains-render.js.map +0 -7
  245. package/build/react/Favicon/index.d.ts +0 -5
  246. package/build/react/Favicon/utils.d.ts +0 -9
  247. package/build/react/GriddoIntegrations/index.d.ts +0 -20
  248. package/build/react/GriddoIntegrations/utils.d.ts +0 -26
  249. package/build/react/index.js +0 -3
  250. package/build/registers/api.d.ts +0 -9
  251. package/build/registers/gatsby.d.ts +0 -9
  252. package/build/registers/index.d.ts +0 -3
  253. package/build/reset-render.js +0 -74
  254. package/build/reset-render.js.map +0 -7
  255. package/build/services/domains.d.ts +0 -6
  256. package/build/services/register.d.ts +0 -36
  257. package/build/services/settings.d.ts +0 -4
  258. package/build/services/store.d.ts +0 -6
  259. package/build/start-render.js +0 -100
  260. package/build/start-render.js.map +0 -7
  261. package/build/upload-search-content.js +0 -74
  262. package/build/upload-search-content.js.map +0 -7
  263. package/build/utils/alerts.d.ts +0 -3
  264. package/build/utils/core-utils.d.ts +0 -107
  265. package/build/utils/create-build-data.d.ts +0 -8
  266. package/build/utils/folders.d.ts +0 -53
  267. package/build/utils/render.d.ts +0 -13
  268. package/build/utils/searches.d.ts +0 -15
  269. package/cx.config.d.ts +0 -5
  270. package/cx.config.js +0 -36
  271. package/exporter/adapters/gatsby/utils.ts +0 -161
  272. package/exporter/artifacts/README.md +0 -34
  273. package/exporter/commands/move-assets.ts +0 -11
  274. package/exporter/constants/index.ts +0 -129
  275. package/exporter/index.ts +0 -82
  276. package/exporter/react/index.tsx +0 -11
  277. package/exporter/registers/api.ts +0 -14
  278. package/exporter/registers/gatsby.ts +0 -14
  279. package/exporter/registers/index.ts +0 -4
  280. package/exporter/services/domains.ts +0 -16
  281. package/exporter/services/register.ts +0 -113
  282. package/exporter/services/settings.ts +0 -17
  283. package/exporter/utils/alerts.ts +0 -29
  284. package/exporter/utils/create-build-data.ts +0 -17
  285. package/exporter/utils/health-checks.ts +0 -64
  286. package/exporter/utils/searches.ts +0 -179
  287. package/src/README.md +0 -7
  288. package/build/{commands → exporter/commands}/end-render.d.ts +0 -0
  289. package/build/{commands/reset-render.d.ts → exporter/commands/prepare-assets-directory.d.ts} +0 -0
  290. package/build/{commands/start-render.d.ts → exporter/commands/prepare-domains-render.d.ts} +0 -0
  291. package/build/{commands/upload-search-content.d.ts → exporter/commands/reset-render.d.ts} +0 -0
  292. package/build/{constants → exporter/constants}/endpoints.d.ts +0 -0
  293. package/build/{services → exporter/services}/navigation.d.ts +0 -0
  294. package/build/{services → exporter/services}/reference-fields.d.ts +0 -0
  295. package/build/{types → exporter/types}/pages.d.ts +1 -1
  296. /package/build/{types → exporter/types}/templates.d.ts +0 -0
  297. /package/build/{utils → exporter/utils}/api.d.ts +0 -0
  298. /package/build/{utils → exporter/utils}/images.d.ts +0 -0
  299. /package/build/{utils → exporter/utils}/instance.d.ts +0 -0
  300. /package/{exporter/react → react}/Favicon/utils.ts +0 -0
@@ -1,3 +0,0 @@
1
- import type { GriddoAlertRegisterProps } from "@griddo/core";
2
- declare function insertAlert({ area, description, fullData, instantNotification, level, }: Omit<GriddoAlertRegisterProps, "publicApiUrl">): Promise<void>;
3
- export { insertAlert };
@@ -1,107 +0,0 @@
1
- import type { APIResponses } from "../types/api";
2
- import type { CXConfig, LifeCyclesNames, LifeCycleSteps } from "../types/global";
3
- declare const instanceRootDir: string;
4
- /**
5
- * Returns the configuration file content.
6
- *
7
- * @example
8
- * const config = getConfig()
9
- * const { __cx } = config.paths()
10
- * const { griddoVersion, proDomain } = config
11
- */
12
- declare function getConfig(): CXConfig;
13
- /**
14
- * Returns true for "true", "on", true and positive numbers.
15
- * Returns false for "false", "off", false, 0, negative integers and anything else.
16
- */
17
- declare function isTruthy(value: any): boolean;
18
- /**
19
- * Walk a directory and returns the file pathts.
20
- *
21
- * @param dir A directory path.
22
- */
23
- declare function walk(dir: string): string[];
24
- /**
25
- * Walk a directory and returns the JSON file absolute paths with one level of depth.
26
- * Bypass the `metadata` folder.
27
- * /abs/.../sotre/<siteId>/jsonfile.json
28
- * /abs/.../sotre/<siteId>/jsonfile.json
29
- * /abs/.../sotre/<siteId>/jsonfile.json
30
- * /abs/.../sotre/<siteId>/jsonfile.json
31
- */
32
- declare function walkStore(dir: string): Array<string>;
33
- /**
34
- * Custom delay using the "promise hack",
35
- *
36
- * @param ms Amount of miliseconds to be delayed
37
- */
38
- declare function delay(ms: number): Promise<unknown>;
39
- /**
40
- * Converts milliseconds to seconds with a fixed number of decimals.
41
- *
42
- * @param ms The number in milliseconds.
43
- * @param fixed The amount of fixed decimals.
44
- * @returns The converted number in seconds with the fixed number of decimals.
45
- */
46
- declare function msToSec(ms: number, decimals?: number): string;
47
- /**
48
- * Return a siteID from a response object if exist
49
- * @param response A response object
50
- */
51
- declare function getSafeSiteId(response: APIResponses): number | undefined;
52
- /**
53
- * Remove props from an object
54
- *
55
- * @param obj The object
56
- * @param props An array of props to be removed
57
- */
58
- declare function removeProperties(obj: Record<string, unknown>, props: Array<string>): void;
59
- /**
60
- * Remove unused files (old) inside the `apiCache` dir
61
- *
62
- * @todo remove other file types: sites, socials, etc..
63
- */
64
- declare function sanitizeAPICacheDir(): void;
65
- /**
66
- * Measures the execution time of a series of sync or async functions.
67
- *
68
- * @async
69
- * @param functions - Functions to be executed to measure their execution time.
70
- * @returns A promise that resolves with the total execution time in seconds.
71
- */
72
- declare function measureExecutionTime(functions: Array<(...args: Array<unknown>) => unknown | Promise<unknown>>): Promise<number>;
73
- /**
74
- * Pause the process until a key is pressed.
75
- *
76
- * @param title
77
- * @returns
78
- */
79
- declare function pause(title: string): Promise<void> | undefined;
80
- /**
81
- * Executes a life cycle process, which involves executing an array of
82
- * functions, printing to the console, and handling errors with optional
83
- * retries.
84
- *
85
- * @async
86
- * @param name - The name of the life cycle.
87
- * @param options - The arguments object.
88
- * @param options.steps - An array of functions to execute.
89
- * @returns - A promise that resolves when the life cycle process is completed.
90
- */
91
- declare function doLifeCycle(name: LifeCyclesNames, steps: LifeCycleSteps): Promise<void>;
92
- /**
93
- * Creates additional files after the render: sitemaps, robots and a report of
94
- * the finished render.
95
- *
96
- * @async
97
- * @param domain
98
- */
99
- declare function createDomainMetadata(domain: string): Promise<void>;
100
- declare function removeAllSiteDirsFromStore(): void;
101
- /**
102
- * Save render information to a file to use as debug log.
103
- *
104
- * This information will **not** be sent to any API.
105
- */
106
- declare function saveBuildEndLogs(): void;
107
- export { createDomainMetadata, delay, doLifeCycle, getConfig, getSafeSiteId, instanceRootDir, isTruthy, measureExecutionTime, msToSec, pause, removeAllSiteDirsFromStore, removeProperties, sanitizeAPICacheDir, saveBuildEndLogs, walk, walkStore, };
@@ -1,8 +0,0 @@
1
- /**
2
- * Download all data: sites, pages etc.. from the instance private Griddo API.
3
- * Then you can use the generator funcion `getBuildPagesFromStore()` to get the pages and
4
- * `getBuildMetadata()` to get build and sites metadata as objects. Both from
5
- * exporter utils sites dir.
6
- */
7
- declare function createDomainRenderData(domain: string): Promise<void>;
8
- export { createDomainRenderData };
@@ -1,53 +0,0 @@
1
- import { type MakeDirectoryOptions } from "fs-extra";
2
- /**
3
- * Remove an empty directory from the basePath recursively.
4
- * If the directory has only .xml files it will handle as empty too (empty site)
5
- *
6
- * @param baseDir - The base directory.
7
- */
8
- declare function deleteDisposableSiteDirs(): void;
9
- /**
10
- * Creates multiple directories.
11
- *
12
- * @param dirs - An array of directory paths.
13
- * @param options - Same option as `fs.mkdirSync()`
14
- */
15
- declare function createArtifacts(dirs: Array<string>, options?: MakeDirectoryOptions): void;
16
- declare function renameArtifact(src: string, dst: string): void;
17
- /**
18
- * Copy multiple directories with backup option.
19
- *
20
- * @param src - Source directory.
21
- * @param dst - Destination directory.
22
- * @param dirs - Directories to copy.
23
- * @param options.withBackup - Create a previous backup before copy.
24
- */
25
- declare function copyArtifacts(src: string, dst: string, dirs: Array<string>, options?: {
26
- withBackup: boolean;
27
- }): void;
28
- /**
29
- * Move artifacts between cx-paths
30
- *
31
- * @param src - Source directory.
32
- * @param dst - Destination directory.
33
- * @param dirs - Directories to move.
34
- * @param options - Options.
35
- */
36
- declare function moveArtifacts(src: string, dst: string, dirs: Array<string>, options?: {
37
- withBackup?: boolean;
38
- override?: boolean;
39
- }): void;
40
- /**
41
- * Removes multiple artifact directories.
42
- *
43
- * @param artifacts - An array of artifact directory paths.
44
- */
45
- declare function removeArtifacts(artifacts: Array<string>): void;
46
- /**
47
- * Elimina todas las páginas del store (de todos los sites) cuyo nombre empiece con un guión "-".
48
- * Estas páginas son "virtuales" y no tienen ids desde API por lo que mantenerlas en el store es un problema cuando se hacen modificaciones en la página "madre".
49
- * La solución por ahora es borrarlas del store y rehacerlas en todos los renders.
50
- */
51
- declare function removeVirtualPagesFromStore(): Promise<void>;
52
- declare function prependFileSync(filePath: string, content: string): void;
53
- export { copyArtifacts, createArtifacts, deleteDisposableSiteDirs, moveArtifacts, prependFileSync, removeArtifacts, removeVirtualPagesFromStore, renameArtifact, };
@@ -1,13 +0,0 @@
1
- /**
2
- * Creates a sentinel file with the current date and time.
3
- * This file is used to track later if node_modules/@griddo/cx was cleaned by a
4
- * npm install from a deploy.
5
- */
6
- declare function createSentinelRenderFile(): void;
7
- declare function deleteSentinelRenderFile(): void;
8
- declare function isValidRender(): void;
9
- /**
10
- * Send the default registers through Griddo alerts.
11
- */
12
- declare function sendGriddoDefaultAlerts(): Promise<void>;
13
- export { createSentinelRenderFile, deleteSentinelRenderFile, isValidRender, sendGriddoDefaultAlerts, };
@@ -1,15 +0,0 @@
1
- import type { PostSearchInfoResponse } from "../types/api";
2
- import type { PostSearchInfoProps } from "../types/global";
3
- /**
4
- * Save in the BBDD the content of a page parsed without HTML tags.
5
- *
6
- * @param props Object with parts of the final page object to be saved in the BBDD.
7
- */
8
- declare function postSearchInfo(props: PostSearchInfoProps): Promise<PostSearchInfoResponse>;
9
- /**
10
- * Function that search in the `/public` dir the content info of the pages and
11
- * send it to the search table in the ddbb using the API.
12
- */
13
- declare function uploadRenderedSearchContentToAPI(distDomainPath: string, domain: string): Promise<void>;
14
- declare function startAIEmbeddings(): Promise<void>;
15
- export { postSearchInfo, startAIEmbeddings, uploadRenderedSearchContentToAPI };
package/cx.config.d.ts DELETED
@@ -1,5 +0,0 @@
1
- import type { CXConfig } from "./exporter/types/global";
2
-
3
- declare const config: CXConfig;
4
-
5
- export default config;
package/cx.config.js DELETED
@@ -1,36 +0,0 @@
1
- import path from "node:path";
2
-
3
- import pkgDir from "pkg-dir";
4
-
5
- import { resolveComponentsPath } from "./exporter/utils/instance";
6
-
7
- // Paths
8
- const REPO_ROOT_DIR = pkgDir.sync(path.resolve(__dirname, "../.."));
9
- const CX_ROOT_DIR = pkgDir.sync(__dirname);
10
- const SSG_DIR = path.resolve(pkgDir.sync(__dirname));
11
- const CX_CACHE_DIR = path.resolve(CX_ROOT_DIR, ".cx-cache");
12
- const COMPONENTS_DIR = resolveComponentsPath();
13
- const EXPORTS_DIR = path.join(REPO_ROOT_DIR, "exports/sites");
14
-
15
- // eslint-disable-next-line @typescript-eslint/no-var-requires
16
- const { version: griddoVersion } = require(
17
- path.join(CX_ROOT_DIR, "package.json"),
18
- );
19
-
20
- const config = {
21
- proDomain: "pro-",
22
- griddoVersion,
23
- buildReportFileName: "build-report.json",
24
- paths: (domain) => ({
25
- __cache: path.join(CX_CACHE_DIR, domain || ""),
26
- __components: COMPONENTS_DIR,
27
- __cx: CX_ROOT_DIR,
28
- __exports: path.join(EXPORTS_DIR, domain || ""),
29
- __root: REPO_ROOT_DIR,
30
- __ssg: SSG_DIR,
31
- __exports_dist: domain ? path.join(EXPORTS_DIR, domain, "dist") : "",
32
- __cx_dist: path.join(CX_ROOT_DIR, "dist"),
33
- }),
34
- };
35
-
36
- export default config;
@@ -1,161 +0,0 @@
1
- import { spawnSync } from "node:child_process";
2
- import path from "node:path";
3
-
4
- import fsx from "fs-extra";
5
-
6
- import { envs } from "../../constants";
7
- import { throwError } from "../../errors";
8
- import { ErrorInSSGBuildProcess } from "../../errors/errors-data";
9
- import { getConfig } from "../../utils/core-utils";
10
- import { verboseLog } from "../../utils/loggin";
11
-
12
- const config = getConfig();
13
-
14
- /**
15
- * Return the assetPrefix with the domain concatenated `assetPrefix/domain` only
16
- * if the domain is "pro-" **and** there is a env `GRIDDO_ASSET_PREFIX` with any
17
- * value different from `null`, `undefined` or `empty string`
18
- *
19
- * else...
20
- * - If assetPrefix or domain is falsy, returns ""
21
- * - If the domain is not "pro-", returns ""
22
- */
23
- function getGatsbyAssetPrefixWithDomain(domain: string) {
24
- const { proDomain } = getConfig();
25
-
26
- if (!envs.GRIDDO_ASSET_PREFIX || !domain) {
27
- return "";
28
- }
29
-
30
- if (!domain.startsWith(proDomain)) {
31
- return "";
32
- }
33
-
34
- const assetPrefixWithDomain = `${envs.GRIDDO_ASSET_PREFIX}/${domain}`;
35
-
36
- verboseLog(
37
- `Reading process.env.GRIDDO_ASSET_PREFIX, ${envs.GRIDDO_ASSET_PREFIX}`,
38
- );
39
- verboseLog(
40
- `Setting the asset prefix with the domain concatenated, ${assetPrefixWithDomain}`,
41
- );
42
-
43
- return assetPrefixWithDomain;
44
- }
45
-
46
- /**
47
- * Spawn a new node process `yarn gatsby-build`
48
- * @note This proccess (`yarn gatsby-build`) can not access to the custom Griddo
49
- * `process.env` so it needs variables passed to it via the `env` prop.
50
- */
51
- function runGatsbyBuildCommand(assetPrefixWithDomain: string) {
52
- verboseLog(`read assetPrefixWithDomain, ${assetPrefixWithDomain}`);
53
- verboseLog(
54
- `using this NODE_OPTIONS in gatsby command: ${process.env.NODE_OPTIONS}`,
55
- );
56
-
57
- const { __ssg } = config.paths();
58
-
59
- // Remove `--openssl-legacy-provider` from NODE_OPTIONS because this value
60
- // break Gataby render.
61
- const nodeOptionsWithoutLegacyOpenSSL = process.env.NODE_OPTIONS
62
- ? process.env.NODE_OPTIONS.replace(
63
- /--openssl-legacy-provider\s*/g,
64
- "",
65
- ).trim()
66
- : "";
67
-
68
- const command = spawnSync(
69
- "yarn",
70
- ["gatsby-build", envs.GRIDDO_SSG_VERBOSE_LOGS ? "--verbose" : ""],
71
- {
72
- cwd: __ssg,
73
- stdio: ["ignore", "inherit", "ignore"],
74
- encoding: "utf8",
75
- shell: true,
76
- env: Object.assign(process.env, {
77
- GRIDDO_EXPORTER: "true",
78
- SPAWN_ASSET_PREFIX_WITH_DOMAIN: assetPrefixWithDomain,
79
- NODE_OPTIONS: nodeOptionsWithoutLegacyOpenSSL,
80
- }),
81
- },
82
- );
83
-
84
- if (command.status !== 0) {
85
- throwError(ErrorInSSGBuildProcess(command));
86
- }
87
- }
88
-
89
- /**
90
- * Update the Griddo's `/dist` dir with the contents from `public` dir only
91
- * with files of type: js, json and css.
92
- */
93
- async function createDistFromGatsbyPublic(
94
- domain: string,
95
- needsAssetPrefix: boolean,
96
- ) {
97
- const { __cx, __ssg } = config.paths(domain);
98
-
99
- const cxDistDir = path.join(__cx, "dist");
100
- const cxAssetsDir = path.join(__cx, "assets");
101
- const cxDistDirWithDomain = path.join(__cx, "dist", domain);
102
- const publicDir = path.join(__ssg, "public");
103
-
104
- const validFilesFromPublic = fsx
105
- .readdirSync(publicDir)
106
- .filter(
107
- (file) =>
108
- path.extname(file) === ".js" ||
109
- path.extname(file) === ".json" ||
110
- path.extname(file) === ".css",
111
- );
112
-
113
- const pageDataSrc = `${publicDir}/page-data`;
114
- const pageDataDest = `${cxAssetsDir}/page-data`;
115
-
116
- const projectStaticSrc = path.join(__ssg, "static");
117
- const projectStaticDest = cxAssetsDir;
118
-
119
- const gatsbyStaticSrc = `${cxDistDir}/static`;
120
- const gatsbyStaticDest = `${cxAssetsDir}/static`;
121
-
122
- try {
123
- fsx.mkdirSync(cxAssetsDir, { recursive: true });
124
- fsx.copySync(publicDir, cxDistDir, { preserveTimestamps: true });
125
-
126
- if (needsAssetPrefix) {
127
- fsx.copySync(pageDataSrc, pageDataDest, { preserveTimestamps: true });
128
- if (fsx.existsSync(projectStaticSrc)) {
129
- fsx.copySync(projectStaticSrc, projectStaticDest, {
130
- overwrite: false,
131
- preserveTimestamps: true,
132
- });
133
- }
134
- fsx.copySync(gatsbyStaticSrc, gatsbyStaticDest, {
135
- overwrite: false,
136
- preserveTimestamps: true,
137
- });
138
- if (fsx.existsSync(projectStaticSrc)) {
139
- fsx.copySync(projectStaticSrc, cxDistDirWithDomain, {
140
- overwrite: false,
141
- preserveTimestamps: true,
142
- });
143
- }
144
-
145
- // Copia el resto de archivos...
146
- validFilesFromPublic.map((file) => {
147
- const fileSrc = `${publicDir}/${file}`;
148
- const fileDest = `${cxAssetsDir}/${file}`;
149
- fsx.copySync(fileSrc, fileDest, { preserveTimestamps: true });
150
- });
151
- }
152
- } catch (err) {
153
- console.error(err);
154
- }
155
- }
156
-
157
- export {
158
- createDistFromGatsbyPublic,
159
- getGatsbyAssetPrefixWithDomain,
160
- runGatsbyBuildCommand,
161
- };
@@ -1,34 +0,0 @@
1
- # CX Artifacs
2
-
3
- ## How to add an artifact.
4
-
5
- An artifact is a **full path** to a file or directory if it has a fixed
6
- location or only a **name** when it is going to be moved (archived/restored)
7
- between directories in the rendering process and therefore doesn't have a
8
- single location.
9
-
10
- Only the exporter knows where the artifacts are archived and restored, so the
11
- artifacts don't need to know anything other than their own location or name.
12
-
13
- Si estás creando un adaptador, sus artefactos deberán ir en un archivo separado (igual que `artifacts/cx.ts`) y exportar una función por defecto que devuelva un `Artifacts`. Todo deberá estar exportado desde `artifacts/index.ts`.
14
-
15
- **Artifacts have four categories:**
16
-
17
- - **initials**: Are directories that need to be created for their
18
- future use.
19
-
20
- - **archivables**: Are stored in `__exports` which is the one uploaded to the
21
- server as the final render and restored in `__cx` and `__ssg` to be reused in the
22
- render. Therefore, they don't have a single location and should be added only
23
- with the artifact name (directory/file)
24
-
25
- - **cacheables**: Are stored in `__cache` and restored in `__cx` and `__ssg` to be
26
- reused in each domain render. Therefore, they don't have a single location.
27
-
28
- - **disposables**: Are generated alwais in `__cx` and `__ssg` or fixed locations.
29
- These artifacts are discarded (deleted) in each domain render. They are
30
- temporary directories and/or files.
31
-
32
- ## Example
33
-
34
- Check `cx.ts` inside `./artifacts` directory to see how to add an artifact.
@@ -1,11 +0,0 @@
1
- import { execSync } from "node:child_process";
2
- import path from "node:path";
3
-
4
- const domainName = "pro-griddo";
5
- const domainPath = path.resolve(
6
- __dirname,
7
- `../../../exports/sites/${domainName}`,
8
- );
9
-
10
- execSync(`mkdir -p ${domainPath}/assets/${domainName}`);
11
- execSync(`cp -R ${domainPath}/assets/* ${domainPath}/assets/${domainName}`);
@@ -1,129 +0,0 @@
1
- import type { LifeCyclesNames } from "../types/global";
2
-
3
- import {
4
- AI_EMBEDDINGS,
5
- ALERT,
6
- BUILD_END,
7
- BUILD_START,
8
- DOMAINS,
9
- GET_ALL,
10
- GET_PAGE,
11
- GET_PAGES,
12
- GET_REFERENCE_FIELD_DATA,
13
- GET_SITEMAP,
14
- INFO,
15
- LANGUAGES,
16
- LOGIN,
17
- RESET_RENDER,
18
- ROBOTS,
19
- SEARCH,
20
- SETTINGS,
21
- SOCIALS,
22
- } from "./endpoints";
23
- import {
24
- GRIDDO_AI_EMBEDDINGS,
25
- GRIDDO_ALERT_FEATURE,
26
- GRIDDO_API_CONCURRENCY_COUNT,
27
- GRIDDO_API_MAX_RESPONSE_SIZE,
28
- GRIDDO_API_URL,
29
- GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
30
- GRIDDO_ASSET_PREFIX,
31
- GRIDDO_BOT_PASSWORD,
32
- GRIDDO_BOT_USER,
33
- GRIDDO_BUILD_LOGS,
34
- GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS,
35
- GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
36
- GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
37
- GRIDDO_DEBUG_LOGS,
38
- GRIDDO_FIXTURES_DOMAIN_NAMES,
39
- GRIDDO_FIXTURES_SITE_NAMES,
40
- GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
41
- GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
42
- GRIDDO_PUBLIC_API_URL,
43
- GRIDDO_REACT_APP_INSTANCE,
44
- GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS,
45
- GRIDDO_RENDER_ALL_SITES,
46
- GRIDDO_RENDER_BREAKPOINTS_FEATURE,
47
- GRIDDO_RENDER_PAGES,
48
- GRIDDO_RENDER_SITE,
49
- GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS,
50
- GRIDDO_SEARCH_FEATURE,
51
- GRIDDO_SKIP_BUILD_CHECKS,
52
- GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
53
- GRIDDO_SSG_MAX_PAGE_SIZE,
54
- GRIDDO_SSG_VERBOSE_LOGS,
55
- GRIDDO_VERBOSE_LOGS,
56
- } from "./envs";
57
-
58
- const endpoints = {
59
- ALERT,
60
- AI_EMBEDDINGS,
61
- BUILD_END,
62
- BUILD_START,
63
- DOMAINS,
64
- GET_ALL,
65
- GET_PAGE,
66
- GET_PAGES,
67
- GET_REFERENCE_FIELD_DATA,
68
- GET_SITEMAP,
69
- INFO,
70
- LANGUAGES,
71
- LOGIN,
72
- RESET_RENDER,
73
- ROBOTS,
74
- SEARCH,
75
- SETTINGS,
76
- SOCIALS,
77
- };
78
-
79
- const envs = {
80
- GRIDDO_AI_EMBEDDINGS,
81
- GRIDDO_ALERT_FEATURE,
82
- GRIDDO_API_CONCURRENCY_COUNT,
83
- GRIDDO_API_MAX_RESPONSE_SIZE,
84
- GRIDDO_API_URL,
85
- GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS,
86
- GRIDDO_ASSET_PREFIX,
87
- GRIDDO_BOT_PASSWORD,
88
- GRIDDO_BOT_USER,
89
- GRIDDO_BUILD_LOGS,
90
- GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS,
91
- GRIDDO_CLOSE_LIFECYCLE_MAX_ATTEMPTS,
92
- GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS,
93
- GRIDDO_DEBUG_LOGS,
94
- GRIDDO_FIXTURES_DOMAIN_NAMES,
95
- GRIDDO_FIXTURES_SITE_NAMES,
96
- GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS,
97
- GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS,
98
- GRIDDO_PUBLIC_API_URL,
99
- GRIDDO_REACT_APP_INSTANCE,
100
- GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS,
101
- GRIDDO_RENDER_ALL_SITES,
102
- GRIDDO_RENDER_BREAKPOINTS_FEATURE,
103
- GRIDDO_RENDER_PAGES,
104
- GRIDDO_RENDER_SITE,
105
- GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS,
106
- GRIDDO_SEARCH_FEATURE,
107
- GRIDDO_SKIP_BUILD_CHECKS,
108
- GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS,
109
- GRIDDO_SSG_MAX_PAGE_SIZE,
110
- GRIDDO_SSG_VERBOSE_LOGS,
111
- GRIDDO_VERBOSE_LOGS,
112
- };
113
-
114
- const lifeCycleNames: Record<LifeCyclesNames, LifeCyclesNames> = {
115
- __DEBUG__: "__DEBUG__",
116
- Archive: "Archive",
117
- Clean: "Clean",
118
- Close: "Close",
119
- Data: "Data",
120
- HealthCheck: "HealthCheck",
121
- Init: "Init",
122
- Meta: "Meta",
123
- Prepare: "Prepare",
124
- Relocation: "Relocation",
125
- Restore: "Restore",
126
- SSG: "SSG",
127
- } as const;
128
-
129
- export { endpoints, envs, lifeCycleNames };
package/exporter/index.ts DELETED
@@ -1,82 +0,0 @@
1
- /**
2
- *
3
- * Griddo CX library main export file.
4
- *
5
- * This file exports functions to use in both: adapters and SSG's frameworks.
6
- * Turning CX basically in a javascript library.
7
- *
8
- * # React
9
- * There is another export in the `/react` directory to use exclusivelly in
10
- * the browser context where nodejs (path, fs, etc..) is not available.
11
- *
12
- * # Separate scripts.
13
- * There are some separate .ts files as end-render.ts or reset-render.ts
14
- * that are intended to be used by infra via npm script like `npm run
15
- * end-render`
16
- *
17
- */
18
-
19
- import type { SocialsResponse } from "./types/api";
20
- import type {
21
- AdditionalInfo,
22
- Dimensions,
23
- GriddoListPage,
24
- GriddoMultiPage,
25
- GriddoPageObject,
26
- GriddoSinglePage,
27
- } from "./types/pages";
28
- import type { Site } from "./types/sites";
29
-
30
- import { endpoints, envs } from "./constants";
31
- import { apiRegister } from "./registers/index";
32
- import { FileRegister, MemoryRegister, Register } from "./services/register";
33
- import { insertAlert } from "./utils/alerts";
34
- import { getConfig, walk } from "./utils/core-utils";
35
- import {
36
- componentLibraryPathAlias,
37
- isComponentLibrary,
38
- resolveComponentsPath,
39
- } from "./utils/instance";
40
- import {
41
- buildLog,
42
- debugLog,
43
- infoLog,
44
- pageSizeLog,
45
- verboseLog,
46
- } from "./utils/loggin";
47
- import {
48
- getBuildPagesFromCachedStore,
49
- getBuildPagesFromStore,
50
- getBuildPagesPath,
51
- } from "./utils/store";
52
-
53
- export {
54
- apiRegister,
55
- buildLog,
56
- componentLibraryPathAlias,
57
- debugLog,
58
- endpoints,
59
- envs,
60
- FileRegister,
61
- getBuildPagesFromCachedStore,
62
- getBuildPagesFromStore,
63
- getBuildPagesPath,
64
- getConfig,
65
- infoLog,
66
- insertAlert,
67
- isComponentLibrary,
68
- MemoryRegister,
69
- pageSizeLog,
70
- Register,
71
- resolveComponentsPath,
72
- verboseLog,
73
- walk,
74
- type AdditionalInfo,
75
- type Dimensions,
76
- type GriddoListPage,
77
- type GriddoMultiPage,
78
- type GriddoPageObject,
79
- type GriddoSinglePage,
80
- type Site,
81
- type SocialsResponse,
82
- };
@@ -1,11 +0,0 @@
1
- //
2
- // Griddo CX library react export file.
3
- // This file exports functions to use in the SSG's frameworks.
4
- //
5
- // import { ... } from "@griddo/cx/react";
6
- //
7
-
8
- import { Favicon } from "./Favicon";
9
- import { GriddoIntegrations } from "./GriddoIntegrations";
10
-
11
- export { Favicon, GriddoIntegrations };