@griddo/cx 10.4.3 → 10.4.5

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.
@@ -41,10 +41,6 @@ dotenv.config();
41
41
  /* prettier-ignore */ const PUBLIC_API_URL = process.env.PUBLIC_API_URL as string;
42
42
  /* prettier-ignore */ const RENDER_ID = process.env.GRIDDO_RENDERID || new Date().valueOf().toString();
43
43
 
44
- // Consts
45
- const createdPages: Array<number> = [];
46
- const buildProcessData: BuildProcessData = {};
47
-
48
44
  /**
49
45
  * Fetch, process and save object pages and sites data into the file system to
50
46
  * be consumed by other services (Griddo itself, Adapters, etc.)
@@ -53,6 +49,10 @@ async function createStore(storeDir: string, domain: string) {
53
49
  console.info(`API calls with ${API_CONCURRENCY_COUNT} threads`);
54
50
 
55
51
  try {
52
+ // Vars to save later in the report file
53
+ const createdPages: Array<number> = [];
54
+ const buildProcessData: BuildProcessData = {};
55
+
56
56
  // Get sites objects to publish and unpublish.
57
57
  const { sitesToPublish, sitesToUnpublish } = await checkSites(domain);
58
58
 
@@ -56,15 +56,18 @@ async function checkSites(domain: string) {
56
56
 
57
57
  // If there are valid sites...
58
58
  if (validSites.length) {
59
- const promisesOfValidSites = validSites.map(async (site) => {
60
- const langResponse = await SitesService.getLanguages(site.id);
61
-
62
- return (site.domains = langResponse.items
63
- .filter((item) => item.domain && item.domain.slug.indexOf(domain) > 0)
64
- .map((item) => ({ [item.id]: `${item.domain.slug}${item.path}` })));
65
- });
66
-
67
- await Promise.all(promisesOfValidSites);
59
+ for (const site of validSites) {
60
+ const { items } = await SitesService.getLanguages(site.id);
61
+
62
+ // Añadimos la prop domains con el dominio "cocinado" con los idiomas y teniendo en cuenta solo el dominio actual
63
+ site.domains = items
64
+ .filter(
65
+ (item) =>
66
+ item.domain &&
67
+ (item.domain.slug === domain || item.domain.slug === `/${domain}`)
68
+ )
69
+ .map((item) => ({ [item.id]: `${item.domain.slug}${item.path}` }));
70
+ }
68
71
  }
69
72
 
70
73
  // Save sites object to publish
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.3",
4
+ "version": "10.4.5",
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.4.3",
73
+ "@griddo/eslint-config-back": "^10.4.5",
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": "e75e4dc2c9fbc163ccbf9050792be04591530b6a"
120
+ "gitHead": "7bf57f5c59f846056de127fc1bf85cc5b93fc21b"
121
121
  }