@griddo/cx 1.75.188 → 1.75.190
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/gatsby-node.ts +3 -4
- package/package.json +119 -119
- package/scripts/griddo-exporter.ts +16 -43
- package/src/services/store.ts +3 -5
- package/src/types/api.ts +1 -0
- package/src/services/store-with-for-loop.ts +0 -513
- package/src/services/store-with-promise-all.ts +0 -515
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.190";$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/gatsby-node.ts
CHANGED
|
@@ -36,9 +36,7 @@ const isMonorepo = !isComponentLibraryEnv;
|
|
|
36
36
|
// onPreInit
|
|
37
37
|
// -----------------------------------------------------------------------------
|
|
38
38
|
export const onPreInit = async () => {
|
|
39
|
-
if (isMonorepo)
|
|
40
|
-
splash();
|
|
41
|
-
}
|
|
39
|
+
if (isMonorepo) splash();
|
|
42
40
|
|
|
43
41
|
initCache();
|
|
44
42
|
prepareStaticFolder();
|
|
@@ -73,8 +71,9 @@ export const createPages: GatsbyNode["createPages"] = async ({ actions }) => {
|
|
|
73
71
|
}
|
|
74
72
|
|
|
75
73
|
console.info(
|
|
76
|
-
`Total page-data.json
|
|
74
|
+
`Total page-data.json size: ${(totalPagesSize / 1024).toFixed(3)}MB`
|
|
77
75
|
);
|
|
76
|
+
|
|
78
77
|
console.log("\n✨ createPages\n");
|
|
79
78
|
};
|
|
80
79
|
|
package/package.json
CHANGED
|
@@ -1,121 +1,121 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
2
|
+
"name": "@griddo/cx",
|
|
3
|
+
"description": "Griddo SSG based on Gatsby",
|
|
4
|
+
"version": "1.75.190",
|
|
5
|
+
"authors": [
|
|
6
|
+
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
|
+
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
8
|
+
"Francis Vega <francis.vega@secuoyas.com>",
|
|
9
|
+
"Gonzalo Hernández <gonzalo.hernandez@secuoyas.com>",
|
|
10
|
+
"Sergio Ródenas <sergio.rodenas@secuoyas.com>",
|
|
11
|
+
"Txema León <txema.leon@secuoyas.com>"
|
|
12
|
+
],
|
|
13
|
+
"license": "UNLICENSED",
|
|
14
|
+
"homepage": "https://griddo.io",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/griddo/griddo"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"griddo-cx": "./index.js"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"start": "gatsby develop -H 0.0.0.0",
|
|
24
|
+
"build": "yarn run build:exporter",
|
|
25
|
+
"build:exporter": "esbuild ./scripts/griddo-exporter.ts --bundle --platform=node --minify --outfile=./build/index.js",
|
|
26
|
+
"build:serve": "IS_SERVE=true gatsby build --prefix-paths && gatsby serve",
|
|
27
|
+
"export": "gatsby build --prefix-paths",
|
|
28
|
+
"clean": "gatsby clean; rm -rf .cache public assets dist build .store",
|
|
29
|
+
"serve": "gatsby serve",
|
|
30
|
+
"format": "prettier --write .",
|
|
31
|
+
"prepare": "yarn run build:exporter",
|
|
32
|
+
"watch:tscheck": "tsc --noEmit --watch"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@babel/core": "^7.21.0",
|
|
36
|
+
"@babel/plugin-proposal-class-properties": "^7.7.4",
|
|
37
|
+
"@babel/preset-env": "^7.14.5",
|
|
38
|
+
"@babel/preset-react": "^7.14.5",
|
|
39
|
+
"@babel/preset-typescript": "^7.16.5",
|
|
40
|
+
"@griddo/core": "^1.75.190",
|
|
41
|
+
"@svgr/webpack": "^5.5.0",
|
|
42
|
+
"babel-loader": "^8.0.6",
|
|
43
|
+
"babel-plugin-styled-components": "^1.10.7",
|
|
44
|
+
"babel-plugin-transform-runtime": "^6.23.0",
|
|
45
|
+
"babel-polyfill": "^6.26.0",
|
|
46
|
+
"branch-name": "^1.0.0",
|
|
47
|
+
"chalk": "^2.4.2",
|
|
48
|
+
"csvtojson": "^2.0.10",
|
|
49
|
+
"dotenv": "^8.1.0",
|
|
50
|
+
"find-up": "^5.0.0",
|
|
51
|
+
"fs-extra": "^9.0.1",
|
|
52
|
+
"gatsby": "^4.8.0",
|
|
53
|
+
"gatsby-plugin-no-sourcemaps": "^4.8.0",
|
|
54
|
+
"gatsby-plugin-polyfill-io": "^1.1.0",
|
|
55
|
+
"gatsby-plugin-provide-react": "^1.0.2",
|
|
56
|
+
"gatsby-plugin-react-helmet": "^5.8.0",
|
|
57
|
+
"gatsby-plugin-react-svg": "^3.1.0",
|
|
58
|
+
"gatsby-plugin-sass": "^5.21.0",
|
|
59
|
+
"gatsby-plugin-styled-components": "^5.8.0",
|
|
60
|
+
"gradient-string": "^2.0.2",
|
|
61
|
+
"html-react-parser": "^1.4.10",
|
|
62
|
+
"js2xmlparser": "^4.0.1",
|
|
63
|
+
"node-sass": "^6.0.0",
|
|
64
|
+
"opn": "^6.0.0",
|
|
65
|
+
"p-limit": "^3.0.0",
|
|
66
|
+
"path-browserify": "^1.0.1",
|
|
67
|
+
"pkg-dir": "^5.0.0",
|
|
68
|
+
"process": "^0.11.10",
|
|
69
|
+
"react-helmet": "^6.0.0"
|
|
70
|
+
},
|
|
71
|
+
"devDependencies": {
|
|
72
|
+
"@griddo/eslint-config-back": "^1.75.190",
|
|
73
|
+
"@types/babel__core": "^7.20.0",
|
|
74
|
+
"@types/babel__preset-env": "^7.9.2",
|
|
75
|
+
"@types/csvtojson": "^2.0.0",
|
|
76
|
+
"@types/eslint": "^7.29.0",
|
|
77
|
+
"@types/fs-extra": "^9.0.13",
|
|
78
|
+
"@types/gradient-string": "^1.1.2",
|
|
79
|
+
"@types/node-sass": "^4.11.3",
|
|
80
|
+
"@types/prettier": "2.7.2",
|
|
81
|
+
"@types/react": "18.0.28",
|
|
82
|
+
"@types/react-dom": "18.0.11",
|
|
83
|
+
"@types/react-helmet": "^6.1.6",
|
|
84
|
+
"@types/webpack": "^5.28.0",
|
|
85
|
+
"eslint": "^7.5.0",
|
|
86
|
+
"eslint-plugin-node": "^11.1.0",
|
|
87
|
+
"eslint-plugin-react": "7.14.3",
|
|
88
|
+
"prettier": "2.0.4"
|
|
89
|
+
},
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"axios": "*",
|
|
92
|
+
"react": "*",
|
|
93
|
+
"react-dom": "*"
|
|
94
|
+
},
|
|
95
|
+
"engines": {
|
|
96
|
+
"node": ">=16.17.0"
|
|
97
|
+
},
|
|
98
|
+
"files": [
|
|
99
|
+
".babelrc",
|
|
100
|
+
"build",
|
|
101
|
+
"gatsby-browser.tsx",
|
|
102
|
+
"gatsby-config.ts",
|
|
103
|
+
"gatsby-node.ts",
|
|
104
|
+
"gatsby-ssr.tsx",
|
|
105
|
+
"index.js",
|
|
106
|
+
"scripts",
|
|
107
|
+
"src",
|
|
108
|
+
"static"
|
|
109
|
+
],
|
|
110
|
+
"keywords": [
|
|
111
|
+
"gatsby",
|
|
112
|
+
"griddo",
|
|
113
|
+
"secuoyas",
|
|
114
|
+
"typescript",
|
|
115
|
+
"SSG"
|
|
116
|
+
],
|
|
117
|
+
"publishConfig": {
|
|
118
|
+
"access": "public"
|
|
119
|
+
},
|
|
120
|
+
"gitHead": "202634ce8976df3277aac6860cbb1f7cb83f1a45"
|
|
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)}`);
|
package/src/services/store.ts
CHANGED
|
@@ -179,7 +179,7 @@ class StoreService {
|
|
|
179
179
|
await RobotsService.loadRobots();
|
|
180
180
|
|
|
181
181
|
// Array of sites (Promises)
|
|
182
|
-
const
|
|
182
|
+
for (const site of sitesToPublish) {
|
|
183
183
|
// Gets
|
|
184
184
|
const { id: siteId, slug: siteSlug, theme, favicon } = site;
|
|
185
185
|
|
|
@@ -269,6 +269,7 @@ class StoreService {
|
|
|
269
269
|
// Get page data
|
|
270
270
|
const page = await SitesService.getPage(pageId, shouldUpdateSite);
|
|
271
271
|
|
|
272
|
+
// Probably a 404
|
|
272
273
|
if (!page) return;
|
|
273
274
|
|
|
274
275
|
// Update Array of page ids
|
|
@@ -308,7 +309,6 @@ class StoreService {
|
|
|
308
309
|
|
|
309
310
|
// List
|
|
310
311
|
if (page?.mode === "list") {
|
|
311
|
-
// of data items and the `itemsPerPage` prop.
|
|
312
312
|
gatsbyPageObjects = await createGriddoListPages(
|
|
313
313
|
{
|
|
314
314
|
...page, // Revisar la inclusión de este ...page.
|
|
@@ -382,9 +382,7 @@ class StoreService {
|
|
|
382
382
|
);
|
|
383
383
|
|
|
384
384
|
await Promise.all(pagesToRender);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
await Promise.all(promisesOfSitesToPublish);
|
|
385
|
+
}
|
|
388
386
|
} catch (e) {
|
|
389
387
|
const error = e as { message: string };
|
|
390
388
|
|
package/src/types/api.ts
CHANGED