@griddo/cx 10.2.9 → 10.2.11

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/build/index.js CHANGED
@@ -25,7 +25,7 @@ GFS4: `),console.error(e)});z[Z]||(ws=global[Z]||[],xs(z,ws),z.close=function(e)
25
25
  \u2502 Access credentials failure \u2502
26
26
  \u2502 Check that the login details are correct in your .env file \u2502
27
27
  \u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
28
- `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.2.9";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
28
+ `)),process.exit(1)}}},Ar=new Kn;var el=K(Yn()),tl=K(gt()),rl=K(Gt());var yp=K(gt()),Vu=K(Gt()),gp=K(gn()),Yu=K(Wu());var Ju="10.2.11";Vu.default.config();var vp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS)||!!process.env.LOGS&&!!JSON.parse(process.env.LOGS);function Ku(e){let t=e.length,r=e.length+2,n=" ".repeat(Math.floor((r-t)/2)),i=`\u256D${"\u2500".repeat(r)}\u256E
29
29
  `,s=`
30
30
  \u2570${"\u2500".repeat(r)}\u256F`,o=`\u2502${n}${e}${n}\u2502`;console.log(`${i}${o}${s}`)}function fi(e){vp&&console.info(e.replace(/(\s)\s+/g,"$1"))}function Xu(e){return new Promise(t=>setTimeout(t,e))}function Dr(e,t=3){return(e/1e3).toFixed(t)}function hi(e){return"site"in e&&e.site?e?.site:void 0}function di(...e){let t=performance.now();return e.forEach(r=>r()),Dr(performance.now()-t)}function Qu(){let e=`
31
31
  \xB7\xB7
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.2.9",
4
+ "version": "10.2.11",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -68,7 +68,7 @@
68
68
  "react-helmet": "^6.0.0"
69
69
  },
70
70
  "devDependencies": {
71
- "@griddo/eslint-config-back": "^10.2.9",
71
+ "@griddo/eslint-config-back": "^10.2.11",
72
72
  "@types/babel__core": "^7.20.0",
73
73
  "@types/babel__preset-env": "^7.9.2",
74
74
  "@types/csvtojson": "^2.0.0",
@@ -116,5 +116,5 @@
116
116
  "publishConfig": {
117
117
  "access": "public"
118
118
  },
119
- "gitHead": "1472fba90d2631dc4c80cdd3e359611ef7030ccb"
119
+ "gitHead": "fadf0b0c9ced3461dea8670ad2df493d5cbf754a"
120
120
  }
@@ -3,6 +3,10 @@ import type { Robots } from "../types/global";
3
3
  import fs from "fs";
4
4
  import path from "path";
5
5
 
6
+ dotenv.config();
7
+
8
+ import dotenv from "dotenv";
9
+
6
10
  import { get } from "../utils/api";
7
11
 
8
12
  /**
@@ -45,18 +49,23 @@ class RobotsService {
45
49
  * TODO: JSDoc
46
50
  */
47
51
  async writeFiles(basePath: string) {
48
- for (const robot of this.robots) {
49
- const basePathLocation = path.join(basePath, robot.path);
50
- const fileLocationV1 = path.join(basePathLocation, "robots.txt");
51
- const fileLocationV2 = path.join(basePath, "robots.txt");
52
+ // Takes Robot for the current rendering domain
53
+ const robot = this.robots.find(
54
+ ({ path }) => path === `/${process.env.DOMAIN}`
55
+ );
56
+
57
+ if (!robot) {
58
+ console.log(`Robots not found for ${process.env.DOMAIN}`);
59
+ return;
60
+ }
52
61
 
53
- if (fs.existsSync(basePathLocation)) {
54
- if (!!process.env.GRIDDO_EXPORT_STRIP_DOMAIN_FROM_PATH) {
55
- fs.writeFileSync(fileLocationV2, robot.content);
56
- } else {
57
- fs.writeFileSync(fileLocationV1, robot.content);
58
- }
59
- }
62
+ if (fs.existsSync(basePath)) {
63
+ const fileLocation = process.env.GRIDDO_EXPORT_STRIP_DOMAIN_FROM_PATH
64
+ ? path.join(basePath, "robots.txt")
65
+ : path.join(basePath, robot.path, "robots.txt");
66
+ fs.writeFileSync(fileLocation, robot?.content);
67
+ } else {
68
+ console.log(`${basePath} not found`);
60
69
  }
61
70
  }
62
71
  }