@griddo/cx 10.4.19 → 10.4.21
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 +11 -76
- package/build/adapters/gatsby/index.d.ts +2 -0
- package/build/adapters/gatsby/utils.d.ts +27 -0
- package/build/adapters/index.d.ts +3 -0
- package/build/browser/index.d.ts +5 -0
- package/build/build-complete.d.ts +18 -0
- package/build/build-complete.js +22 -22
- package/build/errors/index.d.ts +1 -0
- package/build/index.d.ts +29 -0
- package/build/index.js +37 -35
- package/build/move-assets.d.ts +1 -0
- package/build/react/index.d.ts +2 -0
- package/build/reset-render.d.ts +1 -0
- package/build/reset-render.js +22 -22
- package/build/run-start-render.d.ts +1 -0
- package/build/run-start-render.js +37 -35
- package/build/services/auth.d.ts +21 -0
- package/build/services/distributors.d.ts +45 -0
- package/build/services/domains.d.ts +8 -0
- package/build/services/navigation.d.ts +77 -0
- package/build/services/robots.d.ts +21 -0
- package/build/services/settings.d.ts +23 -0
- package/build/services/sites.d.ts +42 -0
- package/build/services/store.d.ts +6 -0
- package/build/start-render.d.ts +3 -0
- package/build/start-render.js +37 -35
- package/build/types/api.d.ts +130 -0
- package/build/types/global.d.ts +78 -0
- package/build/types/navigation.d.ts +28 -0
- package/build/types/pages.d.ts +128 -0
- package/build/types/sites.d.ts +43 -0
- package/build/types/templates.d.ts +8 -0
- package/build/upload-search-content.d.ts +1 -0
- package/build/upload-search-content.js +21 -21
- package/build/utils/api.d.ts +23 -0
- package/build/utils/cache.d.ts +35 -0
- package/build/utils/create-build-data.d.ts +8 -0
- package/build/utils/domains.d.ts +5 -0
- package/build/utils/folders.d.ts +48 -0
- package/build/utils/health-checks.d.ts +7 -0
- package/build/utils/instance.d.ts +21 -0
- package/build/utils/messages.d.ts +2 -0
- package/build/utils/pages.d.ts +34 -0
- package/build/utils/searches.d.ts +14 -0
- package/build/utils/shared.d.ts +110 -0
- package/build/utils/sites.d.ts +36 -0
- package/build/utils/store.d.ts +79 -0
- package/build/utils/temp-utils.d.ts +10 -0
- package/cx.config.js +1 -1
- package/exporter/adapters/gatsby/index.ts +6 -20
- package/exporter/adapters/gatsby/utils.ts +25 -1
- package/exporter/errors/index.ts +2 -0
- package/exporter/index.ts +6 -4
- package/exporter/services/robots.ts +4 -3
- package/exporter/services/store.ts +13 -4
- package/exporter/start-render.ts +1 -2
- package/exporter/types/global.ts +1 -1
- package/exporter/utils/cache.ts +25 -11
- package/exporter/utils/create-build-data.ts +3 -10
- package/exporter/utils/folders.ts +14 -15
- package/exporter/utils/searches.ts +4 -4
- package/exporter/utils/shared.ts +18 -8
- package/exporter/utils/sites.ts +10 -10
- package/exporter/utils/store.ts +77 -27
- package/exporter/utils/temp-utils.ts +12 -11
- package/gatsby-config.ts +2 -2
- package/gatsby-node.ts +9 -10
- package/package.json +12 -6
- package/src/components/Head.tsx +1 -1
- package/src/components/template.tsx +1 -1
- package/src/gatsby-node-utils.ts +13 -2
- package/src/types.ts +1 -1
- package/tsconfig.json +13 -3
package/gatsby-config.ts
CHANGED
|
@@ -2,13 +2,13 @@ import type { GatsbyConfig } from "gatsby";
|
|
|
2
2
|
|
|
3
3
|
import dotenv from "dotenv";
|
|
4
4
|
|
|
5
|
-
import { resolveComponentsPath } from "./
|
|
5
|
+
import { resolveComponentsPath } from "./build";
|
|
6
6
|
|
|
7
7
|
dotenv.config();
|
|
8
8
|
|
|
9
9
|
// Este process.env.GRIDDO_ASSET_PREFIX se lee porque se ha introducido en
|
|
10
10
|
// `getEnvRunner()`.
|
|
11
|
-
const GRIDDO_ASSET_PREFIX = process.env.
|
|
11
|
+
const GRIDDO_ASSET_PREFIX = process.env.LOCAL_GRIDDO_ASSET_PREFIX || undefined;
|
|
12
12
|
|
|
13
13
|
// Gatsby configuration file from client
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
package/gatsby-node.ts
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
|
+
import type { GatsbyPageObject } from "./src/types";
|
|
1
2
|
import type { GatsbyNode } from "gatsby";
|
|
2
3
|
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
|
|
5
|
-
import { logInfo, logPageSize } from "./
|
|
6
|
-
import {
|
|
7
|
-
import { getConfig } from "./exporter/utils/temp-utils";
|
|
6
|
+
import { getConfig, logInfo, logPageSize } from "./build";
|
|
7
|
+
import { getBuildPagesFromStore } from "./exporter/utils/store";
|
|
8
8
|
import { getMatchPath } from "./src/gatsby-node-utils";
|
|
9
|
-
import { GatsbyPageObject } from "./src/types";
|
|
10
|
-
|
|
11
|
-
const dirs = getConfig().dirs();
|
|
12
|
-
const store = path.join(dirs.__cx, "store");
|
|
13
|
-
const template = path.join(dirs.__ssg, "src/components/template.tsx");
|
|
14
9
|
|
|
15
10
|
const GRIDDO_BUILD_LOGS = JSON.parse(process.env.GRIDDO_BUILD_LOGS || "false");
|
|
16
11
|
|
|
17
|
-
const
|
|
18
|
-
|
|
12
|
+
const { __ssg } = getConfig().paths();
|
|
13
|
+
const template = path.join(__ssg, "src/components/template.tsx");
|
|
14
|
+
const pages = getBuildPagesFromStore<GatsbyPageObject>({
|
|
15
|
+
withSizeProp: GRIDDO_BUILD_LOGS,
|
|
16
|
+
});
|
|
19
17
|
|
|
18
|
+
const createPages: GatsbyNode["createPages"] = async ({ actions }) => {
|
|
20
19
|
for await (const page of pages) {
|
|
21
20
|
if (!page) return;
|
|
22
21
|
|
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.
|
|
4
|
+
"version": "10.4.21",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"griddo-cx": "./start-render.js"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "yarn build:exporter && yarn build:reset-render && yarn build:build-complete && yarn build:start-render && yarn build:run-start-render && yarn build:browser && yarn build:upload-search-content",
|
|
22
|
+
"build": "yarn build:exporter && yarn build:reset-render && yarn build:build-complete && yarn build:start-render && yarn build:run-start-render && yarn build:browser && yarn build:upload-search-content && yarn build:types",
|
|
23
23
|
"build:upload-search-content": "esbuild ./exporter/upload-search-content.ts --bundle --platform=node --minify --outfile=./build/upload-search-content.js",
|
|
24
24
|
"build:exporter": "esbuild ./exporter/index.ts --bundle --platform=node --minify --outfile=./build/index.js",
|
|
25
25
|
"build:build-complete": "esbuild ./exporter/build-complete.ts --bundle --platform=node --minify --outfile=./build/build-complete.js",
|
|
@@ -27,13 +27,14 @@
|
|
|
27
27
|
"build:start-render": "esbuild ./exporter/start-render.ts --bundle --platform=node --minify --outfile=./build/start-render.js",
|
|
28
28
|
"build:run-start-render": "esbuild ./exporter/run-start-render.ts --bundle --platform=node --minify --outfile=./build/run-start-render.js",
|
|
29
29
|
"build:browser": "esbuild ./exporter/browser/index.ts --platform=node --bundle --minify --outfile=./build/browser/index.js",
|
|
30
|
-
"build:types": "npx tsc --emitDeclarationOnly --declaration --outDir build --project tsconfig.json",
|
|
30
|
+
"build:types": "npx tsc --emitDeclarationOnly --declaration --outDir build --project tsconfig.exporter.json",
|
|
31
31
|
"export:complete": "node ./build/build-complete.js",
|
|
32
32
|
"export:reset": "node ./build/reset-render.js",
|
|
33
33
|
"prepare": "yarn run build",
|
|
34
34
|
"watch:tscheck": "tsc --noEmit --watch",
|
|
35
35
|
"complete-render": "node ./build/build-complete.js",
|
|
36
36
|
"reset-render": "node ./build/reset-render.js",
|
|
37
|
+
"test": "tsx ./__tests__/tests-health.ts && jest --verbose",
|
|
37
38
|
"upload-search-content": "node ./build/upload-search-content.js",
|
|
38
39
|
"clean": "gatsby clean; rm -rf .cache public assets",
|
|
39
40
|
"gatsby-build": "gatsby telemetry --disable && gatsby build --prefix-paths"
|
|
@@ -44,13 +45,15 @@
|
|
|
44
45
|
"@babel/preset-env": "^7.14.5",
|
|
45
46
|
"@babel/preset-react": "^7.14.5",
|
|
46
47
|
"@babel/preset-typescript": "^7.16.5",
|
|
47
|
-
"@griddo/core": "^10.4.
|
|
48
|
+
"@griddo/core": "^10.4.21",
|
|
48
49
|
"@svgr/webpack": "^5.5.0",
|
|
50
|
+
"@types/cheerio": "^0.22.35",
|
|
49
51
|
"babel-loader": "^8.0.6",
|
|
50
52
|
"babel-plugin-styled-components": "^1.10.7",
|
|
51
53
|
"babel-plugin-transform-runtime": "^6.23.0",
|
|
52
54
|
"babel-polyfill": "^6.26.0",
|
|
53
55
|
"chalk": "^2.4.2",
|
|
56
|
+
"cheerio": "^1.0.0-rc.12",
|
|
54
57
|
"dotenv": "^8.1.0",
|
|
55
58
|
"find-up": "^5.0.0",
|
|
56
59
|
"fs-extra": "^9.0.1",
|
|
@@ -70,6 +73,7 @@
|
|
|
70
73
|
"@types/eslint": "^7.29.0",
|
|
71
74
|
"@types/fs-extra": "^9.0.13",
|
|
72
75
|
"@types/gradient-string": "^1.1.2",
|
|
76
|
+
"@types/jest": "^29.5.12",
|
|
73
77
|
"@types/prettier": "2.7.2",
|
|
74
78
|
"@types/react": "18.0.28",
|
|
75
79
|
"@types/react-dom": "18.0.11",
|
|
@@ -78,7 +82,9 @@
|
|
|
78
82
|
"eslint": "^7.5.0",
|
|
79
83
|
"eslint-plugin-node": "^11.1.0",
|
|
80
84
|
"eslint-plugin-react": "7.14.3",
|
|
81
|
-
"
|
|
85
|
+
"jest": "^29.7.0",
|
|
86
|
+
"prettier": "2.0.4",
|
|
87
|
+
"ts-jest": "^29.1.3"
|
|
82
88
|
},
|
|
83
89
|
"peerDependencies": {
|
|
84
90
|
"axios": "*",
|
|
@@ -114,5 +120,5 @@
|
|
|
114
120
|
"resolutions": {
|
|
115
121
|
"memoizee": "0.4.15"
|
|
116
122
|
},
|
|
117
|
-
"gitHead": "
|
|
123
|
+
"gitHead": "e9ee5308a0c6829e0e3c0c82d28f5e580d0bb804"
|
|
118
124
|
}
|
package/src/components/Head.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { generateAutomaticDimensions } from "@griddo-instance";
|
|
|
4
4
|
import parse from "html-react-parser";
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
|
|
7
|
-
import { filterHeadIntegrations } from "../../
|
|
7
|
+
import { filterHeadIntegrations } from "../../build/browser";
|
|
8
8
|
import { cleanCommaSeparated, composeAnalytics, formatImage } from "../utils";
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -7,7 +7,7 @@ import parse from "html-react-parser";
|
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { Helmet } from "react-helmet";
|
|
9
9
|
|
|
10
|
-
import { filterPositionIntegrations } from "../../
|
|
10
|
+
import { filterPositionIntegrations } from "../../build/browser";
|
|
11
11
|
|
|
12
12
|
// Gatsby Head
|
|
13
13
|
export { Head } from "./Head";
|
package/src/gatsby-node-utils.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { GatsbyNode } from "gatsby";
|
|
|
2
2
|
|
|
3
3
|
import fs from "fs-extra";
|
|
4
4
|
|
|
5
|
+
import { getConfig } from "../build";
|
|
5
6
|
import {
|
|
6
7
|
IS_COMPONENT_LIBRARY,
|
|
7
8
|
PROJECT_ALIASES,
|
|
8
9
|
resolveComponentsPath,
|
|
9
10
|
} from "../exporter/utils/instance";
|
|
10
|
-
import { getConfig } from "../exporter/utils/temp-utils";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Copy the instance's `/static` dir into the Gatsby's to include it in the render assets.
|
|
@@ -83,9 +83,20 @@ function getGatsbyAssetPrefixSlug(domain: string) {
|
|
|
83
83
|
return `${assetPrefix}/${domain}`;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// @todo: Arreglar esta movida de variables de entorno locales solo para Gatsby
|
|
87
|
+
function getLocalGatsbyAssetPrefixSlug(domain: string) {
|
|
88
|
+
const { proDomain } = getConfig();
|
|
89
|
+
|
|
90
|
+
const assetPrefix = process.env.LOCAL_GRIDDO_ASSET_PREFIX;
|
|
91
|
+
if (!assetPrefix || !domain) return "";
|
|
92
|
+
if (!domain.startsWith(proDomain)) return "";
|
|
93
|
+
|
|
94
|
+
return `${assetPrefix}/${domain}`;
|
|
95
|
+
}
|
|
96
|
+
|
|
86
97
|
function getMatchPath(domain: string, compose: string) {
|
|
87
98
|
const domainWithNoSlashes = domain.replace("/", "");
|
|
88
|
-
const assetPrefix =
|
|
99
|
+
const assetPrefix = getLocalGatsbyAssetPrefixSlug(domainWithNoSlashes);
|
|
89
100
|
const needsAssetDomainPrefix = assetPrefix && assetPrefix !== "";
|
|
90
101
|
const matchPath = needsAssetDomainPrefix ? compose : "";
|
|
91
102
|
|
package/src/types.ts
CHANGED
package/tsconfig.json
CHANGED
|
@@ -9,8 +9,18 @@
|
|
|
9
9
|
"forceConsistentCasingInFileNames": true,
|
|
10
10
|
"strict": true,
|
|
11
11
|
"skipLibCheck": true,
|
|
12
|
-
"resolveJsonModule": true
|
|
13
|
-
"outDir": "./build"
|
|
12
|
+
"resolveJsonModule": true
|
|
14
13
|
},
|
|
15
|
-
"include": [
|
|
14
|
+
"include": [
|
|
15
|
+
"./exporter/**/*.ts",
|
|
16
|
+
"./exporter/**/*.tsx",
|
|
17
|
+
"./src/**/*.ts",
|
|
18
|
+
"./src/**/*.tsx",
|
|
19
|
+
"global.d.ts",
|
|
20
|
+
"__tests__/**/*.ts",
|
|
21
|
+
"gatsby-browser.tsx",
|
|
22
|
+
"gatsby-config.ts",
|
|
23
|
+
"gatsby-node.ts",
|
|
24
|
+
"gatsby-ssr.tsx"
|
|
25
|
+
]
|
|
16
26
|
}
|