@griddo/cx 10.3.19 → 10.3.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.
Files changed (52) hide show
  1. package/build/download-data.js +17 -17
  2. package/build/index.js +17 -17
  3. package/exporter/adapters/gatsby/index.ts +3 -1
  4. package/exporter/adapters/gatsby/utils.ts +39 -20
  5. package/exporter/services/distributors.ts +1 -1
  6. package/exporter/services/store.ts +2 -2
  7. package/exporter/utils/download-build-data.ts +2 -2
  8. package/exporter/utils/sites.ts +2 -7
  9. package/gatsby-browser.tsx +43 -41
  10. package/gatsby-node.ts +3 -2
  11. package/package.json +3 -3
  12. package/static/README.md +3 -0
  13. package/static/fonts/dm-sans/dm-sans-v14-latin-500.woff2 +0 -0
  14. package/static/fonts/dm-sans/dm-sans-v14-latin-500italic.woff2 +0 -0
  15. package/static/fonts/dm-sans/dm-sans-v14-latin-600.woff2 +0 -0
  16. package/static/fonts/dm-sans/dm-sans-v14-latin-600italic.woff2 +0 -0
  17. package/static/fonts/dm-sans/dm-sans-v14-latin-700.woff2 +0 -0
  18. package/static/fonts/dm-sans/dm-sans-v14-latin-700italic.woff2 +0 -0
  19. package/static/fonts/dm-sans/dm-sans-v14-latin-800.woff2 +0 -0
  20. package/static/fonts/dm-sans/dm-sans-v14-latin-800italic.woff2 +0 -0
  21. package/static/fonts/dm-sans/dm-sans-v14-latin-900.woff2 +0 -0
  22. package/static/fonts/dm-sans/dm-sans-v14-latin-900italic.woff2 +0 -0
  23. package/static/fonts/dm-sans/dm-sans-v14-latin-italic.woff2 +0 -0
  24. package/static/fonts/dm-sans/dm-sans-v14-latin-regular.woff2 +0 -0
  25. package/static/fonts/dm-serif-display/dm-serif-display-v15-latin-italic.woff2 +0 -0
  26. package/static/fonts/dm-serif-display/dm-serif-display-v15-latin-regular.woff2 +0 -0
  27. package/static/fonts/gilroy/Gilroy-Black.woff2 +0 -0
  28. package/static/fonts/gilroy/Gilroy-BlackItalic.woff2 +0 -0
  29. package/static/fonts/gilroy/Gilroy-Bold.woff2 +0 -0
  30. package/static/fonts/gilroy/Gilroy-BoldItalic.woff2 +0 -0
  31. package/static/fonts/gilroy/Gilroy-ExtraBold.woff2 +0 -0
  32. package/static/fonts/gilroy/Gilroy-ExtraBoldItalic.woff2 +0 -0
  33. package/static/fonts/gilroy/Gilroy-Heavy.woff2 +0 -0
  34. package/static/fonts/gilroy/Gilroy-HeavyItalic.woff2 +0 -0
  35. package/static/fonts/gilroy/Gilroy-Light.woff2 +0 -0
  36. package/static/fonts/gilroy/Gilroy-LightItalic.woff2 +0 -0
  37. package/static/fonts/gilroy/Gilroy-Medium.woff2 +0 -0
  38. package/static/fonts/gilroy/Gilroy-MediumItalic.woff2 +0 -0
  39. package/static/fonts/gilroy/Gilroy-Regular.woff2 +0 -0
  40. package/static/fonts/gilroy/Gilroy-RegularItalic.woff2 +0 -0
  41. package/static/fonts/gilroy/Gilroy-SemiBold.woff2 +0 -0
  42. package/static/fonts/gilroy/Gilroy-SemiBoldItalic.woff2 +0 -0
  43. package/static/fonts/gilroy/Gilroy-Thin.woff2 +0 -0
  44. package/static/fonts/gilroy/Gilroy-ThinItalic.woff2 +0 -0
  45. package/static/fonts/gilroy/Gilroy-UltraLight.woff2 +0 -0
  46. package/static/fonts/gilroy/Gilroy-UltraLightItalic.woff2 +0 -0
  47. package/static/fonts/work-sans/work-sans-v17-latin-700.woff +0 -0
  48. package/static/fonts/work-sans/work-sans-v17-latin-700.woff2 +0 -0
  49. package/static/fonts/work-sans/work-sans-v17-latin-regular.woff +0 -0
  50. package/static/fonts/work-sans/work-sans-v17-latin-regular.woff2 +0 -0
  51. package/static/grisso.css +1 -0
  52. package/static/webfonts.css +115 -0
@@ -40,7 +40,9 @@ async function runGatsbyAdapter() {
40
40
  * Download domain build data (sites, pages, etc) and generator a folder
41
41
  * called `store` where all the domain render data is saved.
42
42
  */
43
- exeTime = await measureExecutionTime(downloadBuildData).catch((err) => {
43
+ exeTime = await measureExecutionTime(
44
+ async () => await downloadBuildData(domain)
45
+ ).catch((err) => {
44
46
  console.error(
45
47
  "Error in downloadBuildData() :",
46
48
  err?.stdout?.toString() || err
@@ -65,8 +65,10 @@ function getGatsbyDomainRunner(domain: string) {
65
65
  */
66
66
  const restoreArtifacts = () => {
67
67
  for (const artifact of artifactsArchivable) {
68
- const { currentExportArchivePath, currentExportWorkingPath } =
69
- getArtifactPaths(artifact);
68
+ const {
69
+ currentExportArchivePath,
70
+ currentExportWorkingPath,
71
+ } = getArtifactPaths(artifact);
70
72
 
71
73
  if (fs.existsSync(currentExportArchivePath)) {
72
74
  console.log(`️Restoring ${chalk.gray(currentExportArchivePath)}`);
@@ -146,8 +148,10 @@ function getGatsbyDomainRunner(domain: string) {
146
148
  * Creates necesary folders.
147
149
  */
148
150
  const createBaseExportPaths = () => {
149
- const { domainExportArchiveBasePath, domainCacheArchiveBasePath } =
150
- getArtifactPaths();
151
+ const {
152
+ domainExportArchiveBasePath,
153
+ domainCacheArchiveBasePath,
154
+ } = getArtifactPaths();
151
155
 
152
156
  for (const _path of [
153
157
  domainExportArchiveBasePath,
@@ -161,8 +165,10 @@ function getGatsbyDomainRunner(domain: string) {
161
165
  };
162
166
 
163
167
  const archiveExportArtifact = (artifact: string) => {
164
- const { currentExportArchivePath, currentExportWorkingPath } =
165
- getArtifactPaths(artifact);
168
+ const {
169
+ currentExportArchivePath,
170
+ currentExportWorkingPath,
171
+ } = getArtifactPaths(artifact);
166
172
 
167
173
  console.info(
168
174
  `Moving files from ${chalk.gray(
@@ -175,8 +181,10 @@ function getGatsbyDomainRunner(domain: string) {
175
181
  /** Archive archivable artifacts to reuse them in the next render */
176
182
  const archiveArtifacts = () => {
177
183
  for (const artifact of artifactsArchivable) {
178
- const { currentExportWorkingPath, currentExportArchivePath } =
179
- getArtifactPaths(artifact);
184
+ const {
185
+ currentExportWorkingPath,
186
+ currentExportArchivePath,
187
+ } = getArtifactPaths(artifact);
180
188
 
181
189
  if (!fs.existsSync(currentExportWorkingPath)) {
182
190
  console.log(
@@ -202,8 +210,10 @@ function getGatsbyDomainRunner(domain: string) {
202
210
  };
203
211
 
204
212
  const createArtifactBackup = (artifact: string) => {
205
- const { currentExportArchivePath, currentExportBackupPath } =
206
- getArtifactPaths(artifact);
213
+ const {
214
+ currentExportArchivePath,
215
+ currentExportBackupPath,
216
+ } = getArtifactPaths(artifact);
207
217
 
208
218
  if (fs.existsSync(currentExportArchivePath)) {
209
219
  console.info(
@@ -214,8 +224,10 @@ function getGatsbyDomainRunner(domain: string) {
214
224
  };
215
225
 
216
226
  const restoreArtifactBackup = (artifact: string) => {
217
- const { currentExportArchivePath, currentExportBackupPath } =
218
- getArtifactPaths(artifact);
227
+ const {
228
+ currentExportArchivePath,
229
+ currentExportBackupPath,
230
+ } = getArtifactPaths(artifact);
219
231
 
220
232
  if (fs.existsSync(currentExportBackupPath)) {
221
233
  console.log(`️Restoring backup ${chalk.gray(currentExportArchivePath)}`);
@@ -224,8 +236,10 @@ function getGatsbyDomainRunner(domain: string) {
224
236
  };
225
237
 
226
238
  const deleteArtifactBackup = (artifact: string) => {
227
- const { currentExportArchivePath, currentExportBackupPath } =
228
- getArtifactPaths(artifact);
239
+ const {
240
+ currentExportArchivePath,
241
+ currentExportBackupPath,
242
+ } = getArtifactPaths(artifact);
229
243
 
230
244
  console.log(`️Removing backup ${chalk.gray(currentExportArchivePath)}`);
231
245
  run(`rm -rf ${currentExportBackupPath}`);
@@ -234,8 +248,10 @@ function getGatsbyDomainRunner(domain: string) {
234
248
  /** Archive archivable cache artifacts to reuse them in the next render */
235
249
  const archiveCacheArtifacts = () => {
236
250
  for (const artifact of artifactsCache) {
237
- const { currentExportArchiveCachePath, currentExportWorkingPath } =
238
- getArtifactPaths(artifact);
251
+ const {
252
+ currentExportArchiveCachePath,
253
+ currentExportWorkingPath,
254
+ } = getArtifactPaths(artifact);
239
255
 
240
256
  if (fs.existsSync(currentExportWorkingPath)) {
241
257
  console.info(
@@ -258,8 +274,10 @@ function getGatsbyDomainRunner(domain: string) {
258
274
  */
259
275
  const restoreCacheArtifacts = () => {
260
276
  for (const artifact of artifactsCache) {
261
- const { currentExportArchiveCachePath, currentExportWorkingPath } =
262
- getArtifactPaths(artifact);
277
+ const {
278
+ currentExportArchiveCachePath,
279
+ currentExportWorkingPath,
280
+ } = getArtifactPaths(artifact);
263
281
 
264
282
  if (fs.existsSync(currentExportArchiveCachePath)) {
265
283
  console.log(`️Restoring ${chalk.gray(currentExportArchiveCachePath)}`);
@@ -305,8 +323,9 @@ function getGatsbyDomainRunner(domain: string) {
305
323
  */
306
324
  const removeDisposableArtifacts = () => {
307
325
  for (const artifact of artifactsDisposable) {
308
- const { currentExportWorkingPath: artifactPath } =
309
- getArtifactPaths(artifact);
326
+ const { currentExportWorkingPath: artifactPath } = getArtifactPaths(
327
+ artifact
328
+ );
310
329
 
311
330
  if (fs.existsSync(artifactPath)) {
312
331
  console.log(`️Removing ${chalk.gray(artifactPath)}`);
@@ -157,7 +157,7 @@ class DistributorService {
157
157
  if (key === "queriedItems") continue;
158
158
 
159
159
  const _key = key as "hasDistributorData" | "queriedItems";
160
- const component = templateChunk[_key] as unknown as {
160
+ const component = (templateChunk[_key] as unknown) as {
161
161
  data: Reference<unknown>;
162
162
  queriedItems: QueriedData<unknown>;
163
163
  hasDistributorData: boolean;
@@ -54,7 +54,7 @@ const BUILD_PROCESS_DATA: BuildProcessData = {};
54
54
  * Fetch, process and save object pages and sites data into the file system to
55
55
  * be consumed by other services (Griddo itself, Adapters, etc.)
56
56
  */
57
- async function createStore(storeFolder: string) {
57
+ async function createStore(storeFolder: string, domain: string) {
58
58
  console.info(`API calls with ${API_CONCURRENCY_COUNT} threads`);
59
59
 
60
60
  // Remove old store
@@ -68,7 +68,7 @@ async function createStore(storeFolder: string) {
68
68
 
69
69
  try {
70
70
  // Get sites objects to publish and unpublish.
71
- const { sitesToPublish, sitesToUnpublish } = await checkSites();
71
+ const { sitesToPublish, sitesToUnpublish } = await checkSites(domain);
72
72
 
73
73
  // The settings will be extracted below in this process.
74
74
  await SettingsService.getAll();
@@ -13,9 +13,9 @@ const apiCacheFolder = path.resolve(__dirname, "../apiCache");
13
13
  * `getBuildMetadata()` to get build and sites metadata as objects. Both from
14
14
  * exporter utils sites folder.
15
15
  */
16
- async function downloadBuildData() {
16
+ async function downloadBuildData(domain: string) {
17
17
  createAPICacheFolder();
18
- await createStore(storeFolder);
18
+ await createStore(storeFolder, domain);
19
19
  sanitizeAPICacheFolder(apiCacheFolder);
20
20
  }
21
21
 
@@ -36,7 +36,7 @@ const STRIP_DOMAIN_FROM_PATH = JSON.parse(
36
36
  /**
37
37
  * Check the instance sites and returns site prepared to be published and unpublished.
38
38
  */
39
- async function checkSites() {
39
+ async function checkSites(domain: string) {
40
40
  console.info(`API URL ${API_URL as string}`);
41
41
 
42
42
  // Login to API
@@ -61,12 +61,7 @@ async function checkSites() {
61
61
  const langResponse = await SitesService.getLanguages(site.id);
62
62
 
63
63
  return (site.domains = langResponse.items
64
- .filter(
65
- (item) =>
66
- item.domain &&
67
- (!process.env.DOMAIN ||
68
- item.domain.slug.indexOf(process.env.DOMAIN) > 0)
69
- )
64
+ .filter((item) => item.domain && item.domain.slug.indexOf(domain) > 0)
70
65
  .map((item) => ({ [item.id]: `${item.domain.slug}${item.path}` })));
71
66
  });
72
67
 
@@ -61,47 +61,49 @@ export const onServiceWorkerActive: GatsbyBrowser["onServiceWorkerActive"] = (
61
61
  }
62
62
  };
63
63
 
64
- export const onServiceWorkerInstalled: GatsbyBrowser["onServiceWorkerInstalled"] =
65
- (props) => {
66
- if (browser.onServiceWorkerInstalled) {
67
- browser.onServiceWorkerInstalled(props);
68
- }
69
- };
70
-
71
- export const onServiceWorkerRedundant: GatsbyBrowser["onServiceWorkerRedundant"] =
72
- (props) => {
73
- if (browser.onServiceWorkerRedundant) {
74
- browser.onServiceWorkerRedundant(props);
75
- }
76
- };
77
-
78
- export const onServiceWorkerUpdateFound: GatsbyBrowser["onServiceWorkerUpdateFound"] =
79
- (props) => {
80
- if (browser.onServiceWorkerUpdateFound) {
81
- browser.onServiceWorkerUpdateFound(props);
82
- }
83
- };
84
-
85
- export const onServiceWorkerUpdateReady: GatsbyBrowser["onServiceWorkerUpdateReady"] =
86
- (props) => {
87
- if (browser.onServiceWorkerUpdateReady) {
88
- browser.onServiceWorkerUpdateReady(props);
89
- }
90
- };
91
-
92
- export const registerServiceWorker: GatsbyBrowser["registerServiceWorker"] =
93
- () => {
94
- if (browser.registerServiceWorker) {
95
- return browser.registerServiceWorker();
96
- }
97
- };
98
-
99
- export const replaceHydrateFunction: GatsbyBrowser["replaceHydrateFunction"] =
100
- () => {
101
- if (browser.replaceHydrateFunction) {
102
- return browser.replaceHydrateFunction();
103
- }
104
- };
64
+ export const onServiceWorkerInstalled: GatsbyBrowser["onServiceWorkerInstalled"] = (
65
+ props
66
+ ) => {
67
+ if (browser.onServiceWorkerInstalled) {
68
+ browser.onServiceWorkerInstalled(props);
69
+ }
70
+ };
71
+
72
+ export const onServiceWorkerRedundant: GatsbyBrowser["onServiceWorkerRedundant"] = (
73
+ props
74
+ ) => {
75
+ if (browser.onServiceWorkerRedundant) {
76
+ browser.onServiceWorkerRedundant(props);
77
+ }
78
+ };
79
+
80
+ export const onServiceWorkerUpdateFound: GatsbyBrowser["onServiceWorkerUpdateFound"] = (
81
+ props
82
+ ) => {
83
+ if (browser.onServiceWorkerUpdateFound) {
84
+ browser.onServiceWorkerUpdateFound(props);
85
+ }
86
+ };
87
+
88
+ export const onServiceWorkerUpdateReady: GatsbyBrowser["onServiceWorkerUpdateReady"] = (
89
+ props
90
+ ) => {
91
+ if (browser.onServiceWorkerUpdateReady) {
92
+ browser.onServiceWorkerUpdateReady(props);
93
+ }
94
+ };
95
+
96
+ export const registerServiceWorker: GatsbyBrowser["registerServiceWorker"] = () => {
97
+ if (browser.registerServiceWorker) {
98
+ return browser.registerServiceWorker();
99
+ }
100
+ };
101
+
102
+ export const replaceHydrateFunction: GatsbyBrowser["replaceHydrateFunction"] = () => {
103
+ if (browser.replaceHydrateFunction) {
104
+ return browser.replaceHydrateFunction();
105
+ }
106
+ };
105
107
 
106
108
  export const shouldUpdateScroll: GatsbyBrowser["shouldUpdateScroll"] = (
107
109
  props
package/gatsby-node.ts CHANGED
@@ -51,8 +51,9 @@ const createPages: GatsbyNode["createPages"] = async ({
51
51
 
52
52
  // onPostBuild
53
53
  const onPostBuild = async () => {
54
- const { buildProcessData, sitesToPublish } =
55
- getBuildMetadata(storeFolderPath);
54
+ const { buildProcessData, sitesToPublish } = getBuildMetadata(
55
+ storeFolderPath
56
+ );
56
57
 
57
58
  await generateBuildReport(reportFilePath, buildProcessData);
58
59
  await RobotsService.writeFiles(publicFolderPath);
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.3.19",
4
+ "version": "10.3.21",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -70,7 +70,7 @@
70
70
  "react-helmet": "^6.0.0"
71
71
  },
72
72
  "devDependencies": {
73
- "@griddo/eslint-config-back": "^10.3.19",
73
+ "@griddo/eslint-config-back": "^10.3.21",
74
74
  "@types/babel__core": "^7.20.0",
75
75
  "@types/babel__preset-env": "^7.9.2",
76
76
  "@types/csvtojson": "^2.0.0",
@@ -117,5 +117,5 @@
117
117
  "publishConfig": {
118
118
  "access": "public"
119
119
  },
120
- "gitHead": "7528f70fec302460e645be69d6b7765ac7e45c10"
120
+ "gitHead": "148175d5af62f27e29ad411a8947115ba92bbd66"
121
121
  }
@@ -0,0 +1,3 @@
1
+ # Griddo static folder
2
+
3
+ The assets in this folder will be handled "as is" and they will not get any kind of optimization at all.