@griddo/cx 10.4.20 → 10.4.22

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.
@@ -1,10 +1,15 @@
1
1
  import { CXConfig } from "../types/global";
2
+ declare const attempts: {
3
+ prepare: any;
4
+ restore: any;
5
+ data: any;
6
+ ssg: any;
7
+ relocation: any;
8
+ meta: any;
9
+ archive: any;
10
+ clean: any;
11
+ };
2
12
  declare function getConfig(): CXConfig;
3
- /**
4
- * Update the Griddo's `/dist` dir with the contents from `public` dir only
5
- * with files of type: js, json and css.
6
- */
7
- declare function legacy__createDistFromGatsbyPublic(domain: string, needsAssetPrefix: boolean): Promise<void>;
8
13
  declare function griddoCreateInitialDirectories(domain: string): Promise<void>;
9
14
  declare function griddoCleanDisposableDirectories(domain: string): Promise<void>;
10
- export { getConfig, griddoCleanDisposableDirectories, griddoCreateInitialDirectories, legacy__createDistFromGatsbyPublic, };
15
+ export { attempts, getConfig, griddoCleanDisposableDirectories, griddoCreateInitialDirectories, };
@@ -1,8 +1,11 @@
1
- import { spawnSync } from "node:child_process";
2
1
  import fs from "node:fs";
3
2
  import path from "node:path";
4
3
 
5
- import { attempts, getGatsbyAssetPrefixSlug } from "./utils";
4
+ import {
5
+ gatsbyBuild,
6
+ getGatsbyAssetPrefixWithDomain,
7
+ legacy__createDistFromGatsbyPublic,
8
+ } from "./utils";
6
9
  import { RobotsService } from "../../services/robots";
7
10
  import { createBuildData } from "../../utils/create-build-data";
8
11
  import { getInstanceDomains } from "../../utils/domains";
@@ -21,10 +24,7 @@ import {
21
24
  printExporterLogo,
22
25
  } from "../../utils/shared";
23
26
  import { generateBuildReport, generateSitemaps } from "../../utils/sites";
24
- import {
25
- getConfig,
26
- legacy__createDistFromGatsbyPublic,
27
- } from "../../utils/temp-utils";
27
+ import { attempts, getConfig } from "../../utils/temp-utils";
28
28
 
29
29
  async function runGatsbyAdapter() {
30
30
  printExporterLogo("gatsby");
@@ -39,7 +39,9 @@ async function runGatsbyAdapter() {
39
39
 
40
40
  logBox(`Initializing render for the domain ${domain}`, "", 1, 0);
41
41
 
42
- const assetPrefix = getGatsbyAssetPrefixSlug(domain);
42
+ // This variables are for both, create the dist directory from public
43
+ // and pass to the gatsby-build command via spawnSync.
44
+ const assetPrefix = getGatsbyAssetPrefixWithDomain(domain);
43
45
  const needsAssetPrefix = !!assetPrefix && assetPrefix !== "";
44
46
 
45
47
  /*
@@ -120,27 +122,7 @@ async function runGatsbyAdapter() {
120
122
  await doLifeCycle({
121
123
  name: "SSG",
122
124
  attempts: attempts.ssg,
123
- steps: [
124
- () => {
125
- // Run Gatsby
126
- const render = spawnSync("yarn", ["gatsby-build"], {
127
- cwd: __ssg,
128
- stdio: ["ignore", "inherit", "ignore"],
129
- encoding: "utf8",
130
- shell: true,
131
- env: Object.assign(process.env, {
132
- GRIDDO_EXPORTER: "true",
133
- GRIDDO_ASSET_PREFIX: assetPrefix,
134
- }),
135
- });
136
-
137
- // @todo gestionar esto desde doLifeCycle.
138
- if (render.status !== 0) {
139
- throw new Error("Error in 'yarn gatsby-build'");
140
- }
141
- },
142
- () => pause("SSG LifeCycle"),
143
- ],
125
+ steps: [() => gatsbyBuild(assetPrefix), () => pause("SSG LifeCycle")],
144
126
  });
145
127
 
146
128
  /*
@@ -148,6 +130,7 @@ async function runGatsbyAdapter() {
148
130
  */
149
131
  await doLifeCycle({
150
132
  name: "Relocation",
133
+ attempts: attempts.relocation,
151
134
  steps: [
152
135
  () => legacy__createDistFromGatsbyPublic(domain, needsAssetPrefix),
153
136
  () => pause("Relocation LifeCycle"),
@@ -201,11 +184,11 @@ async function runGatsbyAdapter() {
201
184
  */
202
185
  await doLifeCycle({
203
186
  name: "Clean",
187
+ attempts: attempts.clean,
204
188
  steps: [
205
189
  () => removeDirsSync(__ssg, ["static", "public", "dist"]),
206
190
  () => pause("Clean LifeCycle"),
207
191
  ],
208
- attempts: attempts.clean,
209
192
  });
210
193
  }
211
194
  }
@@ -1,27 +1,27 @@
1
- import { Fields } from "@griddo/core";
1
+ import type { Fields } from "@griddo/core";
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import path from "node:path";
5
+
2
6
  import dotenv from "dotenv";
7
+ import fsx from "fs-extra";
3
8
 
4
9
  import { getConfig } from "../../utils/temp-utils";
5
10
 
6
11
  dotenv.config();
7
12
 
8
- const attempts = {
9
- prepare: JSON.parse(process.env.GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS || "1"),
10
- restore: JSON.parse(process.env.GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS || "1"),
11
- data: JSON.parse(process.env.GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS || "1"),
12
- ssg: JSON.parse(process.env.GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS || "1"),
13
- relocation: JSON.parse(
14
- process.env.GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS || "1"
15
- ),
16
- meta: JSON.parse(process.env.GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS || "1"),
17
- archive: JSON.parse(process.env.GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS || "1"),
18
- clean: JSON.parse(process.env.GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS || "1"),
19
- };
13
+ const config = getConfig();
20
14
 
21
15
  /**
22
- * Return the assetPrefix url `assetPrefix/domain`
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
23
  */
24
- function getGatsbyAssetPrefixSlug(domain: string) {
24
+ function getGatsbyAssetPrefixWithDomain(domain: string) {
25
25
  const { proDomain } = getConfig();
26
26
  const assetPrefix =
27
27
  process.env.GRIDDO_ASSET_PREFIX || process.env.ASSET_PREFIX;
@@ -29,6 +29,18 @@ function getGatsbyAssetPrefixSlug(domain: string) {
29
29
  if (!assetPrefix || !domain) return "";
30
30
  if (!domain.startsWith(proDomain)) return "";
31
31
 
32
+ if (process.env.GRIDDO_DEBUG_LOGS) {
33
+ console.log();
34
+ console.log("-- getGatsbyAssetPrefixWithDomain() --");
35
+ console.log(
36
+ "process.env.GRIDDO_ASSET_PREFIX",
37
+ process.env.GRIDDO_ASSET_PREFIX
38
+ );
39
+ console.log("assetPrefix", assetPrefix);
40
+ console.log("return", `${assetPrefix}/${domain}`);
41
+ console.log();
42
+ }
43
+
32
44
  return `${assetPrefix}/${domain}`;
33
45
  }
34
46
 
@@ -82,4 +94,100 @@ function addCloudinaryParams(image: string, params: string) {
82
94
  return `https://${head}/${params}${fullId}`;
83
95
  }
84
96
 
85
- export { attempts, formatImage, getGatsbyAssetPrefixSlug };
97
+ /**
98
+ * Spawn a new node process `yarn gatsby-build`
99
+ * @note This proccess (`yarn gatsby-build`) can not access to the custom Griddo
100
+ * `process.env` so it needs variables passed to it via the `env` prop.
101
+ */
102
+ function gatsbyBuild(assetPrefixWithDomain: string) {
103
+ if (process.env.GRIDDO_DEBUG_LOGS) {
104
+ console.log("-- gatsbyBuild() --");
105
+ console.log("assetPrefixWithDomain", assetPrefixWithDomain);
106
+ }
107
+
108
+ const { __ssg } = config.paths();
109
+
110
+ const command = spawnSync("yarn", ["gatsby-build"], {
111
+ cwd: __ssg,
112
+ stdio: ["ignore", "inherit", "ignore"],
113
+ encoding: "utf8",
114
+ shell: true,
115
+ env: Object.assign(process.env, {
116
+ GRIDDO_EXPORTER: "true",
117
+ SPAWN_ASSET_PREFIX_WITH_DOMAIN: assetPrefixWithDomain,
118
+ }),
119
+ });
120
+
121
+ if (command.status !== 0) {
122
+ throw new Error("Error in 'yarn gatsby-build'");
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Update the Griddo's `/dist` dir with the contents from `public` dir only
128
+ * with files of type: js, json and css.
129
+ */
130
+ async function legacy__createDistFromGatsbyPublic(
131
+ domain: string,
132
+ needsAssetPrefix: boolean
133
+ ) {
134
+ const { __cx, __ssg } = config.paths(domain);
135
+
136
+ const cxDistDir = path.join(__cx, "dist");
137
+ const cxAssetsDir = path.join(__cx, "assets");
138
+ const cxDistDirWithDomain = path.join(__cx, "dist", domain);
139
+ const publicDir = path.join(__ssg, "public");
140
+
141
+ console.log(publicDir);
142
+ const validFilesFromPublic = fsx
143
+ .readdirSync(publicDir)
144
+ .filter(
145
+ (file) =>
146
+ path.extname(file) === ".js" ||
147
+ path.extname(file) === ".json" ||
148
+ path.extname(file) === ".css"
149
+ );
150
+
151
+ const pageDataSrc = `${publicDir}/page-data`;
152
+ const pageDataDest = `${cxAssetsDir}/page-data`;
153
+
154
+ const projectStaticSrc = path.join(__ssg, "static");
155
+ const projectStaticDest = cxAssetsDir;
156
+
157
+ const gatsbyStaticSrc = `${cxDistDir}/static`;
158
+ const gatsbyStaticDest = `${cxAssetsDir}/static`;
159
+
160
+ try {
161
+ fsx.mkdirSync(cxAssetsDir, { recursive: true });
162
+ fsx.copySync(publicDir, cxDistDir);
163
+
164
+ if (needsAssetPrefix) {
165
+ fsx.copySync(pageDataSrc, pageDataDest);
166
+ if (fsx.existsSync(projectStaticSrc)) {
167
+ fsx.copySync(projectStaticSrc, projectStaticDest, { overwrite: false });
168
+ }
169
+ fsx.copySync(gatsbyStaticSrc, gatsbyStaticDest, { overwrite: false });
170
+ if (fsx.existsSync(projectStaticSrc)) {
171
+ fsx.copySync(projectStaticSrc, cxDistDirWithDomain, {
172
+ overwrite: false,
173
+ });
174
+ }
175
+
176
+ // Copia el resto de archivos...
177
+ validFilesFromPublic.map(async (file) => {
178
+ const fileSrc = `${publicDir}/${file}`;
179
+ const fileDest = `${cxAssetsDir}/${file}`;
180
+ fsx.copySync(fileSrc, fileDest);
181
+ });
182
+ }
183
+ } catch (err) {
184
+ console.error(err);
185
+ }
186
+ }
187
+
188
+ export {
189
+ formatImage,
190
+ gatsbyBuild,
191
+ getGatsbyAssetPrefixWithDomain,
192
+ legacy__createDistFromGatsbyPublic,
193
+ };
@@ -1,4 +1,4 @@
1
- import { Core } from "@griddo/core";
1
+ import type { Core } from "@griddo/core";
2
2
 
3
3
  function filterBodyIntegrationFromPosition(
4
4
  integrations: Array<Core.PageIntegration>,
@@ -34,15 +34,15 @@ type Report = {
34
34
  export async function buildComplete(report: Report) {
35
35
  await AuthService.login();
36
36
 
37
- const promises = report.sites.map((site) => {
37
+ const sites = report.sites;
38
+
39
+ for (const site of sites) {
38
40
  const { siteId, ...body } = site;
39
41
 
40
42
  console.info(`Deploying ending call to site ${siteId}:`);
41
43
 
42
- return SitesService.endSiteRender(siteId, body);
43
- });
44
-
45
- await Promise.all(promises);
44
+ await SitesService.endSiteRender(siteId, body);
45
+ }
46
46
 
47
47
  console.info(`Build end's signal sent for ${report.sites.length} site(s)`);
48
48
  }
@@ -0,0 +1,2 @@
1
+ // noop
2
+ export const noop = true;
@@ -5,8 +5,7 @@ import { runGatsbyAdapter } from "./adapters";
5
5
  import { logBox, measureExecutionTime } from "./utils/shared";
6
6
 
7
7
  async function startRender() {
8
- const exeTime = await measureExecutionTime(runGatsbyAdapter).catch((e) => {
9
- console.log(e);
8
+ const exeTime = await measureExecutionTime(runGatsbyAdapter).catch(() => {
10
9
  console.log("<[ Render will be reset ]>");
11
10
  process.exit(1);
12
11
  });
@@ -346,7 +346,12 @@ async function doLifeCycle(args: {
346
346
  // if no errors, go out!! :)
347
347
  break;
348
348
  } catch (error) {
349
- console.log(`Error in ${name}. Attempt (${trysCount + 1})`);
349
+ const errorString = chalk.bgRed.black(` Error in ${name} LifeCycle `);
350
+ const attemptsString = chalk.yellow(`Attempt (${trysCount + 1})`);
351
+ console.log(`\n${errorString} ${attemptsString}\n`);
352
+ console.log(error);
353
+ console.log();
354
+
350
355
  trysCount++;
351
356
  }
352
357
  }
@@ -1,12 +1,23 @@
1
- import path from "node:path";
2
-
3
- import fsx from "fs-extra";
1
+ import dotenv from "dotenv";
4
2
 
5
3
  import { createDirsSync, removeDirsSync } from "./folders";
6
4
  import { CXConfig } from "../types/global";
7
-
5
+ dotenv.config();
8
6
  const config = getConfig();
9
7
 
8
+ const attempts = {
9
+ prepare: JSON.parse(process.env.GRIDDO_PREPARE_LIFECYCLE_MAX_ATTEMPTS || "1"),
10
+ restore: JSON.parse(process.env.GRIDDO_RESTORE_LIFECYCLE_MAX_ATTEMPTS || "1"),
11
+ data: JSON.parse(process.env.GRIDDO_DATA_LIFECYCLE_MAX_ATTEMPTS || "1"),
12
+ ssg: JSON.parse(process.env.GRIDDO_SSG_LIFECYCLE_MAX_ATTEMPTS || "1"),
13
+ relocation: JSON.parse(
14
+ process.env.GRIDDO_RELOCATION_LIFECYCLE_MAX_ATTEMPTS || "1"
15
+ ),
16
+ meta: JSON.parse(process.env.GRIDDO_META_LIFECYCLE_MAX_ATTEMPTS || "1"),
17
+ archive: JSON.parse(process.env.GRIDDO_ARCHIVE_LIFECYCLE_MAX_ATTEMPTS || "1"),
18
+ clean: JSON.parse(process.env.GRIDDO_CLEAN_LIFECYCLE_MAX_ATTEMPTS || "1"),
19
+ };
20
+
10
21
  function getConfig(): CXConfig {
11
22
  try {
12
23
  // eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require, node/no-unpublished-require
@@ -20,68 +31,6 @@ function getConfig(): CXConfig {
20
31
  }
21
32
  }
22
33
 
23
- /**
24
- * Update the Griddo's `/dist` dir with the contents from `public` dir only
25
- * with files of type: js, json and css.
26
- */
27
- async function legacy__createDistFromGatsbyPublic(
28
- domain: string,
29
- needsAssetPrefix: boolean
30
- ) {
31
- const { __cx, __ssg } = config.paths(domain);
32
-
33
- const cxDistDir = path.join(__cx, "dist");
34
- const cxAssetsDir = path.join(__cx, "assets");
35
- const cxDistDirWithDomain = path.join(__cx, "dist", domain);
36
- const publicDir = path.join(__ssg, "public");
37
-
38
- console.log(publicDir);
39
- const validFilesFromPublic = fsx
40
- .readdirSync(publicDir)
41
- .filter(
42
- (file) =>
43
- path.extname(file) === ".js" ||
44
- path.extname(file) === ".json" ||
45
- path.extname(file) === ".css"
46
- );
47
-
48
- const pageDataSrc = `${publicDir}/page-data`;
49
- const pageDataDest = `${cxAssetsDir}/page-data`;
50
-
51
- const projectStaticSrc = path.join(__ssg, "static");
52
- const projectStaticDest = cxAssetsDir;
53
-
54
- const gatsbyStaticSrc = `${cxDistDir}/static`;
55
- const gatsbyStaticDest = `${cxAssetsDir}/static`;
56
-
57
- try {
58
- fsx.mkdirSync(cxAssetsDir, { recursive: true });
59
- fsx.copySync(publicDir, cxDistDir);
60
-
61
- if (needsAssetPrefix) {
62
- fsx.copySync(pageDataSrc, pageDataDest);
63
- if (fsx.existsSync(projectStaticSrc)) {
64
- fsx.copySync(projectStaticSrc, projectStaticDest, { overwrite: false });
65
- }
66
- fsx.copySync(gatsbyStaticSrc, gatsbyStaticDest, { overwrite: false });
67
- if (fsx.existsSync(projectStaticSrc)) {
68
- fsx.copySync(projectStaticSrc, cxDistDirWithDomain, {
69
- overwrite: false,
70
- });
71
- }
72
-
73
- // Copia el resto de archivos...
74
- validFilesFromPublic.map(async (file) => {
75
- const fileSrc = `${publicDir}/${file}`;
76
- const fileDest = `${cxAssetsDir}/${file}`;
77
- fsx.copySync(fileSrc, fileDest);
78
- });
79
- }
80
- } catch (err) {
81
- console.error(err);
82
- }
83
- }
84
-
85
34
  async function griddoCreateInitialDirectories(domain: string) {
86
35
  const { __exports, __caches } = config.paths(domain);
87
36
 
@@ -96,8 +45,8 @@ async function griddoCleanDisposableDirectories(domain: string) {
96
45
  }
97
46
 
98
47
  export {
48
+ attempts,
99
49
  getConfig,
100
50
  griddoCleanDisposableDirectories,
101
51
  griddoCreateInitialDirectories,
102
- legacy__createDistFromGatsbyPublic,
103
52
  };
package/gatsby-config.ts CHANGED
@@ -6,9 +6,22 @@ import { resolveComponentsPath } from "./build";
6
6
 
7
7
  dotenv.config();
8
8
 
9
- // Este process.env.GRIDDO_ASSET_PREFIX se lee porque se ha introducido en
10
- // `getEnvRunner()`.
11
- const GRIDDO_ASSET_PREFIX = process.env.GRIDDO_ASSET_PREFIX || undefined;
9
+ // Este process.env.SPAWN_ASSET_PREFIX_WITH_DOMAIN se lee porque
10
+ // se ha introducido en el spawnSync.
11
+ // @todo quiar el `... || undefined`
12
+ const griddoAssetPrefixWithDomain =
13
+ process.env.SPAWN_ASSET_PREFIX_WITH_DOMAIN || undefined;
14
+
15
+ if (process.env.GRIDDO_DEBUG_LOGS) {
16
+ console.log();
17
+ console.log("-- gatsby-config.ts --");
18
+ console.log(
19
+ "process.env.SPAWN_ASSET_PREFIX_WITH_DOMAIN",
20
+ process.env.SPAWN_ASSET_PREFIX_WITH_DOMAIN
21
+ );
22
+ console.log("griddoAssetPrefixWithDomain", griddoAssetPrefixWithDomain);
23
+ console.log();
24
+ }
12
25
 
13
26
  // Gatsby configuration file from client
14
27
  // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -40,8 +53,8 @@ const config: GatsbyConfig = {
40
53
  ],
41
54
  };
42
55
 
43
- if (GRIDDO_ASSET_PREFIX) {
44
- config.assetPrefix = GRIDDO_ASSET_PREFIX;
56
+ if (griddoAssetPrefixWithDomain) {
57
+ config.assetPrefix = griddoAssetPrefixWithDomain;
45
58
  // @ts-expect-error Must be null to exist, but must be different from assetPrefix
46
59
  config.pathPrefix = null;
47
60
  }
package/gatsby-node.ts CHANGED
@@ -5,31 +5,46 @@ import path from "node:path";
5
5
 
6
6
  import { getConfig, logInfo, logPageSize } from "./build";
7
7
  import { getBuildPagesFromStore } from "./exporter/utils/store";
8
- import { getMatchPath } from "./src/gatsby-node-utils";
9
8
 
10
- const GRIDDO_BUILD_LOGS = JSON.parse(process.env.GRIDDO_BUILD_LOGS || "false");
9
+ const griddoBuildLogs = JSON.parse(process.env.GRIDDO_BUILD_LOGS || "false");
10
+ const assetPrefixWithDomain = process.env.SPAWN_ASSET_PREFIX_WITH_DOMAIN;
11
+ const needsAssetDomainPrefix =
12
+ !!assetPrefixWithDomain && assetPrefixWithDomain !== "";
13
+
14
+ if (process.env.GRIDDO_DEBUG_LOGS) {
15
+ console.log();
16
+ console.log("-- gatsby-node.ts --");
17
+ console.log("assetPrefixWithDomain", assetPrefixWithDomain);
18
+ console.log("needsAssetDomainPrefix", needsAssetDomainPrefix);
19
+ console.log();
20
+ }
11
21
 
12
22
  const { __ssg } = getConfig().paths();
13
23
  const template = path.join(__ssg, "src/components/template.tsx");
14
24
  const pages = getBuildPagesFromStore<GatsbyPageObject>({
15
- withSizeProp: GRIDDO_BUILD_LOGS,
25
+ withSizeProp: griddoBuildLogs,
16
26
  });
17
27
 
18
28
  const createPages: GatsbyNode["createPages"] = async ({ actions }) => {
19
29
  for await (const page of pages) {
20
30
  if (!page) return;
21
31
 
22
- const matchPath = getMatchPath(
23
- page.context.fullPath.domain,
24
- page.context.fullPath.compose
25
- );
26
-
27
32
  page.component = template;
28
- page.matchPath = matchPath;
33
+ page.matchPath = needsAssetDomainPrefix
34
+ ? page.context.fullPath.compose
35
+ : "";
36
+
37
+ if (process.env.GRIDDO_DEBUG_LOGS) {
38
+ console.log("-- createPages --");
39
+ console.log(
40
+ "matchPath",
41
+ needsAssetDomainPrefix ? page.context.fullPath.compose : ""
42
+ );
43
+ }
29
44
 
30
45
  actions.createPage(page);
31
46
 
32
- if (GRIDDO_BUILD_LOGS) {
47
+ if (griddoBuildLogs) {
33
48
  const path = page.path;
34
49
  const id = page.context.id;
35
50
  const size = logPageSize(Math.round(page.size || 0));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/cx",
3
3
  "description": "Griddo SSG based on Gatsby",
4
- "version": "10.4.20",
4
+ "version": "10.4.22",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -45,7 +45,7 @@
45
45
  "@babel/preset-env": "^7.14.5",
46
46
  "@babel/preset-react": "^7.14.5",
47
47
  "@babel/preset-typescript": "^7.16.5",
48
- "@griddo/core": "^10.4.20",
48
+ "@griddo/core": "^10.4.22",
49
49
  "@svgr/webpack": "^5.5.0",
50
50
  "@types/cheerio": "^0.22.35",
51
51
  "babel-loader": "^8.0.6",
@@ -120,5 +120,5 @@
120
120
  "resolutions": {
121
121
  "memoizee": "0.4.15"
122
122
  },
123
- "gitHead": "8e355cb3ed943e2677b8b4065c148e30220e0958"
123
+ "gitHead": "dcf2ff097694c07588c2fc14c0e5934d2d675220"
124
124
  }
@@ -1,6 +1,7 @@
1
1
  import type { TemplateProps } from "../types";
2
+ import type { Core } from "@griddo/core";
2
3
 
3
- import { Core, Page as RenderGriddoPage } from "@griddo/core";
4
+ import { Page as RenderGriddoPage } from "@griddo/core";
4
5
  import { components, SiteProvider, templates } from "@griddo-instance";
5
6
  import { Link, navigate } from "gatsby";
6
7
  import parse from "html-react-parser";
@@ -2,12 +2,11 @@ import type { GatsbyNode } from "gatsby";
2
2
 
3
3
  import fs from "fs-extra";
4
4
 
5
- import { getConfig } from "../build";
6
5
  import {
7
6
  IS_COMPONENT_LIBRARY,
8
7
  PROJECT_ALIASES,
9
8
  resolveComponentsPath,
10
- } from "../exporter/utils/instance";
9
+ } from "../build";
11
10
 
12
11
  /**
13
12
  * Copy the instance's `/static` dir into the Gatsby's to include it in the render assets.
@@ -72,29 +71,4 @@ const onCreateWebpackConfig: GatsbyNode["onCreateWebpackConfig"] = ({
72
71
  }
73
72
  };
74
73
 
75
- function getGatsbyAssetPrefixSlug(domain: string) {
76
- const { proDomain } = getConfig();
77
-
78
- const assetPrefix =
79
- process.env.GRIDDO_ASSET_PREFIX || process.env.ASSET_PREFIX;
80
- if (!assetPrefix || !domain) return "";
81
- if (!domain.startsWith(proDomain)) return "";
82
-
83
- return `${assetPrefix}/${domain}`;
84
- }
85
-
86
- function getMatchPath(domain: string, compose: string) {
87
- const domainWithNoSlashes = domain.replace("/", "");
88
- const assetPrefix = getGatsbyAssetPrefixSlug(domainWithNoSlashes);
89
- const needsAssetDomainPrefix = assetPrefix && assetPrefix !== "";
90
- const matchPath = needsAssetDomainPrefix ? compose : "";
91
-
92
- return matchPath;
93
- }
94
-
95
- export {
96
- getGatsbyAssetPrefixSlug,
97
- getMatchPath,
98
- onCreateWebpackConfig,
99
- prepareStaticDir,
100
- };
74
+ export { onCreateWebpackConfig, prepareStaticDir };
package/src/types.ts CHANGED
@@ -1,15 +1,14 @@
1
- import type { Core } from "@griddo/core";
2
- import type { HeadProps } from "gatsby";
3
-
4
- import { SocialsResponse } from "../build";
5
- import {
1
+ import type {
6
2
  AdditionalInfo,
7
3
  GriddoListPage,
8
4
  GriddoMultiPage,
9
5
  GriddoPageObject,
10
6
  GriddoSinglePage,
11
- } from "../exporter/types/pages";
12
- import { Site } from "../exporter/types/sites";
7
+ Site,
8
+ SocialsResponse,
9
+ } from "../build";
10
+ import type { Core } from "@griddo/core";
11
+ import type { HeadProps } from "gatsby";
13
12
 
14
13
  interface CustomHeadProps extends HeadProps {
15
14
  pageContext: GriddoPageObject["context"] & {