@griddo/cx 11.7.6-rc.1 → 11.7.6-rc.2

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 (176) hide show
  1. package/README.md +13 -9
  2. package/build/adapters/gatsby/actions/clean.js.map +1 -1
  3. package/build/adapters/gatsby/actions/close.js.map +1 -1
  4. package/build/adapters/gatsby/actions/data.js +3 -3
  5. package/build/adapters/gatsby/actions/data.js.map +1 -1
  6. package/build/adapters/gatsby/actions/healthCheck.js.map +1 -1
  7. package/build/adapters/gatsby/actions/init.js +2 -2
  8. package/build/adapters/gatsby/actions/init.js.map +1 -1
  9. package/build/adapters/gatsby/actions/meta.js +2 -2
  10. package/build/adapters/gatsby/actions/meta.js.map +1 -1
  11. package/build/adapters/gatsby/actions/prepare.js.map +1 -1
  12. package/build/adapters/gatsby/actions/relocation.js +2 -2
  13. package/build/adapters/gatsby/actions/relocation.js.map +1 -1
  14. package/build/adapters/gatsby/actions/restore.js +4 -4
  15. package/build/adapters/gatsby/actions/restore.js.map +1 -1
  16. package/build/adapters/gatsby/actions/ssg.js.map +1 -1
  17. package/build/adapters/gatsby/actions/sync.js +10 -9
  18. package/build/adapters/gatsby/actions/sync.js.map +1 -1
  19. package/build/adapters/gatsby/index.js +10 -6
  20. package/build/adapters/gatsby/index.js.map +1 -1
  21. package/build/adapters/gatsby/shared/context.js +8 -2
  22. package/build/adapters/gatsby/shared/context.js.map +1 -1
  23. package/build/adapters/gatsby/shared/diff-assets.js +101 -0
  24. package/build/adapters/gatsby/shared/diff-assets.js.map +1 -0
  25. package/build/adapters/gatsby/shared/extract-assets.js +11 -11
  26. package/build/adapters/gatsby/shared/extract-assets.js.map +1 -1
  27. package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -1
  28. package/build/adapters/gatsby/shared/sync-render.js +162 -158
  29. package/build/adapters/gatsby/shared/sync-render.js.map +1 -1
  30. package/build/commands/end-render.js +44 -19
  31. package/build/commands/end-render.js.map +1 -1
  32. package/build/commands/prepare-assets-directory.js +4 -4
  33. package/build/commands/prepare-assets-directory.js.map +1 -1
  34. package/build/commands/prepare-domains-render.js +14 -19
  35. package/build/commands/prepare-domains-render.js.map +1 -1
  36. package/build/commands/reset-render.js +4 -4
  37. package/build/commands/reset-render.js.map +1 -1
  38. package/build/commands/start-render.js +20 -10
  39. package/build/commands/start-render.js.map +1 -1
  40. package/build/commands/upload-search-content.js +8 -17
  41. package/build/commands/upload-search-content.js.map +1 -1
  42. package/build/constants/endpoints.js.map +1 -1
  43. package/build/constants/envs.js +2 -7
  44. package/build/constants/envs.js.map +1 -1
  45. package/build/constants/errors.js +7 -9
  46. package/build/constants/errors.js.map +1 -1
  47. package/build/services/auth.js +1 -0
  48. package/build/services/auth.js.map +1 -1
  49. package/build/services/db-class.js +49 -0
  50. package/build/services/db-class.js.map +1 -0
  51. package/build/services/db.js.map +1 -1
  52. package/build/services/navigation.js +3 -0
  53. package/build/services/navigation.js.map +1 -1
  54. package/build/services/reference-fields.js.map +1 -1
  55. package/build/services/robots.js +4 -2
  56. package/build/services/robots.js.map +1 -1
  57. package/build/services/sites.js.map +1 -1
  58. package/build/services/store.js +2 -2
  59. package/build/services/store.js.map +1 -1
  60. package/build/types/render.js.map +1 -1
  61. package/build/utils/api.js.map +1 -1
  62. package/build/utils/artifacts.js +11 -11
  63. package/build/utils/artifacts.js.map +1 -1
  64. package/build/utils/brush.js +2 -2
  65. package/build/utils/brush.js.map +1 -1
  66. package/build/utils/cache.js +6 -6
  67. package/build/utils/cache.js.map +1 -1
  68. package/build/utils/check-health.js.map +1 -1
  69. package/build/utils/core-utils.js +35 -3
  70. package/build/utils/core-utils.js.map +1 -1
  71. package/build/utils/domains.js.map +1 -1
  72. package/build/utils/errors.js.map +1 -1
  73. package/build/utils/folders.js +30 -7
  74. package/build/utils/folders.js.map +1 -1
  75. package/build/utils/images.js.map +1 -1
  76. package/build/utils/instance.js.map +1 -1
  77. package/build/utils/loggin.js +9 -3
  78. package/build/utils/loggin.js.map +1 -1
  79. package/build/utils/pages.js.map +1 -1
  80. package/build/utils/render.js +1 -1
  81. package/build/utils/render.js.map +1 -1
  82. package/build/utils/sites.js +20 -19
  83. package/build/utils/sites.js.map +1 -1
  84. package/build/utils/store.js +8 -8
  85. package/build/utils/store.js.map +1 -1
  86. package/exporter/adapters/gatsby/actions/data.ts +3 -3
  87. package/exporter/adapters/gatsby/actions/init.ts +2 -2
  88. package/exporter/adapters/gatsby/actions/meta.ts +2 -2
  89. package/exporter/adapters/gatsby/actions/relocation.ts +2 -2
  90. package/exporter/adapters/gatsby/actions/restore.ts +4 -4
  91. package/exporter/adapters/gatsby/actions/sync.ts +10 -9
  92. package/exporter/adapters/gatsby/index.ts +13 -8
  93. package/exporter/adapters/gatsby/shared/diff-assets.ts +113 -0
  94. package/exporter/adapters/gatsby/shared/extract-assets.ts +11 -11
  95. package/exporter/adapters/gatsby/shared/sync-render.ts +195 -212
  96. package/exporter/build.sh +2 -3
  97. package/exporter/commands/end-render.ts +54 -25
  98. package/exporter/commands/prepare-assets-directory.ts +4 -4
  99. package/exporter/commands/prepare-domains-render.ts +15 -20
  100. package/exporter/commands/reset-render.ts +4 -4
  101. package/exporter/commands/start-render.ts +19 -11
  102. package/exporter/commands/upload-search-content.ts +9 -20
  103. package/exporter/constants/envs.ts +0 -6
  104. package/exporter/constants/errors.ts +12 -4
  105. package/exporter/services/db-class.ts +54 -0
  106. package/exporter/services/robots.ts +2 -2
  107. package/exporter/services/store.ts +2 -2
  108. package/exporter/types/global.ts +0 -1
  109. package/exporter/utils/artifacts.ts +11 -11
  110. package/exporter/utils/cache.ts +6 -6
  111. package/exporter/utils/core-utils.ts +46 -4
  112. package/exporter/utils/folders.ts +30 -7
  113. package/exporter/utils/loggin.ts +9 -3
  114. package/exporter/utils/render.ts +3 -1
  115. package/exporter/utils/sites.ts +18 -17
  116. package/exporter/utils/store.ts +8 -8
  117. package/package.json +10 -11
  118. package/src/gatsby-node-utils.ts +2 -2
  119. package/tsconfig.json +3 -2
  120. package/build/exporter/adapters/gatsby/actions/clean.d.ts +0 -3
  121. package/build/exporter/adapters/gatsby/actions/close.d.ts +0 -3
  122. package/build/exporter/adapters/gatsby/actions/data.d.ts +0 -2
  123. package/build/exporter/adapters/gatsby/actions/healthCheck.d.ts +0 -2
  124. package/build/exporter/adapters/gatsby/actions/init.d.ts +0 -2
  125. package/build/exporter/adapters/gatsby/actions/meta.d.ts +0 -2
  126. package/build/exporter/adapters/gatsby/actions/prepare.d.ts +0 -2
  127. package/build/exporter/adapters/gatsby/actions/relocation.d.ts +0 -2
  128. package/build/exporter/adapters/gatsby/actions/restore.d.ts +0 -3
  129. package/build/exporter/adapters/gatsby/actions/ssg.d.ts +0 -3
  130. package/build/exporter/adapters/gatsby/actions/sync.d.ts +0 -3
  131. package/build/exporter/adapters/gatsby/index.d.ts +0 -9
  132. package/build/exporter/adapters/gatsby/shared/context.d.ts +0 -38
  133. package/build/exporter/adapters/gatsby/shared/extract-assets.d.ts +0 -7
  134. package/build/exporter/adapters/gatsby/shared/gatsby-build.d.ts +0 -7
  135. package/build/exporter/adapters/gatsby/shared/sync-render.d.ts +0 -36
  136. package/build/exporter/adapters/gatsby/shared/types.d.ts +0 -34
  137. package/build/exporter/commands/end-render.d.ts +0 -2
  138. package/build/exporter/commands/prepare-assets-directory.d.ts +0 -2
  139. package/build/exporter/commands/prepare-domains-render.d.ts +0 -2
  140. package/build/exporter/commands/reset-render.d.ts +0 -2
  141. package/build/exporter/commands/start-render.d.ts +0 -2
  142. package/build/exporter/commands/upload-search-content.d.ts +0 -2
  143. package/build/exporter/constants/endpoints.d.ts +0 -19
  144. package/build/exporter/constants/envs.d.ts +0 -31
  145. package/build/exporter/constants/errors.d.ts +0 -24
  146. package/build/exporter/services/auth.d.ts +0 -10
  147. package/build/exporter/services/db.d.ts +0 -4
  148. package/build/exporter/services/navigation.d.ts +0 -50
  149. package/build/exporter/services/reference-fields.d.ts +0 -20
  150. package/build/exporter/services/robots.d.ts +0 -13
  151. package/build/exporter/services/sites.d.ts +0 -32
  152. package/build/exporter/services/store.d.ts +0 -15
  153. package/build/exporter/types/api.d.ts +0 -141
  154. package/build/exporter/types/global.d.ts +0 -84
  155. package/build/exporter/types/navigation.d.ts +0 -28
  156. package/build/exporter/types/pages.d.ts +0 -144
  157. package/build/exporter/types/render.d.ts +0 -50
  158. package/build/exporter/types/sites.d.ts +0 -56
  159. package/build/exporter/types/templates.d.ts +0 -8
  160. package/build/exporter/utils/api.d.ts +0 -23
  161. package/build/exporter/utils/artifacts.d.ts +0 -6
  162. package/build/exporter/utils/brush.d.ts +0 -18
  163. package/build/exporter/utils/cache.d.ts +0 -30
  164. package/build/exporter/utils/check-health.d.ts +0 -7
  165. package/build/exporter/utils/core-utils.d.ts +0 -77
  166. package/build/exporter/utils/domains.d.ts +0 -13
  167. package/build/exporter/utils/errors.d.ts +0 -15
  168. package/build/exporter/utils/folders.d.ts +0 -66
  169. package/build/exporter/utils/images.d.ts +0 -16
  170. package/build/exporter/utils/instance.d.ts +0 -21
  171. package/build/exporter/utils/loggin.d.ts +0 -37
  172. package/build/exporter/utils/pages.d.ts +0 -34
  173. package/build/exporter/utils/render.d.ts +0 -49
  174. package/build/exporter/utils/sites.d.ts +0 -31
  175. package/build/exporter/utils/store.d.ts +0 -53
  176. package/start-render.js +0 -5
@@ -1,77 +0,0 @@
1
- import type { APIResponses } from "../types/api";
2
- import type { LifeCycleAction, LifeCyclesNames } from "../types/global";
3
- /**
4
- * Returns true for "true", "on", true and positive numbers.
5
- * Returns false for "false", "off", false, 0, negative integers and anything else.
6
- */
7
- declare function isTruthy(value: any): boolean;
8
- /**
9
- * Walk a directory and returns the JSON file absolute paths with one level of depth.
10
- * /abs/.../sotre/<siteId>/jsonfile.json
11
- * /abs/.../sotre/<siteId>/jsonfile.json
12
- * /abs/.../sotre/<siteId>/jsonfile.json
13
- * /abs/.../sotre/<siteId>/jsonfile.json
14
- */
15
- declare function walkStore(storeDir: string): AsyncGenerator<string>;
16
- /**
17
- * Custom delay using the "promise hack",
18
- *
19
- * @param ms Amount of miliseconds to be delayed
20
- */
21
- declare function delay(ms: number): Promise<unknown>;
22
- /**
23
- * Converts milliseconds to seconds with a fixed number of decimals.
24
- *
25
- * @param ms The number in milliseconds.
26
- * @param fixed The amount of fixed decimals.
27
- * @returns The converted number in seconds with the fixed number of decimals.
28
- */
29
- declare function msToSec(ms: number, decimals?: number): string;
30
- /**
31
- * Return a siteID from a response object if exist
32
- * @param response A response object
33
- */
34
- declare function getSafeSiteId(response: APIResponses): number | undefined;
35
- /**
36
- * Remove props from an object
37
- *
38
- * @param obj The object
39
- * @param props An array of props to be removed
40
- */
41
- declare function removeProperties(obj: Record<string, unknown>, props: Array<string>): void;
42
- /**
43
- * Measures the execution time of a series of sync or async functions.
44
- *
45
- * @async
46
- * @param functions - Functions to be executed to measure their execution time.
47
- * @returns A promise that resolves with the total execution time in seconds.
48
- */
49
- declare function executeAndReturnExecutionTime<T>(func: () => T | Promise<T>): Promise<number>;
50
- /**
51
- * Executes a life cycle process, which involves executing a callback
52
- * function, printing to the console, and handling errors with optional retries.
53
- *
54
- * @async
55
- * @param name - The name of the life cycle.
56
- * @param action - A callback function to execute.
57
- * @param options - Optional configuration for the life cycle process.
58
- * @param options.maxRetrys - The maximum number of retries for the life cycle.
59
- * @param options.enabled - Whether the life cycle process should be executed.
60
- * @returns - A promise that resolves when the life cycle process is completed.
61
- */
62
- declare function doLifeCycle(name: string, action: LifeCycleAction, options?: {
63
- maxRetrys?: number;
64
- spinner?: boolean;
65
- }): Promise<void>;
66
- declare function removeAllSiteDirsFromStore(): Promise<void>;
67
- /**
68
- * Save render information to a file to use as debug log.
69
- *
70
- * This information will **not** be sent to any API.
71
- */
72
- declare function saveBuildEndLogs(options: {
73
- basePath: string;
74
- domain: string;
75
- }): Promise<void>;
76
- declare const lifeCycleNames: Record<LifeCyclesNames, LifeCyclesNames>;
77
- export { delay, doLifeCycle, executeAndReturnExecutionTime, getSafeSiteId, isTruthy, lifeCycleNames, msToSec, removeAllSiteDirsFromStore, removeProperties, saveBuildEndLogs, walkStore, };
@@ -1,13 +0,0 @@
1
- import type { Domains } from "../types/global";
2
- /**
3
- * Return an array of domains name (string) of the current instance.
4
- */
5
- declare function getInstanceDomains(): Promise<string[]>;
6
- /**
7
- * Return an unique array of domains, filtered without "/".
8
- *
9
- * @param domains An array of domains
10
- * @see Domains
11
- */
12
- declare function getDomainSlugs(domains: Domains): string[];
13
- export { getDomainSlugs, getInstanceDomains };
@@ -1,15 +0,0 @@
1
- import type { ErrorsType } from "../constants/errors";
2
- export type ErrorData = {
3
- error: ErrorsType;
4
- message: string;
5
- expected?: string;
6
- hint?: string;
7
- };
8
- export declare class RenderError extends Error {
9
- constructor(originalError?: unknown);
10
- }
11
- /**
12
- * Throws an error with the provided error message, expected value, and hint.
13
- */
14
- declare function throwError(options: ErrorData, stack?: unknown): never;
15
- export { throwError };
@@ -1,66 +0,0 @@
1
- import type { MakeDirectoryOptions } from "node:fs";
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(baseDir: string): Promise<void>;
9
- /**
10
- * Creates multiple artifact directories.
11
- *
12
- * @param dirs - An array of directory paths.
13
- * @param options - Same option as `fs.mkdirSync()`
14
- */
15
- declare function createDirs(dirs: Array<string>, options?: MakeDirectoryOptions): Promise<void>;
16
- declare function renamePath(src: string, dst: string): Promise<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 copyDirs(src: string, dst: string, dirs: Array<string>, options?: {
26
- withBackup: boolean;
27
- }): Promise<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 moveDirs(src: string, dst: string, dirs: Array<string>, options?: {
37
- withBackup?: boolean;
38
- override?: boolean;
39
- }): Promise<void>;
40
- /**
41
- * Removes multiple artifact directories.
42
- *
43
- * @param dirs - An array of directory paths.
44
- */
45
- declare function removeDirs(dirs: Array<string>): Promise<void>;
46
- /**
47
- * Elimina todas las páginas del store (de todos los sites) cuyo nombre empiece
48
- * con un guión "-". Estas páginas son "virtuales" y no tienen ids desde API por
49
- * lo que mantenerlas en el store es un problema cuando se hacen modificaciones
50
- * en la página "madre". La solución por ahora es borrarlas del store y
51
- * rehacerlas en todos los renders.
52
- */
53
- declare function removeVirtualPages(dirPath: string): Promise<void>;
54
- declare function prependFileSync(filePath: string, content: string): Promise<void>;
55
- /**
56
- * Delete empty directories from the given directory in a recursive way.
57
- */
58
- declare function deleteEmptyDirectories(dirPath: string): Promise<void>;
59
- declare function pathExists(dir: string): Promise<boolean>;
60
- declare function pkgDir(options?: {
61
- readonly cwd?: string;
62
- }): Promise<string | undefined>;
63
- declare function pkgDirSync(options?: {
64
- readonly cwd?: string;
65
- }): string | undefined;
66
- export { copyDirs, createDirs, deleteDisposableSiteDirs, deleteEmptyDirectories, moveDirs, pathExists, pkgDir, pkgDirSync, prependFileSync, removeDirs, removeVirtualPages, renamePath, };
@@ -1,16 +0,0 @@
1
- import type { Fields } from "@griddo/core";
2
- /**
3
- * Format Cloudinary or DAM URL
4
- *
5
- * @param image The image url
6
- * @param width With of the image
7
- * @param height Height of the image
8
- * @param format Format of the image
9
- * @returns A composed URL for the Cloudinary or DAM service
10
- *
11
- * @example
12
- * formatImage("https://images.griddo.io/tree", 300, 200, "jpg")
13
- * // https://images.griddo.io/tree/w/300/h/200/f/jpg
14
- */
15
- declare function formatImage(image: Fields.Image | string, width: number, height: number, format?: string): string | null;
16
- export { formatImage };
@@ -1,21 +0,0 @@
1
- declare const isComponentLibrary: boolean;
2
- declare const componentLibraryPathAlias: {
3
- "@griddo-instance": string;
4
- };
5
- /**
6
- * Returns the instance or monorepo paths.
7
- *
8
- * @param customPath The path for the instance components
9
- */
10
- declare function resolveComponentsPath(customPath?: string): string;
11
- /**
12
- * Return the instance or monorepo components {t|j}sconfig.json file.
13
- */
14
- declare function getComponentsJSConfig(): string | undefined;
15
- /**
16
- * Get the instance webpack aliases
17
- */
18
- declare function getComponentsLibAliases(): {
19
- "@griddo-instance": string;
20
- };
21
- export { componentLibraryPathAlias, getComponentsJSConfig, getComponentsLibAliases, isComponentLibrary, resolveComponentsPath, };
@@ -1,37 +0,0 @@
1
- import type { Site } from "../types/sites";
2
- /**
3
- * Custom basic logging function controlled by a environment variable.
4
- * @param str The string to be logged.
5
- */
6
- declare function verboseLog(str: string): void;
7
- /**
8
- * Custom log inside a line-box.
9
- * @param stringValue The string to be logged.
10
- * @param paddingInline The number of white spaces inside the box at left and right.
11
- * @param paddingBlock The number of white spaces inside the box at top and bottom.
12
- */
13
- declare function boxLog(stringValue: string, title?: string, paddingInline?: number, paddingBlock?: number): void;
14
- /**
15
- * Custom basic logging function controlled by a environment variable.
16
- * Strip double spaces.
17
- *
18
- * @param str The string to be logged.
19
- */
20
- declare function buildLog(str: string): void;
21
- /**
22
- * Console log with a blue color in the info prefix.
23
- * @param str The string to be logged.
24
- */
25
- declare function infoLog(str: string): void;
26
- /**
27
- * Console log with a green color in the success prefix.
28
- * @param str The string to be logged.
29
- */
30
- declare function successLog(str: string): void;
31
- /**
32
- * Console log the Griddo exporter version.
33
- */
34
- declare function showExporterVersion(): Promise<void>;
35
- declare function listSitesLog(title: string, sites: Array<Site>): void;
36
- declare function errorLabelLog(msg: string): void;
37
- export { boxLog, buildLog, errorLabelLog, infoLog, listSitesLog, showExporterVersion, successLog, verboseLog, };
@@ -1,34 +0,0 @@
1
- import type { Fields } from "@griddo/core";
2
- import type { GriddoListPage, GriddoMultiPage, GriddoPageObject, GriddoSinglePage, MultiPageElements, PageAdditionalInfo } from "../types/pages";
3
- import type { TemplateWithReferenceField } from "../types/templates";
4
- /**
5
- * Create a single Griddo page object.
6
- *
7
- * @param page A Griddo single page object.
8
- * @param additionalInfo Additional page info.
9
- */
10
- declare function createGriddoSinglePage(page: GriddoSinglePage, additionalInfo: PageAdditionalInfo): Promise<GriddoPageObject>;
11
- /**
12
- * Create multiples pages from one page as list paginated pages
13
- */
14
- declare function createGriddoListPages({ page, pages, isRoot, defaultLang, template, totalQueriedItems }: GriddoListPage, additionalInfo: PageAdditionalInfo): Promise<GriddoPageObject[]>;
15
- /**
16
- * Create multiples pages from a MultiPage module
17
- *
18
- * @param page A Griddo Multipage object.
19
- * @param additionalInfo Additional page info.
20
- */
21
- declare function createGriddoMultiPages(page: GriddoMultiPage, additionalInfo: PageAdditionalInfo): Promise<GriddoPageObject[]>;
22
- /**
23
- * Get the multi pages elements.
24
- *
25
- * @param page The page to get the multipage parts.
26
- */
27
- declare function getMultiPageElements(page: TemplateWithReferenceField): Promise<MultiPageElements> | null;
28
- /**
29
- * Takes a template object and split the whole queriedItems into separated queriedItems to use in Griddo static list templates.
30
- *
31
- * @param listTemplate A template schema with the ReferenceField data included.
32
- */
33
- declare function getPaginatedPages(listTemplate: TemplateWithReferenceField): Fields.SimpleContentType<Omit<unknown, "__contentTypeKind">>[][];
34
- export { createGriddoListPages, createGriddoMultiPages, createGriddoSinglePage, getMultiPageElements, getPaginatedPages, };
@@ -1,49 +0,0 @@
1
- import type { RenderModeTuple } from "../types/render";
2
- /**
3
- * Creates a sentinel file with the current date and time.
4
- * This file is used to track later if node_modules/@griddo/cx was cleaned by a
5
- * npm install coming from a deploy.
6
- */
7
- declare function markRenderAsStarted(options: {
8
- domain: string;
9
- basePath: string;
10
- }): Promise<void>;
11
- declare function markRenderAsCompleted(domain: string): Promise<void>;
12
- declare function assertRenderIsValid(): Promise<void>;
13
- declare function resolveDomainRenderMode(options: {
14
- domain: string;
15
- shouldBeRendered: boolean;
16
- }): Promise<{
17
- renderMode: "FROM_SCRATCH";
18
- reason: string;
19
- } | {
20
- renderMode: "IDLE";
21
- reason: string;
22
- } | {
23
- renderMode: "INCREMENTAL";
24
- reason: string;
25
- }>;
26
- declare function updateCommitFile(options: {
27
- basePath: string;
28
- }): Promise<void>;
29
- declare function getRenderMode(domain: string): Promise<RenderModeTuple>;
30
- declare function getRenderPathsFromDB(options?: {
31
- domain?: string;
32
- dbFilePath?: string;
33
- }): Promise<{
34
- __root: string;
35
- __cache: string;
36
- __components: string;
37
- __cx: string;
38
- __sites: string;
39
- __exports: string;
40
- __ssg: string;
41
- __exports_dist: string;
42
- __cx_dist: string;
43
- }>;
44
- declare function getRenderMetadataFromDB(): Promise<{
45
- proDomain: string;
46
- griddoVersion: string;
47
- buildReportFileName: string;
48
- }>;
49
- export { assertRenderIsValid, getRenderMetadataFromDB, getRenderMode, getRenderPathsFromDB, markRenderAsCompleted, markRenderAsStarted, resolveDomainRenderMode, updateCommitFile, };
@@ -1,31 +0,0 @@
1
- import type { Site, SiteData } from "../types/sites";
2
- /**
3
- * Check the instance sites and returns site prepared to be published and unpublished.
4
- */
5
- declare function getSitesToRender(domain: string): Promise<{
6
- sitesToPublish: Site[];
7
- sitesToUnpublish: Site[];
8
- }>;
9
- /**
10
- * Unpublish an array of sites sending the information to the API.
11
- *
12
- * @param sites An array of sites
13
- * @see https://griddoio.notion.site/Sites-d7bb0b7cb8d24894a5337e1139fc3d09#2019d3255bda4d219c7e19cf28d0c4fe
14
- */
15
- declare function unpublishSites(sites: Array<Site>): Promise<void>;
16
- /**
17
- * Return a single site generic data.
18
- *
19
- * @param siteID The site id.
20
- * @see SiteData
21
- */
22
- declare function getSiteData(siteID: number): Promise<SiteData>;
23
- /**
24
- * Save a file with the end of build process to use as `build-end` signal.
25
- */
26
- declare function generateBuildReport(domain: string): Promise<void>;
27
- /**
28
- * Generate sitemaps and save them into file system.
29
- */
30
- declare function generateSitemaps(domain: string): Promise<void>;
31
- export { generateBuildReport, generateSitemaps, getSiteData, getSitesToRender, unpublishSites };
@@ -1,53 +0,0 @@
1
- import type { BuildMetaData } from "../types/api";
2
- import type { RenderInfo } from "../types/global";
3
- import type { GriddoPageObject } from "../types/pages";
4
- import type { Site } from "../types/sites";
5
- /**
6
- * Get the build metadata from the Store.
7
- */
8
- declare function getBuildMetadata(domain: string): Promise<BuildMetaData>;
9
- /**
10
- * Write render info into a file.
11
- * @param renderInfo - Data that will be saved related to the render process.
12
- */
13
- declare function saveRenderInfoInStore(renderInfo: RenderInfo, domain: string): Promise<void>;
14
- /**
15
- * Return an array of ids only from `.json` files (no dirs) in the `basePath` dir based in the file name and filtered by the pages ids in a concrete site.
16
- * @param basePath - Absolute path of the dir from which files will be read.
17
- * @returns A Array<number> of pages ids in `basePath` dir filtered by pages ids in a concrete site.
18
- */
19
- /**
20
- * Return an array of paths only from `.json` files (no dirs) in the `basePath` dir based in the file name.
21
- * @param basePath - Absolute path of the dir from which files will be read.
22
- * @returns A Array<number> of pages ids in `basePath` dir.
23
- */
24
- declare function getPageInStoreDir(basePath: string): Promise<string[]>;
25
- /**
26
- * Save the pages into the file system.
27
- * @param pages - An array of Griddo page objects to be saved.
28
- */
29
- declare function saveSitePagesInStore(siteDirName: string, pages: Array<GriddoPageObject>): Promise<void>;
30
- /**
31
- * Removes JSON files from the specified site directory based on the provided arrays of page numbers.
32
- * For each number in the arrays, a corresponding file with the format `<number>.json` is removed if it exists.
33
- *
34
- * WARNING: This function may end up handling large arrays, so don't be tempted
35
- * to refactor it to use something cool like the spread operator and make a
36
- * single array, etc..
37
- *
38
- * @param siteDirName - The name of the site directory containing the pages.
39
- * @param pageIdsArray - A two-dimensional array where each inner array contains numbers representing page files to be removed.
40
- */
41
- declare function removeSitePagesFromStore(siteDirName: string, pageIdsArray: Array<Array<number>>): Promise<void>;
42
- /**
43
- * Removes sites that exist in the store that should no longer be there because
44
- * the domain has been changed. This is necessary because those sites will not
45
- * be marked as `sitesToUnpublish` so they must be removed manually.
46
- */
47
- declare function removeOrphanSites(sitesToPublish: Array<Site>, domain: string): Promise<void>;
48
- /**
49
- * Get pages that are not active anymore but are in the store.
50
- */
51
- declare function getZombiePagesInStore(siteDir: string, activePages: Array<number>): Promise<number[]>;
52
- declare function writeUniqueFileSync(filePath: string, content: string): Promise<void>;
53
- export { getBuildMetadata, getPageInStoreDir, getZombiePagesInStore, removeOrphanSites, removeSitePagesFromStore, saveRenderInfoInStore, saveSitePagesInStore, writeUniqueFileSync, };
package/start-render.js DELETED
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // This is the "bin" for the griddo-cx package used by "infra" to trigger a
4
- // render running `npm run griddo-cx`.
5
- require("./build/commands/start-render.js");