@griddo/cx 11.7.5 → 11.7.6-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -228
- package/build/adapters/gatsby/actions/clean.js +10 -0
- package/build/adapters/gatsby/actions/clean.js.map +1 -0
- package/build/adapters/gatsby/actions/close.js +12 -0
- package/build/adapters/gatsby/actions/close.js.map +1 -0
- package/build/adapters/gatsby/actions/data.js +18 -0
- package/build/adapters/gatsby/actions/data.js.map +1 -0
- package/build/adapters/gatsby/actions/healthCheck.js +10 -0
- package/build/adapters/gatsby/actions/healthCheck.js.map +1 -0
- package/build/adapters/gatsby/actions/init.js +9 -0
- package/build/adapters/gatsby/actions/init.js.map +1 -0
- package/build/adapters/gatsby/actions/meta.js +14 -0
- package/build/adapters/gatsby/actions/meta.js.map +1 -0
- package/build/adapters/gatsby/actions/prepare.js +9 -0
- package/build/adapters/gatsby/actions/prepare.js.map +1 -0
- package/build/adapters/gatsby/actions/relocation.js +15 -0
- package/build/adapters/gatsby/actions/relocation.js.map +1 -0
- package/build/adapters/gatsby/actions/restore.js +26 -0
- package/build/adapters/gatsby/actions/restore.js.map +1 -0
- package/build/adapters/gatsby/actions/ssg.js +9 -0
- package/build/adapters/gatsby/actions/ssg.js.map +1 -0
- package/build/adapters/gatsby/actions/sync.js +50 -0
- package/build/adapters/gatsby/actions/sync.js.map +1 -0
- package/build/adapters/gatsby/index.js +74 -0
- package/build/adapters/gatsby/index.js.map +1 -0
- package/build/adapters/gatsby/shared/context.js +25 -0
- package/build/adapters/gatsby/shared/context.js.map +1 -0
- package/build/adapters/gatsby/shared/extract-assets.js +58 -0
- package/build/adapters/gatsby/shared/extract-assets.js.map +1 -0
- package/build/adapters/gatsby/shared/gatsby-build.js +49 -0
- package/build/adapters/gatsby/shared/gatsby-build.js.map +1 -0
- package/build/adapters/gatsby/shared/sync-render.js +208 -0
- package/build/adapters/gatsby/shared/sync-render.js.map +1 -0
- package/build/adapters/gatsby/shared/types.js +3 -0
- package/build/adapters/gatsby/shared/types.js.map +1 -0
- package/build/commands/end-render.js +63 -0
- package/build/commands/end-render.js.map +1 -0
- package/build/commands/prepare-assets-directory.js +32 -0
- package/build/commands/prepare-assets-directory.js.map +1 -0
- package/build/commands/prepare-domains-render.js +138 -0
- package/build/commands/prepare-domains-render.js.map +1 -0
- package/build/commands/reset-render.js +22 -0
- package/build/commands/reset-render.js.map +1 -0
- package/build/commands/start-render.js +35 -0
- package/build/commands/start-render.js.map +1 -0
- package/build/commands/upload-search-content.js +189 -0
- package/build/commands/upload-search-content.js.map +1 -0
- package/build/constants/endpoints.js +42 -0
- package/build/constants/endpoints.js.map +1 -0
- package/build/constants/envs.js +73 -0
- package/build/constants/envs.js.map +1 -0
- package/build/constants/errors.js +89 -0
- package/build/constants/errors.js.map +1 -0
- package/build/exporter/adapters/gatsby/actions/clean.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/close.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/data.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/healthCheck.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/init.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/meta.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/prepare.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/relocation.d.ts +2 -0
- package/build/exporter/adapters/gatsby/actions/restore.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/ssg.d.ts +3 -0
- package/build/exporter/adapters/gatsby/actions/sync.d.ts +3 -0
- package/build/exporter/adapters/gatsby/index.d.ts +9 -0
- package/build/exporter/adapters/gatsby/shared/context.d.ts +38 -0
- package/build/exporter/adapters/gatsby/shared/extract-assets.d.ts +7 -0
- package/build/exporter/adapters/gatsby/shared/gatsby-build.d.ts +7 -0
- package/build/exporter/adapters/gatsby/shared/sync-render.d.ts +36 -0
- package/build/exporter/adapters/gatsby/shared/types.d.ts +34 -0
- package/build/exporter/commands/start-render.d.ts +2 -0
- package/build/exporter/commands/upload-search-content.d.ts +2 -0
- package/build/{constants → exporter/constants}/envs.d.ts +1 -7
- package/build/{errors/errors-data.d.ts → exporter/constants/errors.d.ts} +5 -3
- package/build/{services → exporter/services}/auth.d.ts +1 -1
- package/build/exporter/services/db.d.ts +4 -0
- package/build/{services → exporter/services}/robots.d.ts +0 -6
- package/build/{services → exporter/services}/sites.d.ts +5 -2
- package/build/exporter/services/store.d.ts +15 -0
- package/build/{types → exporter/types}/api.d.ts +3 -4
- package/build/{types → exporter/types}/global.d.ts +6 -6
- package/build/{types → exporter/types}/navigation.d.ts +1 -1
- package/build/exporter/types/render.d.ts +50 -0
- package/build/{types → exporter/types}/sites.d.ts +1 -2
- package/build/exporter/utils/artifacts.d.ts +6 -0
- package/build/exporter/utils/brush.d.ts +18 -0
- package/build/{utils → exporter/utils}/cache.d.ts +7 -12
- package/build/{utils/health-checks.d.ts → exporter/utils/check-health.d.ts} +2 -2
- package/build/exporter/utils/core-utils.d.ts +77 -0
- package/build/{utils → exporter/utils}/domains.d.ts +1 -1
- package/build/{errors/index.d.ts → exporter/utils/errors.d.ts} +3 -3
- package/build/exporter/utils/folders.d.ts +66 -0
- package/build/{utils → exporter/utils}/loggin.d.ts +2 -16
- package/build/{utils → exporter/utils}/pages.d.ts +2 -2
- package/build/exporter/utils/render.d.ts +49 -0
- package/build/{utils → exporter/utils}/sites.d.ts +3 -3
- package/build/{utils → exporter/utils}/store.d.ts +10 -38
- package/build/services/auth.js +39 -0
- package/build/services/auth.js.map +1 -0
- package/build/services/db.js +34 -0
- package/build/services/db.js.map +1 -0
- package/build/services/navigation.js +93 -0
- package/build/services/navigation.js.map +1 -0
- package/build/services/reference-fields.js +131 -0
- package/build/services/reference-fields.js.map +1 -0
- package/build/services/robots.js +58 -0
- package/build/services/robots.js.map +1 -0
- package/build/services/sites.js +109 -0
- package/build/services/sites.js.map +1 -0
- package/build/services/store.js +282 -0
- package/build/services/store.js.map +1 -0
- package/build/types/api.js +3 -0
- package/build/types/api.js.map +1 -0
- package/build/types/global.js +3 -0
- package/build/types/global.js.map +1 -0
- package/build/types/navigation.js +3 -0
- package/build/types/navigation.js.map +1 -0
- package/build/types/pages.js +3 -0
- package/build/types/pages.js.map +1 -0
- package/build/types/render.js +10 -0
- package/build/types/render.js.map +1 -0
- package/build/types/sites.js +3 -0
- package/build/types/sites.js.map +1 -0
- package/build/types/templates.js +3 -0
- package/build/types/templates.js.map +1 -0
- package/build/utils/api.js +161 -0
- package/build/utils/api.js.map +1 -0
- package/build/utils/artifacts.js +34 -0
- package/build/utils/artifacts.js.map +1 -0
- package/build/utils/brush.js +30 -0
- package/build/utils/brush.js.map +1 -0
- package/build/utils/cache.js +106 -0
- package/build/utils/cache.js.map +1 -0
- package/build/utils/check-health.js +68 -0
- package/build/utils/check-health.js.map +1 -0
- package/build/utils/core-utils.js +251 -0
- package/build/utils/core-utils.js.map +1 -0
- package/build/utils/domains.js +37 -0
- package/build/utils/domains.js.map +1 -0
- package/build/utils/errors.js +30 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/folders.js +339 -0
- package/build/utils/folders.js.map +1 -0
- package/build/utils/images.js +45 -0
- package/build/utils/images.js.map +1 -0
- package/build/utils/instance.js +66 -0
- package/build/utils/instance.js.map +1 -0
- package/build/utils/loggin.js +102 -0
- package/build/utils/loggin.js.map +1 -0
- package/build/utils/pages.js +359 -0
- package/build/utils/pages.js.map +1 -0
- package/build/utils/render.js +144 -0
- package/build/utils/render.js.map +1 -0
- package/build/utils/sites.js +239 -0
- package/build/utils/sites.js.map +1 -0
- package/build/utils/store.js +193 -0
- package/build/utils/store.js.map +1 -0
- package/exporter/adapters/gatsby/actions/clean.ts +14 -0
- package/exporter/adapters/gatsby/actions/close.ts +17 -0
- package/exporter/adapters/gatsby/actions/data.ts +25 -0
- package/exporter/adapters/gatsby/actions/healthCheck.ts +10 -0
- package/exporter/adapters/gatsby/actions/init.ts +12 -0
- package/exporter/adapters/gatsby/actions/meta.ts +18 -0
- package/exporter/adapters/gatsby/actions/prepare.ts +9 -0
- package/exporter/adapters/gatsby/actions/relocation.ts +15 -0
- package/exporter/adapters/gatsby/actions/restore.ts +36 -0
- package/exporter/adapters/gatsby/actions/ssg.ts +12 -0
- package/exporter/adapters/gatsby/actions/sync.ts +70 -0
- package/exporter/adapters/gatsby/index.ts +60 -146
- package/exporter/adapters/gatsby/shared/context.ts +50 -0
- package/exporter/adapters/gatsby/shared/extract-assets.ts +61 -0
- package/exporter/adapters/gatsby/shared/gatsby-build.ts +54 -0
- package/exporter/adapters/gatsby/shared/sync-render.ts +294 -0
- package/exporter/adapters/gatsby/shared/types.ts +35 -0
- package/exporter/build-esbuild.noop +42 -0
- package/exporter/build.sh +5 -38
- package/exporter/commands/end-render.ts +56 -81
- package/exporter/commands/prepare-assets-directory.ts +33 -0
- package/exporter/commands/prepare-domains-render.ts +149 -31
- package/exporter/commands/reset-render.ts +12 -3
- package/exporter/commands/start-render.ts +18 -47
- package/exporter/commands/upload-search-content.ts +206 -21
- package/exporter/constants/envs.ts +59 -51
- package/exporter/{errors/errors-data.ts → constants/errors.ts} +24 -15
- package/exporter/services/auth.ts +7 -6
- package/exporter/services/db.ts +32 -0
- package/exporter/services/navigation.ts +4 -10
- package/exporter/services/reference-fields.ts +8 -23
- package/exporter/services/robots.ts +8 -15
- package/exporter/services/sites.ts +35 -24
- package/exporter/services/store.ts +118 -76
- package/exporter/types/api.ts +24 -27
- package/exporter/types/global.ts +8 -10
- package/exporter/types/navigation.ts +1 -1
- package/exporter/types/pages.ts +2 -3
- package/exporter/types/render.ts +59 -0
- package/exporter/types/sites.ts +1 -2
- package/exporter/utils/api.ts +46 -82
- package/exporter/{artifacts/index.ts → utils/artifacts.ts} +9 -8
- package/exporter/utils/brush.ts +34 -0
- package/exporter/utils/cache.ts +34 -59
- package/exporter/utils/check-health.ts +79 -0
- package/exporter/utils/core-utils.ts +86 -247
- package/exporter/utils/domains.ts +10 -7
- package/exporter/{errors/index.ts → utils/errors.ts} +10 -9
- package/exporter/utils/folders.ts +161 -92
- package/exporter/utils/images.ts +1 -6
- package/exporter/utils/instance.ts +9 -12
- package/exporter/utils/loggin.ts +24 -89
- package/exporter/utils/pages.ts +23 -88
- package/exporter/utils/render.ts +147 -48
- package/exporter/utils/sites.ts +67 -77
- package/exporter/utils/store.ts +85 -178
- package/gatsby-browser.tsx +41 -58
- package/gatsby-config.ts +6 -12
- package/gatsby-node.ts +15 -77
- package/gatsby-ssr.tsx +2 -1
- package/package.json +33 -74
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +55 -0
- package/plugins/gatsby-plugin-svgr-loader/package.json +8 -0
- package/{exporter/react → react}/Favicon/index.tsx +1 -7
- package/{exporter/react → react}/GriddoIntegrations/index.tsx +6 -14
- package/{exporter/react → react}/GriddoIntegrations/utils.ts +4 -9
- package/{build/react/index.d.ts → react/index.tsx} +1 -0
- package/src/components/Head.tsx +13 -46
- package/src/components/template.tsx +8 -30
- package/src/gatsby-node-utils.ts +91 -2
- package/src/html.tsx +2 -11
- package/src/types.ts +5 -5
- package/start-render.js +1 -3
- package/tsconfig.json +3 -2
- package/build/adapters/gatsby/index.d.ts +0 -4
- package/build/adapters/gatsby/utils.d.ts +0 -22
- package/build/artifacts/index.d.ts +0 -6
- package/build/commands/move-assets.d.ts +0 -1
- package/build/commands/prepare-domains-render.d.ts +0 -1
- package/build/constants/index.d.ts +0 -57
- package/build/end-render.js +0 -74
- package/build/end-render.js.map +0 -7
- package/build/index.d.ts +0 -29
- package/build/index.js +0 -73
- package/build/index.js.map +0 -7
- package/build/prepare-domains-render.js +0 -73
- package/build/prepare-domains-render.js.map +0 -7
- package/build/react/Favicon/index.d.ts +0 -5
- package/build/react/Favicon/utils.d.ts +0 -9
- package/build/react/GriddoIntegrations/index.d.ts +0 -20
- package/build/react/GriddoIntegrations/utils.d.ts +0 -26
- package/build/react/index.js +0 -3
- package/build/registers/api.d.ts +0 -9
- package/build/registers/gatsby.d.ts +0 -9
- package/build/registers/index.d.ts +0 -3
- package/build/reset-render.js +0 -74
- package/build/reset-render.js.map +0 -7
- package/build/services/domains.d.ts +0 -6
- package/build/services/register.d.ts +0 -36
- package/build/services/settings.d.ts +0 -4
- package/build/services/store.d.ts +0 -6
- package/build/start-render.js +0 -100
- package/build/start-render.js.map +0 -7
- package/build/upload-search-content.js +0 -74
- package/build/upload-search-content.js.map +0 -7
- package/build/utils/alerts.d.ts +0 -3
- package/build/utils/core-utils.d.ts +0 -107
- package/build/utils/create-build-data.d.ts +0 -8
- package/build/utils/folders.d.ts +0 -53
- package/build/utils/render.d.ts +0 -13
- package/build/utils/searches.d.ts +0 -15
- package/cx.config.d.ts +0 -5
- package/cx.config.js +0 -36
- package/exporter/adapters/gatsby/utils.ts +0 -161
- package/exporter/artifacts/README.md +0 -34
- package/exporter/commands/move-assets.ts +0 -11
- package/exporter/constants/index.ts +0 -129
- package/exporter/index.ts +0 -82
- package/exporter/react/index.tsx +0 -11
- package/exporter/registers/api.ts +0 -14
- package/exporter/registers/gatsby.ts +0 -14
- package/exporter/registers/index.ts +0 -4
- package/exporter/services/domains.ts +0 -16
- package/exporter/services/register.ts +0 -113
- package/exporter/services/settings.ts +0 -17
- package/exporter/utils/alerts.ts +0 -29
- package/exporter/utils/create-build-data.ts +0 -17
- package/exporter/utils/health-checks.ts +0 -64
- package/exporter/utils/searches.ts +0 -179
- package/src/README.md +0 -7
- package/build/{commands → exporter/commands}/end-render.d.ts +0 -0
- package/build/{commands/reset-render.d.ts → exporter/commands/prepare-assets-directory.d.ts} +0 -0
- package/build/{commands/start-render.d.ts → exporter/commands/prepare-domains-render.d.ts} +0 -0
- package/build/{commands/upload-search-content.d.ts → exporter/commands/reset-render.d.ts} +0 -0
- package/build/{constants → exporter/constants}/endpoints.d.ts +0 -0
- package/build/{services → exporter/services}/navigation.d.ts +0 -0
- package/build/{services → exporter/services}/reference-fields.d.ts +0 -0
- package/build/{types → exporter/types}/pages.d.ts +1 -1
- /package/build/{types → exporter/types}/templates.d.ts +0 -0
- /package/build/{utils → exporter/utils}/api.d.ts +0 -0
- /package/build/{utils → exporter/utils}/images.d.ts +0 -0
- /package/build/{utils → exporter/utils}/instance.d.ts +0 -0
- /package/{exporter/react → react}/Favicon/utils.ts +0 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
import { verboseLog } from "../../../utils/loggin";
|
|
5
|
+
|
|
6
|
+
type SyncRenderConfig = {
|
|
7
|
+
src: string;
|
|
8
|
+
dst: string;
|
|
9
|
+
pagesToCreate: Array<number>;
|
|
10
|
+
pagesToDelete: Array<number>;
|
|
11
|
+
artifactsToCopyToExports: Array<string>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type CopyFilePath = {
|
|
15
|
+
from: string;
|
|
16
|
+
to: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type SyncState = {
|
|
20
|
+
htmlToAdd: Array<CopyFilePath>;
|
|
21
|
+
jsonToAdd: Array<CopyFilePath>;
|
|
22
|
+
htmlToDelete: Array<string>;
|
|
23
|
+
jsonToDelete: Array<string>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class SyncRender {
|
|
27
|
+
private bundleDir: string;
|
|
28
|
+
private currentRenderDir: string;
|
|
29
|
+
private pagesToCreate: Array<number>;
|
|
30
|
+
private pagesToDelete: Array<number>;
|
|
31
|
+
private assetArtifacts: Array<string>;
|
|
32
|
+
|
|
33
|
+
private state: SyncState = {
|
|
34
|
+
htmlToAdd: [],
|
|
35
|
+
jsonToAdd: [],
|
|
36
|
+
htmlToDelete: [],
|
|
37
|
+
jsonToDelete: [],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
constructor(config: SyncRenderConfig) {
|
|
41
|
+
this.bundleDir = config.dst;
|
|
42
|
+
this.currentRenderDir = config.src;
|
|
43
|
+
this.pagesToCreate = config.pagesToCreate;
|
|
44
|
+
this.pagesToDelete = config.pagesToDelete;
|
|
45
|
+
this.assetArtifacts = config.artifactsToCopyToExports;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Se basa en los paths encontrados en page-data.json y no en recorrer físicamente el file-system
|
|
49
|
+
setPagesToDelete() {
|
|
50
|
+
// El set de ids están tanto las páginas que se van a crear como borrar.
|
|
51
|
+
// El por qué poner las que se van a crear es porque necesitamos quitar esas páginas con esos ids por si las que se van a crear tienen otro slug.
|
|
52
|
+
// Por ejemplo si se va crear la página id3 con slug /page-with-new-slug
|
|
53
|
+
// pero existía antes con el slug /page se borrará /page del sistema de
|
|
54
|
+
// ficheros y después se creará /page-with-new-slug ya que solo puede
|
|
55
|
+
// existir una página con el mismo id salvo que sea Multi-Page o
|
|
56
|
+
// Listado-Estático.
|
|
57
|
+
const idSet = new Set<number>([...this.pagesToDelete, ...this.pagesToCreate]);
|
|
58
|
+
const composePaths = this.getPageComposePaths(this.bundleDir);
|
|
59
|
+
|
|
60
|
+
for (const compose of composePaths) {
|
|
61
|
+
const normalizedCompose = compose === "/" ? "index" : compose;
|
|
62
|
+
const json = JSON.parse(
|
|
63
|
+
fs.readFileSync(
|
|
64
|
+
path.join(this.bundleDir, "page-data", normalizedCompose, "page-data.json"),
|
|
65
|
+
"utf8",
|
|
66
|
+
),
|
|
67
|
+
);
|
|
68
|
+
const id = json.result.pageContext.id;
|
|
69
|
+
const pagePath = json.result.pageContext.fullPath.compose as string;
|
|
70
|
+
// si el id de la página está en los ids para borrar (idSet) se añade
|
|
71
|
+
if (idSet.has(id)) {
|
|
72
|
+
try {
|
|
73
|
+
this.state.htmlToDelete.push(path.join(this.bundleDir, pagePath, "index.html"));
|
|
74
|
+
this.state.jsonToDelete.push(
|
|
75
|
+
path.join(
|
|
76
|
+
this.bundleDir,
|
|
77
|
+
"page-data",
|
|
78
|
+
pagePath === "/" ? "index" : pagePath,
|
|
79
|
+
"page-data.json",
|
|
80
|
+
),
|
|
81
|
+
);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.log(e);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
verboseLog(`${this.state.htmlToDelete.length} pages HTML to delete`);
|
|
89
|
+
verboseLog(`${this.state.jsonToDelete.length} pages JSON to delete`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Se basa en los paths encontrados en page-data.json y no en recorrer físicamente el file-system
|
|
93
|
+
// Cuando añadimos una página con id 3 (p.e.), hay que buscar todas las
|
|
94
|
+
// páginas con ese id en el bundle y borrar sus html/json. Esto va a pasar
|
|
95
|
+
// por ejemplo si cambiamos el slug de la página 3. Eso hará que se guarde
|
|
96
|
+
// en distintas carpetas pero no es una página que venga en "pagesToDelete"
|
|
97
|
+
setPagesToAdd() {
|
|
98
|
+
const idSet = new Set<number>(this.pagesToCreate);
|
|
99
|
+
const composePaths = this.getPageComposePaths(this.currentRenderDir);
|
|
100
|
+
|
|
101
|
+
for (const compose of composePaths) {
|
|
102
|
+
// 1 - leemos el page-data.json de la página para añadir
|
|
103
|
+
// Gatsby crea un directorio `index` para la página raíz `/`
|
|
104
|
+
const normalizedCompose = compose === "/" ? "index" : compose;
|
|
105
|
+
const json = JSON.parse(
|
|
106
|
+
fs.readFileSync(
|
|
107
|
+
path.join(this.currentRenderDir, "page-data", normalizedCompose, "page-data.json"),
|
|
108
|
+
"utf8",
|
|
109
|
+
),
|
|
110
|
+
);
|
|
111
|
+
// 2 - sacamos el id
|
|
112
|
+
const id = json.result.pageContext.id;
|
|
113
|
+
|
|
114
|
+
// 3 - obtenemos el src y dst del HTML
|
|
115
|
+
const htmlFrom = path.join(this.currentRenderDir, compose, "index.html");
|
|
116
|
+
const htmlTo = path.join(this.bundleDir, compose, "index.html");
|
|
117
|
+
// 4 - obtenemos el src/dst del JSON
|
|
118
|
+
const jsonFrom = path.join(
|
|
119
|
+
this.currentRenderDir,
|
|
120
|
+
"page-data",
|
|
121
|
+
normalizedCompose,
|
|
122
|
+
"page-data.json",
|
|
123
|
+
);
|
|
124
|
+
const jsonTo = path.join(this.bundleDir, "page-data", normalizedCompose, "page-data.json");
|
|
125
|
+
|
|
126
|
+
// Solo actuamos en la página si su id está en pagesToCreate
|
|
127
|
+
if (idSet.has(id)) {
|
|
128
|
+
try {
|
|
129
|
+
this.state.htmlToAdd.push({ from: htmlFrom, to: htmlTo });
|
|
130
|
+
this.state.jsonToAdd.push({ from: jsonFrom, to: jsonTo });
|
|
131
|
+
} catch (e) {
|
|
132
|
+
console.log(e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
verboseLog(`${this.state.htmlToAdd.length} pages HTML to create`);
|
|
137
|
+
verboseLog(`${this.state.jsonToAdd.length} pages JSON to create`);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Realiza la sincronización de los archivos HTML y JSON entre el directorio
|
|
143
|
+
* actual de renderizado y el directorio de exportación.
|
|
144
|
+
*/
|
|
145
|
+
sync() {
|
|
146
|
+
// remove html's
|
|
147
|
+
for (const html of this.state.htmlToDelete) {
|
|
148
|
+
try {
|
|
149
|
+
fs.rmSync(html);
|
|
150
|
+
verboseLog(`Sync (remove) : ${html}`);
|
|
151
|
+
} catch (e) {
|
|
152
|
+
console.log(`Does not exist ${html}`, e);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// remove json's
|
|
157
|
+
for (const json of this.state.jsonToDelete) {
|
|
158
|
+
try {
|
|
159
|
+
fs.rmSync(json);
|
|
160
|
+
verboseLog(`Sync (remove) : ${json}`);
|
|
161
|
+
} catch (e) {
|
|
162
|
+
console.log(`Does not exist ${json}`, e);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// copy html's
|
|
167
|
+
for (const html of this.state.htmlToAdd) {
|
|
168
|
+
fs.mkdirSync(path.dirname(html.to), { recursive: true });
|
|
169
|
+
fs.copyFileSync(html.from, html.to);
|
|
170
|
+
verboseLog(`Sync (copy) : ${html.from} -> ${html.to}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// copy json's
|
|
174
|
+
for (const json of this.state.jsonToAdd) {
|
|
175
|
+
fs.mkdirSync(path.dirname(json.to), { recursive: true });
|
|
176
|
+
fs.copyFileSync(json.from, json.to);
|
|
177
|
+
verboseLog(`Sync (copy) : ${json.from} -> ${json.to}`);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// update app-data.json (update the webpackCompilationHash)
|
|
181
|
+
this.copyAppDataJsonFile();
|
|
182
|
+
|
|
183
|
+
// copy artifacts
|
|
184
|
+
this.copyDirs();
|
|
185
|
+
|
|
186
|
+
// copy sitemaps
|
|
187
|
+
this.copySitemaps();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Busca archivos por extensión de forma recursiva en un directorio.
|
|
192
|
+
* @param dir Directorio base.
|
|
193
|
+
* @param extension Extensión a buscar (ej: ".ts", ".js").
|
|
194
|
+
* @returns Lista de rutas absolutas de archivos encontrados.
|
|
195
|
+
*/
|
|
196
|
+
private findFilesByExtension(dir: string, extension: string): Array<string> {
|
|
197
|
+
let results: Array<string> = [];
|
|
198
|
+
|
|
199
|
+
if (!fs.existsSync(dir)) {
|
|
200
|
+
return [];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const list = fs.readdirSync(dir, { withFileTypes: true });
|
|
204
|
+
|
|
205
|
+
for (const item of list) {
|
|
206
|
+
const fullPath = path.join(dir, item.name);
|
|
207
|
+
|
|
208
|
+
if (item.isDirectory()) {
|
|
209
|
+
results = results.concat(this.findFilesByExtension(fullPath, extension));
|
|
210
|
+
} else if (item.isFile() && fullPath.endsWith(extension)) {
|
|
211
|
+
results.push(fullPath);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return results;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
private findAllPageDataJsons(dir: string) {
|
|
219
|
+
return this.findFilesByExtension(dir, ".json").filter((n) => n.endsWith("page-data.json"));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private getPageComposePaths(src: string) {
|
|
223
|
+
// [page-data/foo/bar/page-data.json, ...]
|
|
224
|
+
const allPageDataJson = this.findAllPageDataJsons(src);
|
|
225
|
+
|
|
226
|
+
// Array de fullPaths
|
|
227
|
+
// Entre ellos un fullPath puede ser: "/" (El root de la instancia)
|
|
228
|
+
|
|
229
|
+
// No sé si hacer esto en este momento...
|
|
230
|
+
// fullPath: "/foo/bar" => "foo/bar"
|
|
231
|
+
// fullPath: "/" => "index"
|
|
232
|
+
return allPageDataJson.map(
|
|
233
|
+
(p) => JSON.parse(fs.readFileSync(p, "utf-8")).result.pageContext.fullPath.compose,
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private copyAppDataJsonFile() {
|
|
238
|
+
fs.copyFileSync(
|
|
239
|
+
path.join(this.currentRenderDir, "page-data", "app-data.json"),
|
|
240
|
+
path.join(this.bundleDir, "page-data", "app-data.json"),
|
|
241
|
+
);
|
|
242
|
+
verboseLog("Copied app-data.json");
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
private copyDirs() {
|
|
246
|
+
for (const assetArtifact of this.assetArtifacts) {
|
|
247
|
+
fs.copyFileSync(
|
|
248
|
+
path.join(this.currentRenderDir, assetArtifact),
|
|
249
|
+
path.join(this.bundleDir, assetArtifact),
|
|
250
|
+
);
|
|
251
|
+
verboseLog(
|
|
252
|
+
`Copied ${path.join(this.currentRenderDir, assetArtifact)} -> to -> ${path.join(
|
|
253
|
+
this.bundleDir,
|
|
254
|
+
assetArtifact,
|
|
255
|
+
)}`,
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
private copySitemaps() {
|
|
261
|
+
/*
|
|
262
|
+
1. buscar directorios que tengan como hijo un `sitemap.xml`
|
|
263
|
+
2. copiar todos los sitemap.xml y sitemap-* a /exports/sites/<domain>/<site>/ borrando previamente los .xmls que existan
|
|
264
|
+
*/
|
|
265
|
+
const renderSrc = path.resolve(this.currentRenderDir);
|
|
266
|
+
const renderDst = path.resolve(this.bundleDir);
|
|
267
|
+
const xmlFilesInSrc = this.findFilesByExtension(renderSrc, ".xml");
|
|
268
|
+
const xmlFilesInDst = this.findFilesByExtension(renderDst, ".xml");
|
|
269
|
+
|
|
270
|
+
// Eliminar los sitemaps de griddo que existan en el destino, se van a
|
|
271
|
+
// crear todos nuevos en la fase Meta.
|
|
272
|
+
for (const xmlFile of xmlFilesInDst) {
|
|
273
|
+
if (
|
|
274
|
+
path.basename(xmlFile).startsWith("sitemap-") ||
|
|
275
|
+
path.basename(xmlFile) === "sitemap.xml"
|
|
276
|
+
) {
|
|
277
|
+
fs.rmSync(xmlFile, { force: true });
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
for (const xmlFile of xmlFilesInSrc) {
|
|
282
|
+
const src = xmlFile;
|
|
283
|
+
// cambia la ruta, de src -> dst
|
|
284
|
+
const dst = xmlFile.replace(renderSrc, renderDst);
|
|
285
|
+
|
|
286
|
+
if (!fs.existsSync(path.dirname(dst))) {
|
|
287
|
+
fs.mkdirSync(path.dirname(dst), { recursive: true });
|
|
288
|
+
}
|
|
289
|
+
fs.copyFileSync(src, dst);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { SyncRender };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
interface SSG {
|
|
2
|
+
assetPrefix: string;
|
|
3
|
+
ssgArtifacts: {
|
|
4
|
+
disposables: string[];
|
|
5
|
+
cacheables: string[];
|
|
6
|
+
};
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// Minimal representation of the page structure
|
|
10
|
+
interface GatsbyPageData {
|
|
11
|
+
path: string;
|
|
12
|
+
result: {
|
|
13
|
+
pageContext: {
|
|
14
|
+
id: number;
|
|
15
|
+
title: string;
|
|
16
|
+
path: string;
|
|
17
|
+
openGraph: any;
|
|
18
|
+
pageMetadata: any;
|
|
19
|
+
page: {
|
|
20
|
+
site: number;
|
|
21
|
+
id: number;
|
|
22
|
+
fullPath: { compose: string };
|
|
23
|
+
language: number;
|
|
24
|
+
title: string;
|
|
25
|
+
fullUrl: string;
|
|
26
|
+
templateId: string;
|
|
27
|
+
template: {
|
|
28
|
+
templateType: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type { GatsbyPageData, SSG };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# Build CX script file
|
|
4
|
+
#
|
|
5
|
+
# This file generates the necessary builds for CX.
|
|
6
|
+
# - Setup, to generate necessary elements (tsconfig, etc..)
|
|
7
|
+
# - Library, CX library that will be used by the SSG framework.
|
|
8
|
+
# - Scripts, CX scripts that will be used by infra during the render process.
|
|
9
|
+
#
|
|
10
|
+
# @todo:
|
|
11
|
+
# In the future, we will try to eliminate the bundling processes and use
|
|
12
|
+
# TypeScript or ESModules directly.
|
|
13
|
+
|
|
14
|
+
# start
|
|
15
|
+
echo "📦 Building ..."
|
|
16
|
+
|
|
17
|
+
# CLI options
|
|
18
|
+
log="--log-level=error"
|
|
19
|
+
production_node_opts="--bundle --platform=node --minify --sourcemap"
|
|
20
|
+
debugging_node_opts="--bundle --platform=node --sourcemap"
|
|
21
|
+
# react_opts="--platform=node --external:@griddo-instance --external:react --external:react-dom --bundle --minify"
|
|
22
|
+
|
|
23
|
+
# Manage --minify for debugging
|
|
24
|
+
bundle_node_opts=$production_node_opts
|
|
25
|
+
if [ "$1" = "--debug" ]; then
|
|
26
|
+
bundle_node_opts=$debugging_node_opts
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
# library
|
|
30
|
+
# esbuild ${log} ./exporter/index.ts ${bundle_node_opts} --outfile=./build/index.js
|
|
31
|
+
# esbuild ${log} ./exporter/react/index.tsx ${react_opts} --outfile=./build/react/index.js
|
|
32
|
+
|
|
33
|
+
# scripts
|
|
34
|
+
esbuild ${log} ./exporter/commands/end-render.ts ${bundle_node_opts} --outfile=./build/end-render.js
|
|
35
|
+
esbuild ${log} ./exporter/commands/upload-search-content.ts ${bundle_node_opts} --outfile=./build/upload-search-content.js
|
|
36
|
+
esbuild ${log} ./exporter/commands/reset-render.ts ${bundle_node_opts} --outfile=./build/reset-render.js
|
|
37
|
+
esbuild ${log} ./exporter/commands/start-render.ts ${bundle_node_opts} --outfile=./build/start-render.js
|
|
38
|
+
esbuild ${log} ./exporter/commands/prepare-domains-render.ts ${bundle_node_opts} --outfile=./build/prepare-domains-render.js
|
|
39
|
+
esbuild ${log} ./exporter/commands/prepare-assets-directory.ts ${bundle_node_opts} --outfile=./build/prepare-assets-directory.js
|
|
40
|
+
|
|
41
|
+
# types
|
|
42
|
+
tsc --emitDeclarationOnly --declaration --outDir build --project tsconfig.exporter.json
|
package/exporter/build.sh
CHANGED
|
@@ -1,39 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
# This file generates the necessary builds for CX.
|
|
4
|
-
# - Setup, to generate necessary elements (tsconfig, etc..)
|
|
5
|
-
# - Library, CX library that will be used by the SSG framework.
|
|
6
|
-
# - Scripts, CX scripts that will be used by infra during the render process.
|
|
7
|
-
#
|
|
8
|
-
# @todo:
|
|
9
|
-
# In the future, we will try to eliminate the bundling processes and use
|
|
10
|
-
# TypeScript or ESModules directly.
|
|
1
|
+
#!/usr/bin/env bash
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
log="--log-level=error"
|
|
17
|
-
production_node_opts="--bundle --platform=node --minify --sourcemap"
|
|
18
|
-
debugging_node_opts="--bundle --platform=node --sourcemap"
|
|
19
|
-
react_opts="--platform=node --external:@griddo-instance --external:react --external:react-dom --bundle --minify"
|
|
20
|
-
|
|
21
|
-
# Manage --minify for debugging
|
|
22
|
-
bundle_node_opts=$production_node_opts
|
|
23
|
-
if [ "$1" = "--debug" ]; then
|
|
24
|
-
bundle_node_opts=$debugging_node_opts
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
# library
|
|
28
|
-
esbuild ${log} ./exporter/index.ts ${bundle_node_opts} --outfile=./build/index.js
|
|
29
|
-
esbuild ${log} ./exporter/react/index.tsx ${react_opts} --outfile=./build/react/index.js
|
|
30
|
-
|
|
31
|
-
# scripts
|
|
32
|
-
esbuild ${log} ./exporter/commands/end-render.ts ${bundle_node_opts} --outfile=./build/end-render.js
|
|
33
|
-
esbuild ${log} ./exporter/commands/upload-search-content.ts ${bundle_node_opts} --outfile=./build/upload-search-content.js
|
|
34
|
-
esbuild ${log} ./exporter/commands/reset-render.ts ${bundle_node_opts} --outfile=./build/reset-render.js
|
|
35
|
-
esbuild ${log} ./exporter/commands/start-render.ts ${bundle_node_opts} --outfile=./build/start-render.js
|
|
36
|
-
esbuild ${log} ./exporter/commands/prepare-domains-render.ts ${bundle_node_opts} --outfile=./build/prepare-domains-render.js
|
|
37
|
-
|
|
38
|
-
# types
|
|
39
|
-
tsc --emitDeclarationOnly --declaration --outDir build --project tsconfig.exporter.json
|
|
3
|
+
echo "📦 Compiling CX..."
|
|
4
|
+
rm -rf ./build
|
|
5
|
+
tsc --project tsconfig.commands.json
|
|
6
|
+
tsc --emitDeclarationOnly --declaration --outDir build --project tsconfig.exporter.json
|
|
@@ -1,105 +1,80 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import path from "node:path";
|
|
3
|
+
import type { Report } from "../types/render";
|
|
5
4
|
|
|
6
|
-
import
|
|
5
|
+
import fsp from "node:fs/promises";
|
|
6
|
+
import path from "node:path";
|
|
7
7
|
|
|
8
|
+
import { ArtifactError } from "../constants/errors";
|
|
8
9
|
import { AuthService } from "../services/auth";
|
|
9
10
|
import { endSiteRender } from "../services/sites";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
11
|
+
import { doLifeCycle } from "../utils/core-utils";
|
|
12
|
+
import { throwError } from "../utils/errors";
|
|
13
|
+
import { pathExists } from "../utils/folders";
|
|
12
14
|
import { infoLog } from "../utils/loggin";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const exportArchiveBasePath =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"Cache-Control": string;
|
|
27
|
-
lang?: string | undefined;
|
|
28
|
-
}
|
|
29
|
-
| undefined;
|
|
30
|
-
sites: Array<{
|
|
31
|
-
siteId: number;
|
|
32
|
-
publishHashes: Array<string>;
|
|
33
|
-
siteHash: string | null;
|
|
34
|
-
unpublishHashes: Array<string>;
|
|
35
|
-
publishPagesIds: Array<number>;
|
|
36
|
-
}>;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
function getDomainRenderReport(domain: string) {
|
|
40
|
-
const reports: Array<Report> = [];
|
|
41
|
-
const { buildReportFileName } = getConfig();
|
|
42
|
-
|
|
43
|
-
const buildReportFile = path.resolve(
|
|
44
|
-
exportArchiveBasePath,
|
|
45
|
-
domain,
|
|
46
|
-
"dist",
|
|
47
|
-
buildReportFileName,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
if (!fs.existsSync(buildReportFile)) {
|
|
51
|
-
console.info(`Build report file "${buildReportFile}" not found.`);
|
|
15
|
+
import { getRenderMetadataFromDB, getRenderMode, getRenderPathsFromDB } from "../utils/render";
|
|
16
|
+
|
|
17
|
+
async function getRenderReport(options: {
|
|
18
|
+
domain: string;
|
|
19
|
+
exportsSiteDir: string;
|
|
20
|
+
buildReportFileName: string;
|
|
21
|
+
}) {
|
|
22
|
+
const { buildReportFileName, domain, exportsSiteDir: exportArchiveBasePath } = options;
|
|
23
|
+
const buildReportFile = path.resolve(exportArchiveBasePath, domain, "dist", buildReportFileName);
|
|
24
|
+
|
|
25
|
+
if (!(await pathExists(buildReportFile))) {
|
|
26
|
+
infoLog(`Build report file "${buildReportFile}" not found.`);
|
|
27
|
+
throwError(ArtifactError);
|
|
52
28
|
}
|
|
53
29
|
|
|
54
|
-
|
|
30
|
+
return JSON.parse(await fsp.readFile(buildReportFile, "utf-8")) as Report;
|
|
31
|
+
}
|
|
55
32
|
|
|
56
|
-
|
|
33
|
+
const sendEndSiteRender = async (report: Report) => {
|
|
34
|
+
const sites = report.sites;
|
|
57
35
|
|
|
58
|
-
|
|
59
|
-
}
|
|
36
|
+
for (const site of sites) {
|
|
37
|
+
const { siteId, ...body } = site;
|
|
38
|
+
infoLog(`Site (${siteId})`);
|
|
39
|
+
await endSiteRender(siteId, body);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
60
42
|
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const sites = report.sites;
|
|
43
|
+
async function endRenderAction() {
|
|
44
|
+
const { buildReportFileName } = await getRenderMetadataFromDB();
|
|
45
|
+
const { __sites } = await getRenderPathsFromDB();
|
|
65
46
|
|
|
66
|
-
|
|
67
|
-
|
|
47
|
+
const [domain] = process.argv.slice(2);
|
|
48
|
+
const { renderMode } = await getRenderMode(domain);
|
|
68
49
|
|
|
69
|
-
|
|
50
|
+
if (renderMode === "IDLE") {
|
|
51
|
+
infoLog(`Skipping build-end for domain ${domain} as it is marked as IDLE.`);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
70
54
|
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
55
|
+
await AuthService.login();
|
|
75
56
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
57
|
+
const report = await getRenderReport({
|
|
58
|
+
domain,
|
|
59
|
+
exportsSiteDir: __sites,
|
|
60
|
+
buildReportFileName,
|
|
61
|
+
});
|
|
80
62
|
|
|
81
|
-
|
|
63
|
+
infoLog(`Sending ending call to ${domain} sites`);
|
|
82
64
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
}
|
|
65
|
+
for (const site of report.sites) {
|
|
66
|
+
site.publishHashes = [...new Set(site.publishHashes)];
|
|
67
|
+
site.unpublishHashes = [...new Set(site.unpublishHashes)];
|
|
68
|
+
}
|
|
89
69
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
// Legacy render
|
|
93
|
-
const domains = await getInstanceDomains();
|
|
94
|
-
for (const domain of domains) {
|
|
95
|
-
const reports = getDomainRenderReport(domain);
|
|
70
|
+
await sendEndSiteRender(report);
|
|
71
|
+
}
|
|
96
72
|
|
|
97
|
-
|
|
73
|
+
async function main() {
|
|
74
|
+
await doLifeCycle("EndRender", endRenderAction);
|
|
75
|
+
}
|
|
98
76
|
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
})().catch((err) => {
|
|
77
|
+
main().catch((err) => {
|
|
103
78
|
console.error("Error", err?.stdout?.toString() || err);
|
|
104
79
|
process.exit(1);
|
|
105
80
|
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import childProcess from "node:child_process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import { doLifeCycle } from "../utils/core-utils";
|
|
7
|
+
import { pathExists } from "../utils/folders";
|
|
8
|
+
import { getRenderPathsFromDB } from "../utils/render";
|
|
9
|
+
|
|
10
|
+
async function prepareAssetsAction() {
|
|
11
|
+
const [domain] = process.argv.slice(2);
|
|
12
|
+
|
|
13
|
+
const { __exports } = await getRenderPathsFromDB({ domain });
|
|
14
|
+
|
|
15
|
+
const assetsDir = path.join(__exports, "assets");
|
|
16
|
+
const domainAssetsDir = path.join(__exports, domain);
|
|
17
|
+
|
|
18
|
+
if (await pathExists(assetsDir)) {
|
|
19
|
+
childProcess.execSync(`rm -rf ${domainAssetsDir}`);
|
|
20
|
+
childProcess.execSync(`mv ${assetsDir} ${domainAssetsDir}`);
|
|
21
|
+
} else {
|
|
22
|
+
console.log("Assets directory not found");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
await doLifeCycle("PrepareAssets(Internal)", prepareAssetsAction);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
main().catch((err) => {
|
|
31
|
+
console.error("Error", err?.stdout?.toString() || err);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
});
|