@griddo/cx 1.75.189 → 1.75.191
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 +2 -2
- package/gatsby-config.ts +1 -3
- package/package.json +4 -4
- package/scripts/griddo-exporter.ts +16 -43
package/build/index.js
CHANGED
|
@@ -26,7 +26,7 @@ GFS4: `),console.error(e)});G[K]||(Qo=global[K]||[],ea(G,Qo),G.close=function(e)
|
|
|
26
26
|
\u2502 Access credentials failure \u2502
|
|
27
27
|
\u2502 Check that the login details are correct in your .env file \u2502
|
|
28
28
|
\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
|
|
29
|
-
`)),process.exit(1)}}},fr=new Rn;var Vu=Z(Cn()),Yu=Z(pt()),Xu=Z(hr());var up=Z(pt()),$u=Z(hr()),lp=Z(Qc()),Hu=Z(Lu());var Bu="1.75.
|
|
29
|
+
`)),process.exit(1)}}},fr=new Rn;var Vu=Z(Cn()),Yu=Z(pt()),Xu=Z(hr());var up=Z(pt()),$u=Z(hr()),lp=Z(Qc()),Hu=Z(Lu());var Bu="1.75.191";$u.default.config();var fp=!!process.env.GRIDDO_BUILD_LOGS&&!!JSON.parse(process.env.GRIDDO_BUILD_LOGS);function Uu(...e){fp&&console.info(...e)}function Gu(e){return new Promise(t=>setTimeout(t,e))}function zu(e,t=3){return(e/1e3).toFixed(t)}function Wu(e){return"site"in e&&e.site?e?.site:void 0}function Ju(){let e=`
|
|
30
30
|
\xB7\xB7
|
|
31
31
|
\xB7\xB7 /
|
|
32
32
|
\xB7\xB7 / //
|
|
@@ -58,7 +58,7 @@ ${p}
|
|
|
58
58
|
${y}
|
|
59
59
|
|
|
60
60
|
=============
|
|
61
|
-
`)),r&&(typeof t?.attempt!="number"||t.attempt>=parseInt(Ku))&&process.exit(1)}var pp=process.env.API_URL,mp={GET_ALL:`${pp}/domains`},Dr=class{static async getAll(){let{GET_ALL:t}=mp;return await Zu({endpoint:t})}};async function el(){await fr.login();let e=await Dr.getAll();return yp(e)}function yp(e){let t=e.filter(({slug:r})=>!!r).map(({slug:r})=>r.replace("/",""));return[...new Set(t)]}hr().config();var ai=["dist","assets","apiCache",".cache"],tl=["public",".store"],gp=ci.default.sync(),vp=It.default.resolve(gp,"exports/sites"),il=ci.default.sync(__dirname),bp=e=>t=>wp(t,e),wp=(e,t={})=>(0,nl.execSync)(e,{cwd:il,stdio:"inherit",env:{...process.env,...t,GRIDDO_EXPORTER:"true"}}),_p=e=>!process.env.GRIDDO_ASSET_PREFIX||!e||!e.startsWith("pro-")?"":`${process.env.GRIDDO_ASSET_PREFIX}/${e}`,rl=(...e)=>console.log(...e),Nt=(...e)=>console.log(...e),xp=(...e)=>console.log(...e),Ue=(...e)=>console.log(...e),Ep=async e=>{let t=kp(e);t.init(),t.restoreArtifacts(),t.runExporter(),t.archiveArtifacts()},Sp=async()=>{Ju(),ss();let e=await el();for(let t of e)Nt(`\uFE0F\u{1F6A2} Exporting domain ${Q.default.underline(t)}`),await Ep(t)},kp=e=>{let t=_p(e),r=bp({DOMAIN:e,
|
|
61
|
+
`)),r&&(typeof t?.attempt!="number"||t.attempt>=parseInt(Ku))&&process.exit(1)}var pp=process.env.API_URL,mp={GET_ALL:`${pp}/domains`},Dr=class{static async getAll(){let{GET_ALL:t}=mp;return await Zu({endpoint:t})}};async function el(){await fr.login();let e=await Dr.getAll();return yp(e)}function yp(e){let t=e.filter(({slug:r})=>!!r).map(({slug:r})=>r.replace("/",""));return[...new Set(t)]}hr().config();var ai=["dist","assets","apiCache",".cache"],tl=["public",".store"],gp=ci.default.sync(),vp=It.default.resolve(gp,"exports/sites"),il=ci.default.sync(__dirname),bp=e=>t=>wp(t,e),wp=(e,t={})=>(0,nl.execSync)(e,{cwd:il,stdio:"inherit",env:{...process.env,...t,GRIDDO_EXPORTER:"true"}}),_p=e=>!process.env.GRIDDO_ASSET_PREFIX||!e||!e.startsWith("pro-")?"":`${process.env.GRIDDO_ASSET_PREFIX}/${e}`,rl=(...e)=>console.log(...e),Nt=(...e)=>console.log(...e),xp=(...e)=>console.log(...e),Ue=(...e)=>console.log(...e),Ep=async e=>{let t=kp(e);t.init(),t.restoreArtifacts(),t.runExporter(),t.archiveArtifacts()},Sp=async()=>{Ju(),ss();let e=await el();for(let t of e)Nt(`\uFE0F\u{1F6A2} Exporting domain ${Q.default.underline(t)}`),await Ep(t)},kp=e=>{let t=_p(e),r=bp({DOMAIN:e,GRIDDO_ASSET_PREFIX:t,HAS_ASSET_DOMAIN:t&&t!=="",RENDERID:new Date().valueOf()}),n=()=>{Nt(`\u{1F680} Initializing ${Q.default.underline(e)} exporter`),s(),o()},i=(S="")=>{let C=It.default.resolve(vp,e),P=It.default.resolve(C,S),J=`${P}-BACKUP`,de=It.default.resolve(il,S);return{domainExportArchiveBasePath:C,currentExportArchivePath:P,currentExportBackupPath:J,currentExportWorkingPath:de}},s=()=>{for(let S of[...ai,...tl]){let{currentExportWorkingPath:C}=i(S);Se.default.existsSync(C)&&(Ue(`\u{1F9F9} Cleanup dirty ${Q.default.gray(C)}`),r(`rm -rf ${C}`))}},o=()=>{let{domainExportArchiveBasePath:S}=i();Se.default.existsSync(S)||(Nt(`\u2728 Creating ${S}`),r(`mkdir -p ${S}`))},a=S=>{let{currentExportArchivePath:C,currentExportWorkingPath:P}=i(S);Nt(`\u{1F69A} Moving files from ${Q.default.gray(P)} to ${Q.default.gray(C)}`),r(`mv ${P} ${C}`)},c=()=>{for(let S of ai){let{currentExportWorkingPath:C,currentExportArchivePath:P}=i(S);if(!Se.default.existsSync(C)){rl("\u{1F4C1} Source directory has not been created:",C);continue}try{h(S),a(S),y(S)}catch(J){rl(`\u{1F69A} Error moving files to ${P}`,J.message),p(S);continue}}},d=()=>{for(let S of ai){let{currentExportArchivePath:C,currentExportWorkingPath:P}=i(S);Se.default.existsSync(C)&&(Ue(`\uFE0F\u267B\uFE0F Restoring ${Q.default.gray(C)}`),r(`cp -R ${C} ${P}`))}w()},h=S=>{let{currentExportArchivePath:C,currentExportBackupPath:P}=i(S);Se.default.existsSync(C)&&(Nt(`\u{1F4BF} Creating backup of ${Q.default.gray(C)}`),r(`mv ${C} ${P}`))},p=S=>{let{currentExportArchivePath:C,currentExportBackupPath:P}=i(S);Se.default.existsSync(P)&&(Ue(`\uFE0F\u267B\uFE0F Restoring backup ${Q.default.gray(C)}`),r(`mv ${P} ${C}`))},y=S=>{let{currentExportArchivePath:C,currentExportBackupPath:P}=i(S);Ue(`\uFE0F\u274C Removing backup ${Q.default.gray(C)}`),r(`rm -rf ${P}`)},m=()=>{console.log(`
|
|
62
62
|
${Q.default.black(Q.default.bgGreen(" Gatsby (start) "))}
|
|
63
63
|
`),r("yarn export"),xp("Your sites have been exported correctly"),console.log(`
|
|
64
64
|
${Q.default.black(Q.default.bgGreen(" Gatsby (end) "))}
|
package/gatsby-config.ts
CHANGED
|
@@ -13,9 +13,7 @@ dotenv.config();
|
|
|
13
13
|
const GRIDDO_ASSET_PREFIX = process.env.GRIDDO_ASSET_PREFIX || undefined;
|
|
14
14
|
|
|
15
15
|
// Gatsby configuration file from client
|
|
16
|
-
const { plugins, ...gatsbyConfig } = require(resolveComponentsPath(
|
|
17
|
-
"builder.config.js"
|
|
18
|
-
));
|
|
16
|
+
const { plugins, ...gatsbyConfig } = require(resolveComponentsPath("builder.config.js"));
|
|
19
17
|
|
|
20
18
|
const config: GatsbyConfig = {
|
|
21
19
|
// cliente config
|
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": "1.75.
|
|
4
|
+
"version": "1.75.191",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@babel/preset-env": "^7.14.5",
|
|
38
38
|
"@babel/preset-react": "^7.14.5",
|
|
39
39
|
"@babel/preset-typescript": "^7.16.5",
|
|
40
|
-
"@griddo/core": "^1.75.
|
|
40
|
+
"@griddo/core": "^1.75.191",
|
|
41
41
|
"@svgr/webpack": "^5.5.0",
|
|
42
42
|
"babel-loader": "^8.0.6",
|
|
43
43
|
"babel-plugin-styled-components": "^1.10.7",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"react-helmet": "^6.0.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@griddo/eslint-config-back": "^1.75.
|
|
72
|
+
"@griddo/eslint-config-back": "^1.75.191",
|
|
73
73
|
"@types/babel__core": "^7.20.0",
|
|
74
74
|
"@types/babel__preset-env": "^7.9.2",
|
|
75
75
|
"@types/csvtojson": "^2.0.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"publishConfig": {
|
|
118
118
|
"access": "public"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "3c227dce9eb8681ea9a348d207326a1e24aaf599"
|
|
121
121
|
}
|
|
@@ -95,7 +95,7 @@ const getDomainRunner = (domain: string) => {
|
|
|
95
95
|
|
|
96
96
|
const run = getEnvRunner({
|
|
97
97
|
DOMAIN: domain,
|
|
98
|
-
|
|
98
|
+
GRIDDO_ASSET_PREFIX: assetPrefix,
|
|
99
99
|
HAS_ASSET_DOMAIN: assetPrefix && assetPrefix !== "",
|
|
100
100
|
RENDERID: new Date().valueOf(),
|
|
101
101
|
});
|
|
@@ -108,14 +108,8 @@ const getDomainRunner = (domain: string) => {
|
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
const getArtifactPaths = (artifact = "") => {
|
|
111
|
-
const domainExportArchiveBasePath = path.resolve(
|
|
112
|
-
|
|
113
|
-
domain
|
|
114
|
-
);
|
|
115
|
-
const currentExportArchivePath = path.resolve(
|
|
116
|
-
domainExportArchiveBasePath,
|
|
117
|
-
artifact
|
|
118
|
-
);
|
|
111
|
+
const domainExportArchiveBasePath = path.resolve(exportArchiveBasePath, domain);
|
|
112
|
+
const currentExportArchivePath = path.resolve(domainExportArchiveBasePath, artifact);
|
|
119
113
|
const currentExportBackupPath = `${currentExportArchivePath}-BACKUP`;
|
|
120
114
|
const currentExportWorkingPath = path.resolve(workingPath, artifact);
|
|
121
115
|
|
|
@@ -148,27 +142,18 @@ const getDomainRunner = (domain: string) => {
|
|
|
148
142
|
};
|
|
149
143
|
|
|
150
144
|
const archiveExportArtifact = (artifact: string) => {
|
|
151
|
-
const { currentExportArchivePath, currentExportWorkingPath } =
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
logInfo(
|
|
155
|
-
`🚚 Moving files from ${chalk.gray(
|
|
156
|
-
currentExportWorkingPath
|
|
157
|
-
)} to ${chalk.gray(currentExportArchivePath)}`
|
|
158
|
-
);
|
|
145
|
+
const { currentExportArchivePath, currentExportWorkingPath } = getArtifactPaths(artifact);
|
|
146
|
+
|
|
147
|
+
logInfo(`🚚 Moving files from ${chalk.gray(currentExportWorkingPath)} to ${chalk.gray(currentExportArchivePath)}`);
|
|
159
148
|
run(`mv ${currentExportWorkingPath} ${currentExportArchivePath}`);
|
|
160
149
|
};
|
|
161
150
|
|
|
162
151
|
const archiveArtifacts = () => {
|
|
163
152
|
for (const artifact of artifactsArchivable) {
|
|
164
|
-
const { currentExportWorkingPath, currentExportArchivePath } =
|
|
165
|
-
getArtifactPaths(artifact);
|
|
153
|
+
const { currentExportWorkingPath, currentExportArchivePath } = getArtifactPaths(artifact);
|
|
166
154
|
|
|
167
155
|
if (!fs.existsSync(currentExportWorkingPath)) {
|
|
168
|
-
logError(
|
|
169
|
-
"📁 Source directory has not been created:",
|
|
170
|
-
currentExportWorkingPath
|
|
171
|
-
);
|
|
156
|
+
logError("📁 Source directory has not been created:", currentExportWorkingPath);
|
|
172
157
|
continue;
|
|
173
158
|
}
|
|
174
159
|
|
|
@@ -177,10 +162,7 @@ const getDomainRunner = (domain: string) => {
|
|
|
177
162
|
archiveExportArtifact(artifact);
|
|
178
163
|
deleteArtifactBackup(artifact);
|
|
179
164
|
} catch (error) {
|
|
180
|
-
logError(
|
|
181
|
-
`🚚 Error moving files to ${currentExportArchivePath}`,
|
|
182
|
-
error.message
|
|
183
|
-
);
|
|
165
|
+
logError(`🚚 Error moving files to ${currentExportArchivePath}`, error.message);
|
|
184
166
|
restoreArtifactBackup(artifact);
|
|
185
167
|
continue;
|
|
186
168
|
}
|
|
@@ -189,8 +171,7 @@ const getDomainRunner = (domain: string) => {
|
|
|
189
171
|
|
|
190
172
|
const restoreArtifacts = () => {
|
|
191
173
|
for (const artifact of artifactsArchivable) {
|
|
192
|
-
const { currentExportArchivePath, currentExportWorkingPath } =
|
|
193
|
-
getArtifactPaths(artifact);
|
|
174
|
+
const { currentExportArchivePath, currentExportWorkingPath } = getArtifactPaths(artifact);
|
|
194
175
|
|
|
195
176
|
if (fs.existsSync(currentExportArchivePath)) {
|
|
196
177
|
logWarning(`️♻️ Restoring ${chalk.gray(currentExportArchivePath)}`);
|
|
@@ -202,8 +183,7 @@ const getDomainRunner = (domain: string) => {
|
|
|
202
183
|
};
|
|
203
184
|
|
|
204
185
|
const createArtifactBackup = (artifact: string) => {
|
|
205
|
-
const { currentExportArchivePath, currentExportBackupPath } =
|
|
206
|
-
getArtifactPaths(artifact);
|
|
186
|
+
const { currentExportArchivePath, currentExportBackupPath } = getArtifactPaths(artifact);
|
|
207
187
|
|
|
208
188
|
if (fs.existsSync(currentExportArchivePath)) {
|
|
209
189
|
logInfo(`💿 Creating backup of ${chalk.gray(currentExportArchivePath)}`);
|
|
@@ -212,20 +192,16 @@ const getDomainRunner = (domain: string) => {
|
|
|
212
192
|
};
|
|
213
193
|
|
|
214
194
|
const restoreArtifactBackup = (artifact: string) => {
|
|
215
|
-
const { currentExportArchivePath, currentExportBackupPath } =
|
|
216
|
-
getArtifactPaths(artifact);
|
|
195
|
+
const { currentExportArchivePath, currentExportBackupPath } = getArtifactPaths(artifact);
|
|
217
196
|
|
|
218
197
|
if (fs.existsSync(currentExportBackupPath)) {
|
|
219
|
-
logWarning(
|
|
220
|
-
`️♻️ Restoring backup ${chalk.gray(currentExportArchivePath)}`
|
|
221
|
-
);
|
|
198
|
+
logWarning(`️♻️ Restoring backup ${chalk.gray(currentExportArchivePath)}`);
|
|
222
199
|
run(`mv ${currentExportBackupPath} ${currentExportArchivePath}`);
|
|
223
200
|
}
|
|
224
201
|
};
|
|
225
202
|
|
|
226
203
|
const deleteArtifactBackup = (artifact: string) => {
|
|
227
|
-
const { currentExportArchivePath, currentExportBackupPath } =
|
|
228
|
-
getArtifactPaths(artifact);
|
|
204
|
+
const { currentExportArchivePath, currentExportBackupPath } = getArtifactPaths(artifact);
|
|
229
205
|
|
|
230
206
|
logWarning(`️❌ Removing backup ${chalk.gray(currentExportArchivePath)}`);
|
|
231
207
|
run(`rm -rf ${currentExportBackupPath}`);
|
|
@@ -248,9 +224,7 @@ const getDomainRunner = (domain: string) => {
|
|
|
248
224
|
const { currentExportWorkingPath: publicPath } = getArtifactPaths("public");
|
|
249
225
|
|
|
250
226
|
if (fs.existsSync(distPath)) {
|
|
251
|
-
logWarning(
|
|
252
|
-
`🚚 Moving ${chalk.gray(distPath)} to ${chalk.gray(publicPath)}`
|
|
253
|
-
);
|
|
227
|
+
logWarning(`🚚 Moving ${chalk.gray(distPath)} to ${chalk.gray(publicPath)}`);
|
|
254
228
|
run(`mv ${distPath} ${publicPath}`);
|
|
255
229
|
}
|
|
256
230
|
};
|
|
@@ -269,8 +243,7 @@ const getDomainRunner = (domain: string) => {
|
|
|
269
243
|
|
|
270
244
|
const removeDisposableArtifacts = () => {
|
|
271
245
|
for (const artifact of artifactsDisposable) {
|
|
272
|
-
const { currentExportWorkingPath: artifactPath } =
|
|
273
|
-
getArtifactPaths(artifact);
|
|
246
|
+
const { currentExportWorkingPath: artifactPath } = getArtifactPaths(artifact);
|
|
274
247
|
|
|
275
248
|
if (fs.existsSync(artifactPath)) {
|
|
276
249
|
logWarning(`❌ Removing ${chalk.gray(artifactPath)}`);
|