@griddo/cx 11.9.12-rc.0 → 11.9.13
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 +240 -13
- package/build/adapters/gatsby/index.d.ts +4 -0
- package/build/adapters/gatsby/utils.d.ts +26 -0
- package/build/artifacts/index.d.ts +6 -0
- package/build/commands/end-render.d.ts +1 -0
- package/build/commands/reset-render.d.ts +1 -0
- package/build/commands/start-render.d.ts +1 -0
- package/build/commands/upload-search-content.d.ts +1 -0
- package/build/constants/envs.d.ts +37 -0
- package/build/constants/index.d.ts +57 -0
- package/build/end-render.js +74 -0
- package/build/end-render.js.map +7 -0
- package/build/{shared/errors.d.ts → errors/errors-data.d.ts} +3 -5
- package/build/errors/index.d.ts +15 -0
- package/build/index.d.ts +29 -10
- package/build/index.js +73 -406
- package/build/index.js.map +7 -0
- package/build/prepare-domains-render.js +73 -0
- package/build/prepare-domains-render.js.map +7 -0
- package/build/react/Favicon/index.d.ts +5 -0
- package/build/react/GriddoIntegrations/index.d.ts +4 -3
- package/build/react/GriddoIntegrations/utils.d.ts +6 -7
- package/build/react/index.d.ts +2 -3
- package/build/react/index.js +3 -1
- package/build/registers/api.d.ts +9 -0
- package/build/registers/gatsby.d.ts +9 -0
- package/build/registers/index.d.ts +3 -0
- package/build/reset-render.js +74 -0
- package/build/reset-render.js.map +7 -0
- package/build/services/auth.d.ts +5 -2
- package/build/services/domains.d.ts +4 -3
- package/build/services/navigation.d.ts +16 -16
- package/build/services/reference-fields.d.ts +3 -3
- package/build/services/register.d.ts +36 -0
- package/build/services/robots.d.ts +19 -2
- package/build/services/settings.d.ts +4 -0
- package/build/services/sites.d.ts +5 -8
- package/build/services/store.d.ts +1 -10
- package/build/start-render.js +100 -0
- package/build/start-render.js.map +7 -0
- package/build/{shared/types → types}/api.d.ts +18 -18
- package/build/{shared/types → types}/global.d.ts +16 -15
- package/build/{shared/types → types}/navigation.d.ts +5 -5
- package/build/{shared/types → types}/pages.d.ts +9 -9
- package/build/{shared/types → types}/sites.d.ts +19 -18
- package/build/upload-search-content.js +74 -0
- package/build/upload-search-content.js.map +7 -0
- package/build/utils/alerts.d.ts +3 -0
- package/build/{services → utils}/api.d.ts +1 -1
- package/build/utils/cache.d.ts +35 -0
- package/build/utils/core-utils.d.ts +107 -0
- package/build/utils/create-build-data.d.ts +8 -0
- package/build/utils/domains.d.ts +13 -0
- package/build/utils/folders.d.ts +53 -0
- package/build/{core/check-env-health.d.ts → utils/health-checks.d.ts} +2 -4
- package/build/utils/loggin.d.ts +51 -0
- package/build/{services → utils}/pages.d.ts +3 -3
- package/build/utils/render.d.ts +13 -0
- package/build/utils/searches.d.ts +15 -0
- package/build/utils/sites.d.ts +31 -0
- package/build/utils/store.d.ts +81 -0
- package/cx.config.d.ts +5 -0
- package/cx.config.js +36 -0
- package/exporter/adapters/gatsby/index.ts +182 -0
- package/exporter/adapters/gatsby/utils.ts +186 -0
- package/exporter/artifacts/README.md +34 -0
- package/exporter/artifacts/index.ts +33 -0
- package/exporter/build.sh +24 -16
- package/exporter/commands/end-render.ts +86 -65
- package/exporter/commands/move-assets.ts +11 -0
- package/exporter/commands/prepare-domains-render.ts +35 -132
- package/exporter/commands/reset-render.ts +8 -13
- package/exporter/commands/start-render.ts +64 -26
- package/exporter/commands/upload-search-content.ts +26 -204
- package/exporter/{shared → constants}/endpoints.ts +11 -12
- package/exporter/constants/envs.ts +94 -0
- package/exporter/constants/index.ts +129 -0
- package/exporter/{shared/errors.ts → errors/errors-data.ts} +14 -24
- package/exporter/errors/index.ts +40 -0
- package/exporter/index.ts +56 -14
- package/exporter/react/{GriddoFavicon → Favicon}/index.tsx +9 -3
- package/exporter/react/GriddoIntegrations/index.tsx +23 -17
- package/exporter/react/GriddoIntegrations/utils.ts +12 -24
- package/exporter/react/index.tsx +9 -3
- package/exporter/registers/api.ts +14 -0
- package/exporter/registers/gatsby.ts +14 -0
- package/exporter/registers/index.ts +4 -0
- package/exporter/services/auth.ts +10 -8
- package/exporter/services/domains.ts +8 -23
- package/exporter/services/navigation.ts +18 -12
- package/exporter/services/reference-fields.ts +32 -14
- package/exporter/services/register.ts +113 -0
- package/exporter/services/robots.ts +61 -33
- package/exporter/services/settings.ts +17 -0
- package/exporter/services/sites.ts +28 -40
- package/exporter/services/store.ts +321 -354
- package/exporter/{shared/types → types}/api.ts +41 -40
- package/exporter/{shared/types → types}/global.ts +21 -17
- package/exporter/{shared/types → types}/navigation.ts +3 -3
- package/exporter/{shared/types → types}/pages.ts +11 -10
- package/exporter/{shared/types → types}/sites.ts +19 -18
- package/exporter/utils/alerts.ts +29 -0
- package/exporter/utils/api.ts +243 -0
- package/exporter/utils/cache.ts +142 -0
- package/exporter/utils/core-utils.ts +458 -0
- package/exporter/utils/create-build-data.ts +17 -0
- package/exporter/utils/domains.ts +39 -0
- package/exporter/utils/folders.ts +320 -0
- package/exporter/utils/health-checks.ts +64 -0
- package/exporter/{core → utils}/images.ts +6 -1
- package/exporter/{core → utils}/instance.ts +13 -9
- package/exporter/utils/loggin.ts +184 -0
- package/exporter/{services → utils}/pages.ts +92 -27
- package/exporter/utils/render.ts +71 -0
- package/exporter/utils/searches.ts +156 -0
- package/exporter/utils/sites.ts +312 -0
- package/exporter/utils/store.ts +314 -0
- package/gatsby-browser.tsx +58 -41
- package/gatsby-config.ts +17 -10
- package/gatsby-node.ts +79 -20
- package/gatsby-ssr.tsx +1 -2
- package/package.json +80 -41
- package/src/README.md +7 -0
- package/src/components/Head.tsx +73 -28
- package/src/components/template.tsx +29 -6
- package/src/gatsby-node-utils.ts +2 -76
- package/src/html.tsx +11 -2
- package/src/types.ts +3 -3
- package/start-render.js +7 -0
- package/tsconfig.json +3 -5
- package/build/commands/end-render.js +0 -31
- package/build/commands/end-render.js.map +0 -7
- package/build/commands/prepare-assets-directory.js +0 -9
- package/build/commands/prepare-assets-directory.js.map +0 -7
- package/build/commands/prepare-domains-render.js +0 -38
- package/build/commands/prepare-domains-render.js.map +0 -7
- package/build/commands/reset-render.js +0 -31
- package/build/commands/reset-render.js.map +0 -7
- package/build/commands/single-domain-upload-search-content.d.ts +0 -1
- package/build/commands/start-render.js +0 -66
- package/build/commands/start-render.js.map +0 -7
- package/build/commands/upload-search-content.js +0 -32
- package/build/commands/upload-search-content.js.map +0 -7
- package/build/core/GriddoLog.d.ts +0 -16
- package/build/core/db-class.d.ts +0 -11
- package/build/core/db.d.ts +0 -4
- package/build/core/dist-rollback.d.ts +0 -11
- package/build/core/errors.d.ts +0 -26
- package/build/core/fs.d.ts +0 -69
- package/build/core/life-cycle.d.ts +0 -26
- package/build/core/logger.d.ts +0 -18
- package/build/core/objects.d.ts +0 -11
- package/build/core/print-logos.d.ts +0 -5
- package/build/react/DynamicScript/index.d.ts +0 -4
- package/build/react/GriddoFavicon/index.d.ts +0 -4
- package/build/react/GriddoOpenGraph/index.d.ts +0 -10
- package/build/services/manage-sites.d.ts +0 -22
- package/build/services/manage-store.d.ts +0 -32
- package/build/services/render-artifacts.d.ts +0 -6
- package/build/services/render.d.ts +0 -70
- package/build/services/sitemaps.d.ts +0 -5
- package/build/shared/context.d.ts +0 -36
- package/build/shared/envs.d.ts +0 -19
- package/build/shared/npm-modules/brush.d.ts +0 -18
- package/build/shared/npm-modules/find-up-simple.d.ts +0 -34
- package/build/shared/npm-modules/pkg-dir.d.ts +0 -7
- package/build/shared/npm-modules/xml-parser.d.ts +0 -4
- package/build/shared/types/render.d.ts +0 -54
- package/build/shared/types.d.ts +0 -15
- package/build/ssg-adapters/gatsby/actions/clean.d.ts +0 -3
- package/build/ssg-adapters/gatsby/actions/close.d.ts +0 -3
- package/build/ssg-adapters/gatsby/actions/data.d.ts +0 -2
- package/build/ssg-adapters/gatsby/actions/healthCheck.d.ts +0 -2
- package/build/ssg-adapters/gatsby/actions/init.d.ts +0 -2
- package/build/ssg-adapters/gatsby/actions/logs.d.ts +0 -3
- package/build/ssg-adapters/gatsby/actions/meta.d.ts +0 -2
- package/build/ssg-adapters/gatsby/actions/prepare.d.ts +0 -2
- package/build/ssg-adapters/gatsby/actions/relocation.d.ts +0 -2
- package/build/ssg-adapters/gatsby/actions/restore.d.ts +0 -3
- package/build/ssg-adapters/gatsby/actions/ssg.d.ts +0 -3
- package/build/ssg-adapters/gatsby/actions/sync.d.ts +0 -3
- package/build/ssg-adapters/gatsby/index.d.ts +0 -9
- package/build/ssg-adapters/gatsby/shared/artifacts.d.ts +0 -4
- package/build/ssg-adapters/gatsby/shared/diff-assets.d.ts +0 -15
- package/build/ssg-adapters/gatsby/shared/extract-assets.d.ts +0 -7
- package/build/ssg-adapters/gatsby/shared/gatsby-build.d.ts +0 -7
- package/build/ssg-adapters/gatsby/shared/render-rollback.d.ts +0 -18
- package/build/ssg-adapters/gatsby/shared/sync-render.d.ts +0 -26
- package/build/ssg-adapters/gatsby/shared/types.d.ts +0 -34
- package/cli.mjs +0 -231
- package/exporter/build-esbuild.noop +0 -42
- package/exporter/commands/README.md +0 -151
- package/exporter/commands/prepare-assets-directory.ts +0 -35
- package/exporter/commands/single-domain-upload-search-content.ts +0 -206
- package/exporter/core/GriddoLog.ts +0 -45
- package/exporter/core/check-env-health.ts +0 -204
- package/exporter/core/db-class.ts +0 -54
- package/exporter/core/db.ts +0 -33
- package/exporter/core/dist-rollback.ts +0 -49
- package/exporter/core/errors.ts +0 -93
- package/exporter/core/fs.ts +0 -385
- package/exporter/core/life-cycle.ts +0 -73
- package/exporter/core/logger.ts +0 -141
- package/exporter/core/objects.ts +0 -37
- package/exporter/core/print-logos.ts +0 -21
- package/exporter/react/DynamicScript/index.tsx +0 -33
- package/exporter/react/GriddoOpenGraph/index.tsx +0 -39
- package/exporter/services/api.ts +0 -306
- package/exporter/services/manage-sites.ts +0 -116
- package/exporter/services/manage-store.ts +0 -173
- package/exporter/services/render-artifacts.ts +0 -44
- package/exporter/services/render.ts +0 -229
- package/exporter/services/sitemaps.ts +0 -129
- package/exporter/shared/context.ts +0 -49
- package/exporter/shared/envs.ts +0 -62
- package/exporter/shared/npm-modules/README.md +0 -36
- package/exporter/shared/npm-modules/brush.ts +0 -34
- package/exporter/shared/npm-modules/find-up-simple.ts +0 -100
- package/exporter/shared/npm-modules/pkg-dir.ts +0 -17
- package/exporter/shared/npm-modules/xml-parser.ts +0 -57
- package/exporter/shared/types/render.ts +0 -63
- package/exporter/shared/types.ts +0 -15
- package/exporter/ssg-adapters/gatsby/actions/clean.ts +0 -26
- package/exporter/ssg-adapters/gatsby/actions/close.ts +0 -17
- package/exporter/ssg-adapters/gatsby/actions/data.ts +0 -22
- package/exporter/ssg-adapters/gatsby/actions/healthCheck.ts +0 -10
- package/exporter/ssg-adapters/gatsby/actions/init.ts +0 -12
- package/exporter/ssg-adapters/gatsby/actions/logs.ts +0 -10
- package/exporter/ssg-adapters/gatsby/actions/meta.ts +0 -13
- package/exporter/ssg-adapters/gatsby/actions/prepare.ts +0 -9
- package/exporter/ssg-adapters/gatsby/actions/relocation.ts +0 -15
- package/exporter/ssg-adapters/gatsby/actions/restore.ts +0 -21
- package/exporter/ssg-adapters/gatsby/actions/ssg.ts +0 -12
- package/exporter/ssg-adapters/gatsby/actions/sync.ts +0 -65
- package/exporter/ssg-adapters/gatsby/index.ts +0 -114
- package/exporter/ssg-adapters/gatsby/shared/artifacts.ts +0 -17
- package/exporter/ssg-adapters/gatsby/shared/diff-assets.ts +0 -128
- package/exporter/ssg-adapters/gatsby/shared/extract-assets.ts +0 -75
- package/exporter/ssg-adapters/gatsby/shared/gatsby-build.ts +0 -58
- package/exporter/ssg-adapters/gatsby/shared/render-rollback.ts +0 -33
- package/exporter/ssg-adapters/gatsby/shared/sync-render.ts +0 -298
- package/exporter/ssg-adapters/gatsby/shared/types.ts +0 -35
- package/plugins/gatsby-plugin-svgr-loader/gatsby-node.js +0 -55
- package/plugins/gatsby-plugin-svgr-loader/package.json +0 -8
- package/tsconfig.commands.json +0 -36
- package/tsconfig.exporter.json +0 -21
- /package/build/commands/{prepare-assets-directory.d.ts → move-assets.d.ts} +0 -0
- /package/build/{shared → constants}/endpoints.d.ts +0 -0
- /package/build/react/{GriddoFavicon → Favicon}/utils.d.ts +0 -0
- /package/build/{shared/types → types}/templates.d.ts +0 -0
- /package/build/{core → utils}/images.d.ts +0 -0
- /package/build/{core → utils}/instance.d.ts +0 -0
- /package/exporter/react/{GriddoFavicon → Favicon}/utils.ts +0 -0
- /package/exporter/{shared/types → types}/templates.ts +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Artifacts,
|
|
3
|
+
LifeCyclesNames,
|
|
4
|
+
LifeCycleSteps,
|
|
5
|
+
} from "../../types/global";
|
|
6
|
+
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
createDistFromGatsbyPublic,
|
|
12
|
+
getGatsbyAssetPrefixWithDomain,
|
|
13
|
+
hasNewCommit,
|
|
14
|
+
runGatsbyBuildCommand,
|
|
15
|
+
updateCommitFile,
|
|
16
|
+
} from "./utils";
|
|
17
|
+
import getCxArtifacts from "../../artifacts";
|
|
18
|
+
import { AuthService } from "../../services/auth";
|
|
19
|
+
import {
|
|
20
|
+
createDomainMetadata,
|
|
21
|
+
doLifeCycle,
|
|
22
|
+
getConfig,
|
|
23
|
+
saveBuildEndLogs,
|
|
24
|
+
} from "../../utils/core-utils";
|
|
25
|
+
import { createDomainRenderData } from "../../utils/create-build-data";
|
|
26
|
+
import {
|
|
27
|
+
copyArtifacts,
|
|
28
|
+
createArtifacts,
|
|
29
|
+
deleteDisposableSiteDirs,
|
|
30
|
+
moveArtifacts,
|
|
31
|
+
removeArtifacts,
|
|
32
|
+
removeVirtualPagesFromStore,
|
|
33
|
+
renameArtifact,
|
|
34
|
+
} from "../../utils/folders";
|
|
35
|
+
import { infoLog } from "../../utils/loggin";
|
|
36
|
+
import {
|
|
37
|
+
createSentinelRenderFile,
|
|
38
|
+
deleteSentinelRenderFile,
|
|
39
|
+
isValidRender,
|
|
40
|
+
} from "../../utils/render";
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Render every instance domain with the Gatsby adapter.
|
|
44
|
+
*/
|
|
45
|
+
export async function renderDomainsWithGatsbyAdapter(domain: string) {
|
|
46
|
+
await AuthService.login();
|
|
47
|
+
const config = getConfig();
|
|
48
|
+
|
|
49
|
+
infoLog(`Initializing render for the domain ${domain}\n`);
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
//
|
|
53
|
+
__ssg,
|
|
54
|
+
__exports,
|
|
55
|
+
__cache,
|
|
56
|
+
__cx,
|
|
57
|
+
__components,
|
|
58
|
+
} = config.paths(domain);
|
|
59
|
+
|
|
60
|
+
// Griddo artifacts
|
|
61
|
+
const cxArtifacts = getCxArtifacts(domain);
|
|
62
|
+
|
|
63
|
+
// Gatsby artifacts
|
|
64
|
+
const gatsbyArtifacts: Pick<Artifacts, "disposables" | "cacheables"> = {
|
|
65
|
+
disposables: [
|
|
66
|
+
path.join(__ssg, "public"),
|
|
67
|
+
path.join(__ssg, "static"),
|
|
68
|
+
path.join(__ssg, ".cache"),
|
|
69
|
+
],
|
|
70
|
+
cacheables: [".cache"],
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// These variables are involved in the build for create the dist directory
|
|
74
|
+
// from public and pass to the gatsby-build command via spawnSync.
|
|
75
|
+
const assetPrefix = getGatsbyAssetPrefixWithDomain(domain);
|
|
76
|
+
const needsAssetPrefix = !!assetPrefix && assetPrefix !== "";
|
|
77
|
+
|
|
78
|
+
// Compose artifacts
|
|
79
|
+
const disposableArtifacts = [
|
|
80
|
+
...cxArtifacts.disposables,
|
|
81
|
+
...gatsbyArtifacts.disposables,
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
// LifeCycles
|
|
85
|
+
|
|
86
|
+
const allLifeCycles: Array<{
|
|
87
|
+
name: LifeCyclesNames;
|
|
88
|
+
steps: LifeCycleSteps;
|
|
89
|
+
}> = [
|
|
90
|
+
{
|
|
91
|
+
name: "Init",
|
|
92
|
+
steps: [() => createSentinelRenderFile()],
|
|
93
|
+
},
|
|
94
|
+
|
|
95
|
+
{
|
|
96
|
+
name: "Clean",
|
|
97
|
+
steps: [() => removeArtifacts(disposableArtifacts)],
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
{
|
|
101
|
+
name: "Prepare",
|
|
102
|
+
steps: [() => createArtifacts(cxArtifacts.initials)],
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
{
|
|
106
|
+
name: "Restore",
|
|
107
|
+
steps: [
|
|
108
|
+
() => copyArtifacts(__components, __ssg, ["static"]),
|
|
109
|
+
() => copyArtifacts(__exports, __cx, cxArtifacts.archivables),
|
|
110
|
+
() =>
|
|
111
|
+
renameArtifact(path.join(__cx, "dist"), path.join(__ssg, "public")),
|
|
112
|
+
() => moveArtifacts(__cache, __cx, cxArtifacts.cacheables),
|
|
113
|
+
() => moveArtifacts(__cache, __ssg, gatsbyArtifacts.cacheables),
|
|
114
|
+
// Remove .cache if new deploy detected
|
|
115
|
+
() => {
|
|
116
|
+
if (hasNewCommit(__cache)) {
|
|
117
|
+
if (fs.existsSync(path.join(__ssg, ".cache"))) {
|
|
118
|
+
infoLog(
|
|
119
|
+
"New deploy detected, removing Gatsby `.cache` directory to prevent data corruption",
|
|
120
|
+
);
|
|
121
|
+
fs.rmSync(path.join(__ssg, ".cache"), {
|
|
122
|
+
recursive: true,
|
|
123
|
+
force: true,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
},
|
|
130
|
+
|
|
131
|
+
{
|
|
132
|
+
name: "Data",
|
|
133
|
+
steps: [() => createDomainRenderData(domain)],
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
{
|
|
137
|
+
name: "SSG",
|
|
138
|
+
steps: [() => runGatsbyBuildCommand(assetPrefix)],
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
{
|
|
142
|
+
name: "Relocation",
|
|
143
|
+
steps: [() => createDistFromGatsbyPublic(domain, needsAssetPrefix)],
|
|
144
|
+
},
|
|
145
|
+
|
|
146
|
+
{
|
|
147
|
+
name: "Meta",
|
|
148
|
+
steps: [() => createDomainMetadata(domain), () => saveBuildEndLogs()],
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
{
|
|
152
|
+
name: "Archive",
|
|
153
|
+
steps: [
|
|
154
|
+
() => removeVirtualPagesFromStore(),
|
|
155
|
+
() => deleteDisposableSiteDirs(),
|
|
156
|
+
() =>
|
|
157
|
+
moveArtifacts(__cx, __exports, cxArtifacts.archivables, {
|
|
158
|
+
withBackup: true,
|
|
159
|
+
}),
|
|
160
|
+
() => moveArtifacts(__cx, __cache, cxArtifacts.cacheables),
|
|
161
|
+
() => moveArtifacts(__ssg, __cache, gatsbyArtifacts.cacheables),
|
|
162
|
+
],
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
{
|
|
166
|
+
name: "Close",
|
|
167
|
+
steps: [
|
|
168
|
+
() => removeArtifacts(disposableArtifacts),
|
|
169
|
+
() => updateCommitFile({ basePath: __cache }),
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
{
|
|
174
|
+
name: "HealthCheck",
|
|
175
|
+
steps: [() => isValidRender(), () => deleteSentinelRenderFile()],
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
|
|
179
|
+
for (const { name, steps } of allLifeCycles) {
|
|
180
|
+
await doLifeCycle(name, steps);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { execSync, spawnSync } from "node:child_process";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import fsx from "fs-extra";
|
|
6
|
+
|
|
7
|
+
import { envs } from "../../constants";
|
|
8
|
+
import { throwError } from "../../errors";
|
|
9
|
+
import { ErrorInSSGBuildProcess } from "../../errors/errors-data";
|
|
10
|
+
import { getConfig } from "../../utils/core-utils";
|
|
11
|
+
import { verboseLog } from "../../utils/loggin";
|
|
12
|
+
|
|
13
|
+
const config = getConfig();
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Return the assetPrefix with the domain concatenated `assetPrefix/domain` only
|
|
17
|
+
* if the domain is "pro-" **and** there is a env `GRIDDO_ASSET_PREFIX` with any
|
|
18
|
+
* value different from `null`, `undefined` or `empty string`
|
|
19
|
+
*
|
|
20
|
+
* else...
|
|
21
|
+
* - If assetPrefix or domain is falsy, returns ""
|
|
22
|
+
* - If the domain is not "pro-", returns ""
|
|
23
|
+
*/
|
|
24
|
+
function getGatsbyAssetPrefixWithDomain(domain: string) {
|
|
25
|
+
const { proDomain } = getConfig();
|
|
26
|
+
|
|
27
|
+
if (!envs.GRIDDO_ASSET_PREFIX || !domain) {
|
|
28
|
+
return "";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!domain.startsWith(proDomain)) {
|
|
32
|
+
return "";
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const assetPrefixWithDomain = `${envs.GRIDDO_ASSET_PREFIX}/${domain}`;
|
|
36
|
+
|
|
37
|
+
verboseLog(
|
|
38
|
+
`Reading process.env.GRIDDO_ASSET_PREFIX, ${envs.GRIDDO_ASSET_PREFIX}`,
|
|
39
|
+
);
|
|
40
|
+
verboseLog(
|
|
41
|
+
`Setting the asset prefix with the domain concatenated, ${assetPrefixWithDomain}`,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return assetPrefixWithDomain;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Spawn a new node process `yarn gatsby-build`
|
|
49
|
+
* @note This proccess (`yarn gatsby-build`) can not access to the custom Griddo
|
|
50
|
+
* `process.env` so it needs variables passed to it via the `env` prop.
|
|
51
|
+
*/
|
|
52
|
+
function runGatsbyBuildCommand(assetPrefixWithDomain: string) {
|
|
53
|
+
verboseLog(`read assetPrefixWithDomain, ${assetPrefixWithDomain}`);
|
|
54
|
+
verboseLog(
|
|
55
|
+
`using this NODE_OPTIONS in gatsby command: ${process.env.NODE_OPTIONS}`,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const { __ssg } = config.paths();
|
|
59
|
+
|
|
60
|
+
// Remove `--openssl-legacy-provider` from NODE_OPTIONS because this value
|
|
61
|
+
// break Gataby render.
|
|
62
|
+
const nodeOptionsWithoutLegacyOpenSSL = process.env.NODE_OPTIONS
|
|
63
|
+
? process.env.NODE_OPTIONS.replace(
|
|
64
|
+
/--openssl-legacy-provider\s*/g,
|
|
65
|
+
"",
|
|
66
|
+
).trim()
|
|
67
|
+
: "";
|
|
68
|
+
|
|
69
|
+
const command = spawnSync(
|
|
70
|
+
"yarn",
|
|
71
|
+
["gatsby-build", envs.GRIDDO_SSG_VERBOSE_LOGS ? "--verbose" : ""],
|
|
72
|
+
{
|
|
73
|
+
cwd: __ssg,
|
|
74
|
+
stdio: ["ignore", "inherit", "ignore"],
|
|
75
|
+
encoding: "utf8",
|
|
76
|
+
shell: true,
|
|
77
|
+
env: Object.assign(process.env, {
|
|
78
|
+
GRIDDO_EXPORTER: "true",
|
|
79
|
+
SPAWN_ASSET_PREFIX_WITH_DOMAIN: assetPrefixWithDomain,
|
|
80
|
+
NODE_OPTIONS: nodeOptionsWithoutLegacyOpenSSL,
|
|
81
|
+
}),
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
if (command.status !== 0) {
|
|
86
|
+
throwError(ErrorInSSGBuildProcess(command));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Update the Griddo's `/dist` dir with the contents from `public` dir only
|
|
92
|
+
* with files of type: js, json and css.
|
|
93
|
+
*/
|
|
94
|
+
async function createDistFromGatsbyPublic(
|
|
95
|
+
domain: string,
|
|
96
|
+
needsAssetPrefix: boolean,
|
|
97
|
+
) {
|
|
98
|
+
const { __cx, __ssg } = config.paths(domain);
|
|
99
|
+
|
|
100
|
+
const cxDistDir = path.join(__cx, "dist");
|
|
101
|
+
const cxAssetsDir = path.join(__cx, "assets");
|
|
102
|
+
const cxDistDirWithDomain = path.join(__cx, "dist", domain);
|
|
103
|
+
const publicDir = path.join(__ssg, "public");
|
|
104
|
+
|
|
105
|
+
const validFilesFromPublic = fsx
|
|
106
|
+
.readdirSync(publicDir)
|
|
107
|
+
.filter(
|
|
108
|
+
(file) =>
|
|
109
|
+
path.extname(file) === ".js" ||
|
|
110
|
+
path.extname(file) === ".json" ||
|
|
111
|
+
path.extname(file) === ".css",
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const pageDataSrc = `${publicDir}/page-data`;
|
|
115
|
+
const pageDataDest = `${cxAssetsDir}/page-data`;
|
|
116
|
+
|
|
117
|
+
const projectStaticSrc = path.join(__ssg, "static");
|
|
118
|
+
const projectStaticDest = cxAssetsDir;
|
|
119
|
+
|
|
120
|
+
const gatsbyStaticSrc = `${cxDistDir}/static`;
|
|
121
|
+
const gatsbyStaticDest = `${cxAssetsDir}/static`;
|
|
122
|
+
|
|
123
|
+
try {
|
|
124
|
+
fsx.mkdirSync(cxAssetsDir, { recursive: true });
|
|
125
|
+
fsx.copySync(publicDir, cxDistDir, { preserveTimestamps: true });
|
|
126
|
+
|
|
127
|
+
if (needsAssetPrefix) {
|
|
128
|
+
fsx.copySync(pageDataSrc, pageDataDest, { preserveTimestamps: true });
|
|
129
|
+
if (fsx.existsSync(projectStaticSrc)) {
|
|
130
|
+
fsx.copySync(projectStaticSrc, projectStaticDest, {
|
|
131
|
+
overwrite: false,
|
|
132
|
+
preserveTimestamps: true,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
fsx.copySync(gatsbyStaticSrc, gatsbyStaticDest, {
|
|
136
|
+
overwrite: false,
|
|
137
|
+
preserveTimestamps: true,
|
|
138
|
+
});
|
|
139
|
+
if (fsx.existsSync(projectStaticSrc)) {
|
|
140
|
+
fsx.copySync(projectStaticSrc, cxDistDirWithDomain, {
|
|
141
|
+
overwrite: false,
|
|
142
|
+
preserveTimestamps: true,
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Copia el resto de archivos...
|
|
147
|
+
validFilesFromPublic.map((file) => {
|
|
148
|
+
const fileSrc = `${publicDir}/${file}`;
|
|
149
|
+
const fileDest = `${cxAssetsDir}/${file}`;
|
|
150
|
+
fsx.copySync(fileSrc, fileDest, { preserveTimestamps: true });
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
} catch (err) {
|
|
154
|
+
console.error(err);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function hasNewCommit(basePath: string) {
|
|
159
|
+
const commitFile = path.join(basePath, "commit");
|
|
160
|
+
const currentCommit = execSync("git rev-parse HEAD").toString().trim();
|
|
161
|
+
|
|
162
|
+
if (fs.existsSync(commitFile)) {
|
|
163
|
+
const savedCommit = fs.readFileSync(commitFile, "utf-8").trim();
|
|
164
|
+
if (savedCommit === currentCommit) {
|
|
165
|
+
return false; // No hay nuevo commit
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function updateCommitFile(options: { basePath: string }) {
|
|
175
|
+
const { basePath } = options;
|
|
176
|
+
const currentCommit = execSync("git rev-parse HEAD").toString().trim();
|
|
177
|
+
fs.writeFileSync(path.join(basePath, "commit"), currentCommit);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export {
|
|
181
|
+
createDistFromGatsbyPublic,
|
|
182
|
+
getGatsbyAssetPrefixWithDomain,
|
|
183
|
+
hasNewCommit,
|
|
184
|
+
runGatsbyBuildCommand,
|
|
185
|
+
updateCommitFile,
|
|
186
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Artifacts } from "../types/global";
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
import { getConfig } from "../utils/core-utils";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the artifacts of CX.
|
|
9
|
+
*/
|
|
10
|
+
function getCxArtifacts(domain: string): Artifacts {
|
|
11
|
+
const config = getConfig();
|
|
12
|
+
const { __cx, __exports, __cache } = config.paths(domain);
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
initials: [
|
|
16
|
+
__exports, // `/exports/<domain>`
|
|
17
|
+
__cache, // `__cx/.cx-cache/<domain>`
|
|
18
|
+
path.join(__cx, "store"),
|
|
19
|
+
path.join(__cx, "apiCache"),
|
|
20
|
+
],
|
|
21
|
+
disposables: [
|
|
22
|
+
path.join(__cx, "store"),
|
|
23
|
+
path.join(__cx, "apiCache"),
|
|
24
|
+
path.join(__cx, "render-metadata.json"),
|
|
25
|
+
path.join(__cx, "dist"),
|
|
26
|
+
path.join(__cx, "debug"),
|
|
27
|
+
],
|
|
28
|
+
cacheables: ["apiCache", "store"],
|
|
29
|
+
archivables: ["dist", "assets", "debug"],
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default getCxArtifacts;
|
package/exporter/build.sh
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
1
|
+
# Build CX script file
|
|
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.
|
|
3
11
|
|
|
4
|
-
#
|
|
12
|
+
# start
|
|
13
|
+
echo "📦 Building ..."
|
|
14
|
+
|
|
15
|
+
# CLI options
|
|
5
16
|
log="--log-level=error"
|
|
6
|
-
production_node_opts="--bundle --platform=node --minify --sourcemap
|
|
7
|
-
debugging_node_opts="--bundle --platform=node --sourcemap
|
|
17
|
+
production_node_opts="--bundle --platform=node --minify --sourcemap"
|
|
18
|
+
debugging_node_opts="--bundle --platform=node --sourcemap"
|
|
8
19
|
react_opts="--platform=node --external:@griddo-instance --external:react --external:react-dom --bundle --minify"
|
|
9
20
|
|
|
10
21
|
# Manage --minify for debugging
|
|
@@ -14,18 +25,15 @@ if [ "$1" = "--debug" ]; then
|
|
|
14
25
|
fi
|
|
15
26
|
|
|
16
27
|
# library
|
|
17
|
-
esbuild ${log} ./exporter/index.ts
|
|
28
|
+
esbuild ${log} ./exporter/index.ts ${bundle_node_opts} --outfile=./build/index.js
|
|
18
29
|
esbuild ${log} ./exporter/react/index.tsx ${react_opts} --outfile=./build/react/index.js
|
|
19
30
|
|
|
20
|
-
#
|
|
21
|
-
esbuild ${log} ./exporter/commands/end-render.ts ${bundle_node_opts}end-render.js
|
|
22
|
-
esbuild ${log} ./exporter/commands/upload-search-content.ts ${bundle_node_opts}upload-search-content.js
|
|
23
|
-
esbuild ${log} ./exporter/commands/reset-render.ts ${bundle_node_opts}reset-render.js
|
|
24
|
-
esbuild ${log} ./exporter/commands/start-render.ts ${bundle_node_opts}start-render.js
|
|
25
|
-
esbuild ${log} ./exporter/commands/prepare-domains-render.ts ${bundle_node_opts}prepare-domains-render.js
|
|
26
|
-
esbuild ${log} ./exporter/commands/prepare-assets-directory.ts ${bundle_node_opts}prepare-assets-directory.js
|
|
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
|
|
27
37
|
|
|
28
38
|
# types
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
echo "Build completed successfully!"
|
|
39
|
+
tsc --emitDeclarationOnly --declaration --outDir build --project tsconfig.exporter.json
|
|
@@ -1,84 +1,105 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from "node:fs";
|
|
2
4
|
import path from "node:path";
|
|
3
5
|
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import { GriddoLog } from "../core/GriddoLog";
|
|
6
|
+
import pkgDir from "pkg-dir";
|
|
7
|
+
|
|
7
8
|
import { AuthService } from "../services/auth";
|
|
8
|
-
import { getInstanceDomains } from "../services/domains";
|
|
9
|
-
import {
|
|
10
|
-
getRenderMetadataFromDB,
|
|
11
|
-
getRenderModeFromDB,
|
|
12
|
-
getRenderPathsHydratedWithDomainFromDB,
|
|
13
|
-
} from "../services/render";
|
|
14
9
|
import { endSiteRender } from "../services/sites";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
10
|
+
import { getConfig } from "../utils/core-utils";
|
|
11
|
+
import { getInstanceDomains } from "../utils/domains";
|
|
12
|
+
import { infoLog } from "../utils/loggin";
|
|
13
|
+
|
|
14
|
+
const RENDER_BY_DOMAIN = process.env.GRIDDO_RENDER_BY_DOMAINS || "";
|
|
15
|
+
|
|
16
|
+
// Where we are going to find export dirs
|
|
17
|
+
const execBasePath = pkgDir.sync(path.resolve(__dirname, "../.."))!;
|
|
18
|
+
|
|
19
|
+
// Where we are going to find archived exports
|
|
20
|
+
const exportArchiveBasePath = path.resolve(execBasePath, "exports/sites");
|
|
21
|
+
|
|
22
|
+
type Report = {
|
|
23
|
+
authControl:
|
|
24
|
+
| {
|
|
25
|
+
Authorization: string;
|
|
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.`);
|
|
30
52
|
}
|
|
31
53
|
|
|
32
|
-
|
|
33
|
-
}
|
|
54
|
+
const buildReport = JSON.parse(fs.readFileSync(buildReportFile, "utf-8"));
|
|
34
55
|
|
|
35
|
-
|
|
36
|
-
const { buildReportFileName } = await getRenderMetadataFromDB();
|
|
37
|
-
const { __sites } = await getRenderPathsHydratedWithDomainFromDB();
|
|
56
|
+
reports.push(buildReport);
|
|
38
57
|
|
|
39
|
-
|
|
58
|
+
return reports;
|
|
59
|
+
}
|
|
40
60
|
|
|
41
|
-
|
|
61
|
+
(async () => {
|
|
62
|
+
const sendEndSiteRender = async (reports: Array<Report>) => {
|
|
63
|
+
for (const report of reports) {
|
|
64
|
+
const sites = report.sites;
|
|
42
65
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
domains.push(domainName);
|
|
46
|
-
} else {
|
|
47
|
-
GriddoLog.warn("Legacy Render Mode");
|
|
48
|
-
domains = await getInstanceDomains();
|
|
49
|
-
}
|
|
66
|
+
for (const site of sites) {
|
|
67
|
+
const { siteId, ...body } = site;
|
|
50
68
|
|
|
51
|
-
|
|
52
|
-
const { renderMode, reason } = await getRenderModeFromDB(domain);
|
|
69
|
+
console.info(`Site (${siteId})`);
|
|
53
70
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`(From Current Render) [${domain}]: Skipping end-render as it is marked as IDLE with the reason ${reason}.`,
|
|
57
|
-
);
|
|
58
|
-
continue;
|
|
71
|
+
await endSiteRender(siteId, body);
|
|
72
|
+
}
|
|
59
73
|
}
|
|
74
|
+
};
|
|
60
75
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
GriddoLog.info(`Sending ending call to ${domain} sites`);
|
|
76
|
+
if (RENDER_BY_DOMAIN) {
|
|
77
|
+
await AuthService.login();
|
|
78
|
+
const domain = process.argv.splice(2)[0];
|
|
79
|
+
const reports = getDomainRenderReport(domain);
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
site.publishHashes = [...new Set(site.publishHashes)];
|
|
71
|
-
site.unpublishHashes = [...new Set(site.unpublishHashes)];
|
|
81
|
+
infoLog(`Sending ending call to ${domain} sites`);
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
83
|
+
for (const report of reports) {
|
|
84
|
+
for (const site of report.sites) {
|
|
85
|
+
site.publishHashes = [...new Set(site.publishHashes)];
|
|
86
|
+
site.unpublishHashes = [...new Set(site.unpublishHashes)];
|
|
87
|
+
}
|
|
76
88
|
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
89
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
await sendEndSiteRender(reports);
|
|
91
|
+
} else {
|
|
92
|
+
// Legacy render
|
|
93
|
+
const domains = await getInstanceDomains();
|
|
94
|
+
for (const domain of domains) {
|
|
95
|
+
const reports = getDomainRenderReport(domain);
|
|
83
96
|
|
|
84
|
-
|
|
97
|
+
infoLog(`Sending ending call to ${domain} sites`);
|
|
98
|
+
|
|
99
|
+
await sendEndSiteRender(reports);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
})().catch((err) => {
|
|
103
|
+
console.error("Error", err?.stdout?.toString() || err);
|
|
104
|
+
process.exit(1);
|
|
105
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
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}`);
|