@griddo/cx 1.75.193 → 1.75.196
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 +38 -39
- package/gatsby-browser.tsx +2 -10
- package/gatsby-config.ts +9 -9
- package/gatsby-node.ts +37 -76
- package/gatsby-ssr.tsx +2 -9
- package/package.json +4 -9
- package/scripts/griddo-exporter.ts +241 -240
- package/src/components/Head.tsx +2 -9
- package/src/components/template.tsx +3 -13
- package/src/components/types.ts +2 -2
- package/src/components/utils.ts +6 -8
- package/src/html.tsx +3 -1
- package/src/services/auth.ts +2 -1
- package/src/services/distributors.ts +21 -12
- package/src/services/domains.ts +1 -3
- package/src/services/navigation.ts +0 -1
- package/src/services/robots.ts +1 -4
- package/src/services/settings.ts +0 -2
- package/src/services/sites.ts +2 -5
- package/src/services/store.ts +46 -39
- package/src/types/api.ts +15 -5
- package/src/types/global.ts +9 -3
- package/src/types/pages.ts +11 -3
- package/src/types/sites.ts +6 -4
- package/src/types/templates.ts +0 -1
- package/src/utils/api.ts +30 -25
- package/src/utils/cache.ts +5 -7
- package/src/utils/domains.ts +0 -2
- package/src/utils/folders.ts +3 -20
- package/src/utils/gatsby.ts +41 -0
- package/src/utils/instance.ts +9 -8
- package/src/utils/pages.ts +15 -12
- package/src/utils/searches.ts +0 -2
- package/src/utils/shared.ts +46 -22
- package/src/utils/sites.ts +35 -22
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
4
4
|
/* eslint-disable node/shebang */
|
|
5
5
|
|
|
6
|
-
require("dotenv").config();
|
|
7
|
-
|
|
8
|
-
// External libraries
|
|
9
|
-
import chalk from "chalk";
|
|
10
6
|
import { execSync } from "child_process";
|
|
11
7
|
import fs from "fs";
|
|
12
8
|
import path from "path";
|
|
9
|
+
|
|
10
|
+
import chalk from "chalk";
|
|
11
|
+
import dotenv from "dotenv";
|
|
13
12
|
import pkgDir from "pkg-dir";
|
|
14
13
|
|
|
15
|
-
// Utils
|
|
16
14
|
import { initCache } from "../src/utils/cache";
|
|
17
15
|
import { findDomains } from "../src/utils/domains";
|
|
18
16
|
import { exporterLogo as splash, measureFunctions } from "../src/utils/shared";
|
|
19
17
|
|
|
18
|
+
dotenv.config();
|
|
19
|
+
|
|
20
20
|
// Envs
|
|
21
21
|
const artifactsArchivable = ["dist", "assets", "apiCache", ".cache"];
|
|
22
22
|
const artifactsDisposable = ["public", ".store"];
|
|
@@ -39,24 +39,24 @@ type Env = Record<string, unknown>;
|
|
|
39
39
|
const getEnvRunner = (env: Env) => (command: string) => runner(command, env);
|
|
40
40
|
|
|
41
41
|
const runner = (command: string, env: Env = {}) =>
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
// TODO: Cuando esto falle, ejecutar `cleanAfterFail`
|
|
43
|
+
execSync(command, {
|
|
44
|
+
cwd: workingPath,
|
|
45
|
+
stdio: "inherit",
|
|
46
|
+
env: {
|
|
47
|
+
...process.env,
|
|
48
|
+
...env,
|
|
49
|
+
GRIDDO_EXPORTER: "true",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
52
|
|
|
53
53
|
const getAssetPrefix = (domain: string) => {
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
// TODO: Usar asset_prefix del dominio
|
|
55
|
+
if (!process.env.GRIDDO_ASSET_PREFIX || !domain) return "";
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
if (!domain.startsWith("pro-")) return "";
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
return `${process.env.GRIDDO_ASSET_PREFIX}/${domain}`;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
// -----------------------------------------------------------------------------
|
|
@@ -71,240 +71,241 @@ const logWarning = (...message: Array<any>) => console.log(...message);
|
|
|
71
71
|
// Main Stuff
|
|
72
72
|
// -----------------------------------------------------------------------------
|
|
73
73
|
const domainExport = async (domain: string) => {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
const runner = getDomainRunner(domain);
|
|
75
|
+
// onPreExporter
|
|
76
|
+
const endRestore = measureFunctions(runner.init, runner.restoreArtifacts);
|
|
77
|
+
logInfo(`\n⌛️ Domain ${domain} restaured: ${endRestore}s`);
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
// Gatsby
|
|
80
|
+
runner.runExporter();
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
// onPostExporter
|
|
83
|
+
const endArchive = measureFunctions(runner.archiveArtifacts);
|
|
84
|
+
logInfo(`\n⌛️ Domain ${domain} archived: ${endArchive}s`);
|
|
85
85
|
};
|
|
86
86
|
|
|
87
87
|
const launchExports = async () => {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
splash();
|
|
89
|
+
initCache();
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
const domains = await findDomains();
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
for (const domain of domains) {
|
|
94
|
+
logInfo(`️🚢 Exporting domain ${chalk.underline(domain)}`);
|
|
95
|
+
await domainExport(domain);
|
|
96
|
+
}
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
const getDomainRunner = (domain: string) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
100
|
+
const assetPrefix = getAssetPrefix(domain);
|
|
101
|
+
|
|
102
|
+
const run = getEnvRunner({
|
|
103
|
+
DOMAIN: domain,
|
|
104
|
+
GRIDDO_ASSET_PREFIX: assetPrefix,
|
|
105
|
+
HAS_ASSET_DOMAIN: assetPrefix && assetPrefix !== "",
|
|
106
|
+
RENDERID: new Date().valueOf(),
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const init = () => {
|
|
110
|
+
logInfo(`🚀 Initializing ${chalk.underline(domain)} exporter`);
|
|
111
|
+
|
|
112
|
+
cleanDirtyArtifactPaths();
|
|
113
|
+
createBaseExportPaths();
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const getArtifactPaths = (artifact = "") => {
|
|
117
|
+
const domainExportArchiveBasePath = path.resolve(
|
|
118
|
+
exportArchiveBasePath,
|
|
119
|
+
domain
|
|
120
|
+
);
|
|
121
|
+
const currentExportArchivePath = path.resolve(
|
|
122
|
+
domainExportArchiveBasePath,
|
|
123
|
+
artifact
|
|
124
|
+
);
|
|
125
|
+
const currentExportBackupPath = `${currentExportArchivePath}-BACKUP`;
|
|
126
|
+
const currentExportWorkingPath = path.resolve(workingPath, artifact);
|
|
127
|
+
|
|
128
|
+
return {
|
|
129
|
+
domainExportArchiveBasePath,
|
|
130
|
+
currentExportArchivePath,
|
|
131
|
+
currentExportBackupPath,
|
|
132
|
+
currentExportWorkingPath,
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const cleanDirtyArtifactPaths = () => {
|
|
137
|
+
for (const artifact of [...artifactsArchivable, ...artifactsDisposable]) {
|
|
138
|
+
const { currentExportWorkingPath } = getArtifactPaths(artifact);
|
|
139
|
+
|
|
140
|
+
if (fs.existsSync(currentExportWorkingPath)) {
|
|
141
|
+
logWarning(`🧹 Cleanup dirty ${chalk.gray(currentExportWorkingPath)}`);
|
|
142
|
+
run(`rm -rf ${currentExportWorkingPath}`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const createBaseExportPaths = () => {
|
|
148
|
+
const { domainExportArchiveBasePath } = getArtifactPaths();
|
|
149
|
+
|
|
150
|
+
if (!fs.existsSync(domainExportArchiveBasePath)) {
|
|
151
|
+
logInfo(`✨ Creating ${domainExportArchiveBasePath}`);
|
|
152
|
+
run(`mkdir -p ${domainExportArchiveBasePath}`);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const archiveExportArtifact = (artifact: string) => {
|
|
157
|
+
const { currentExportArchivePath, currentExportWorkingPath } =
|
|
158
|
+
getArtifactPaths(artifact);
|
|
159
|
+
|
|
160
|
+
logInfo(
|
|
161
|
+
`🚚 Moving files from ${chalk.gray(
|
|
162
|
+
currentExportWorkingPath
|
|
163
|
+
)} to ${chalk.gray(currentExportArchivePath)}`
|
|
164
|
+
);
|
|
165
|
+
run(`mv ${currentExportWorkingPath} ${currentExportArchivePath}`);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const archiveArtifacts = () => {
|
|
169
|
+
for (const artifact of artifactsArchivable) {
|
|
170
|
+
const { currentExportWorkingPath, currentExportArchivePath } =
|
|
171
|
+
getArtifactPaths(artifact);
|
|
172
|
+
|
|
173
|
+
if (!fs.existsSync(currentExportWorkingPath)) {
|
|
174
|
+
logError(
|
|
175
|
+
"📁 Source directory has not been created:",
|
|
176
|
+
currentExportWorkingPath
|
|
177
|
+
);
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
try {
|
|
182
|
+
createArtifactBackup(artifact);
|
|
183
|
+
archiveExportArtifact(artifact);
|
|
184
|
+
deleteArtifactBackup(artifact);
|
|
185
|
+
} catch (error) {
|
|
186
|
+
logError(
|
|
187
|
+
`🚚 Error moving files to ${currentExportArchivePath}`,
|
|
188
|
+
error.message
|
|
189
|
+
);
|
|
190
|
+
restoreArtifactBackup(artifact);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
const restoreArtifacts = () => {
|
|
197
|
+
for (const artifact of artifactsArchivable) {
|
|
198
|
+
const { currentExportArchivePath, currentExportWorkingPath } =
|
|
199
|
+
getArtifactPaths(artifact);
|
|
200
|
+
|
|
201
|
+
if (fs.existsSync(currentExportArchivePath)) {
|
|
202
|
+
logWarning(`️♻️ Restoring ${chalk.gray(currentExportArchivePath)}`);
|
|
203
|
+
run(`cp -R ${currentExportArchivePath} ${currentExportWorkingPath}`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
moveDistToPublic();
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const createArtifactBackup = (artifact: string) => {
|
|
211
|
+
const { currentExportArchivePath, currentExportBackupPath } =
|
|
212
|
+
getArtifactPaths(artifact);
|
|
213
|
+
|
|
214
|
+
if (fs.existsSync(currentExportArchivePath)) {
|
|
215
|
+
logInfo(`💿 Creating backup of ${chalk.gray(currentExportArchivePath)}`);
|
|
216
|
+
run(`mv ${currentExportArchivePath} ${currentExportBackupPath}`);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
const restoreArtifactBackup = (artifact: string) => {
|
|
221
|
+
const { currentExportArchivePath, currentExportBackupPath } =
|
|
222
|
+
getArtifactPaths(artifact);
|
|
223
|
+
|
|
224
|
+
if (fs.existsSync(currentExportBackupPath)) {
|
|
225
|
+
logWarning(
|
|
226
|
+
`️♻️ Restoring backup ${chalk.gray(currentExportArchivePath)}`
|
|
227
|
+
);
|
|
228
|
+
run(`mv ${currentExportBackupPath} ${currentExportArchivePath}`);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
const deleteArtifactBackup = (artifact: string) => {
|
|
233
|
+
const { currentExportArchivePath, currentExportBackupPath } =
|
|
234
|
+
getArtifactPaths(artifact);
|
|
235
|
+
|
|
236
|
+
logWarning(`️🗑️ Removing backup ${chalk.gray(currentExportArchivePath)}`);
|
|
237
|
+
run(`rm -rf ${currentExportBackupPath}`);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const runExporter = () => {
|
|
241
|
+
console.log(`\n${chalk.black(chalk.bgGreen(" Gatsby (start) "))}\n`);
|
|
242
|
+
|
|
243
|
+
run("yarn export");
|
|
244
|
+
// run("cp build-report.json build-report-${domain}.json")
|
|
245
|
+
logSuccess("Your sites have been exported correctly");
|
|
246
|
+
|
|
247
|
+
console.log(`\n${chalk.black(chalk.bgGreen(" Gatsby (end) "))}\n`);
|
|
248
|
+
|
|
249
|
+
removeDisposableArtifacts();
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
// TODO: Hacer que infra tire de `public` en vez de `dist` y quitar esto
|
|
253
|
+
const moveDistToPublic = () => {
|
|
254
|
+
const { currentExportWorkingPath: distPath } = getArtifactPaths("dist");
|
|
255
|
+
const { currentExportWorkingPath: publicPath } = getArtifactPaths("public");
|
|
256
|
+
|
|
257
|
+
if (fs.existsSync(distPath)) {
|
|
258
|
+
logWarning(
|
|
259
|
+
`🚚 Moving ${chalk.gray(distPath)} to ${chalk.gray(publicPath)}`
|
|
260
|
+
);
|
|
261
|
+
run(`mv ${distPath} ${publicPath}`);
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// TODO: Esto no debería hacerse desde infra
|
|
266
|
+
const movePublicToDist = () => {
|
|
267
|
+
const { currentExportWorkingPath: publicPath } = getArtifactPaths("public");
|
|
268
|
+
const { currentExportWorkingPath: distPath } = getArtifactPaths("dist");
|
|
269
|
+
|
|
270
|
+
if (fs.existsSync(publicPath)) {
|
|
271
|
+
logWarning(`🚚 Moving ${publicPath} to ${distPath}`);
|
|
272
|
+
run(`mv ${publicPath} ${distPath}`);
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
const removeDisposableArtifacts = () => {
|
|
277
|
+
for (const artifact of artifactsDisposable) {
|
|
278
|
+
const { currentExportWorkingPath: artifactPath } =
|
|
279
|
+
getArtifactPaths(artifact);
|
|
280
|
+
|
|
281
|
+
if (fs.existsSync(artifactPath)) {
|
|
282
|
+
logWarning(`🗑️ Removing ${chalk.gray(artifactPath)}`);
|
|
283
|
+
run(`rm -rf ${artifactPath}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
289
|
+
const cleanAfterFail = () => {
|
|
290
|
+
cleanDirtyArtifactPaths();
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
return {
|
|
294
|
+
init,
|
|
295
|
+
getArtifactPaths,
|
|
296
|
+
archiveExportArtifact,
|
|
297
|
+
archiveArtifacts,
|
|
298
|
+
restoreArtifacts,
|
|
299
|
+
createArtifactBackup,
|
|
300
|
+
restoreArtifactBackup,
|
|
301
|
+
deleteArtifactBackup,
|
|
302
|
+
runExporter,
|
|
303
|
+
};
|
|
303
304
|
};
|
|
304
305
|
|
|
305
306
|
console.clear();
|
|
306
307
|
|
|
307
308
|
launchExports().catch((err) => {
|
|
308
|
-
|
|
309
|
-
|
|
309
|
+
console.error("⛔️ ERROR", err?.stdout?.toString() || err);
|
|
310
|
+
process.exit(1);
|
|
310
311
|
});
|
package/src/components/Head.tsx
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
// Types
|
|
2
1
|
import type { CustomHeadProps } from "./types";
|
|
3
2
|
|
|
4
|
-
//
|
|
5
|
-
import {
|
|
6
|
-
generateAutomaticDimensions,
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
} from "components";
|
|
9
|
-
|
|
10
|
-
// External libraries
|
|
3
|
+
// @ts-expect-error components is unknown
|
|
4
|
+
import { generateAutomaticDimensions } from "components";
|
|
11
5
|
import parse from "html-react-parser";
|
|
12
6
|
import * as React from "react";
|
|
13
7
|
|
|
14
|
-
// Utils
|
|
15
8
|
import { cleanCommaSeparated, composeAnalytics, formatImage } from "./utils";
|
|
16
9
|
|
|
17
10
|
/**
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
// Types
|
|
2
|
-
import type { Core } from "@griddo/core";
|
|
3
1
|
import type { TemplateProps } from "./types";
|
|
2
|
+
import type { Core } from "@griddo/core";
|
|
4
3
|
|
|
5
|
-
// Components and functions
|
|
6
4
|
import { Page as RenderGriddoPage } from "@griddo/core";
|
|
5
|
+
// @ts-expect-error components is unknown
|
|
6
|
+
import { components, SiteProvider, templates } from "components";
|
|
7
7
|
import { Link, navigate } from "gatsby";
|
|
8
|
-
|
|
9
|
-
// Instance elements
|
|
10
|
-
import {
|
|
11
|
-
components,
|
|
12
|
-
SiteProvider,
|
|
13
|
-
templates,
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
} from "components";
|
|
16
|
-
|
|
17
|
-
// External libraries
|
|
18
8
|
import * as React from "react";
|
|
19
9
|
import { Helmet } from "react-helmet";
|
|
20
10
|
|
package/src/components/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Core } from "@griddo/core";
|
|
2
|
-
import type { HeadProps } from "gatsby";
|
|
3
1
|
import type { AllPagesResponse } from "../types/api";
|
|
4
2
|
import type { GatsbyPageObject } from "../types/pages";
|
|
3
|
+
import type { Core } from "@griddo/core";
|
|
4
|
+
import type { HeadProps } from "gatsby";
|
|
5
5
|
|
|
6
6
|
export interface CustomHeadProps extends HeadProps {
|
|
7
7
|
pageContext: GatsbyPageObject["context"] & {
|
package/src/components/utils.ts
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
// Browserify doesn't work with the mixture of typescript + webpack 5 + SSR
|
|
8
8
|
|
|
9
|
-
// Types
|
|
10
9
|
import type { Fields } from "@griddo/core";
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -22,6 +21,7 @@ function cleanCommaSeparated(str: string) {
|
|
|
22
21
|
|
|
23
22
|
/**
|
|
24
23
|
* Format Cloudinary or DAM URL
|
|
24
|
+
*
|
|
25
25
|
* @param image The image url
|
|
26
26
|
* @param width With of the image
|
|
27
27
|
* @param height Height of the image
|
|
@@ -59,7 +59,7 @@ function addGriddoDamParams(image: string, params: string) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
*
|
|
62
|
+
* Take a cloudinary url and add query params.
|
|
63
63
|
*/
|
|
64
64
|
function addCloudinaryParams(image: string, params: string) {
|
|
65
65
|
const plainUrl = image.replace("https://", "");
|
|
@@ -78,16 +78,13 @@ function composeAnalytics(
|
|
|
78
78
|
siteScript: string;
|
|
79
79
|
page: {
|
|
80
80
|
dimensions: {
|
|
81
|
-
|
|
82
|
-
values: any;
|
|
81
|
+
values: Record<string, unknown>;
|
|
83
82
|
};
|
|
84
83
|
};
|
|
85
84
|
};
|
|
86
85
|
},
|
|
87
86
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
88
|
-
generateAutomaticDimensions = (page: Record<string, unknown>) =>
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
87
|
+
generateAutomaticDimensions = (page: Record<string, unknown>) => null
|
|
91
88
|
) {
|
|
92
89
|
const {
|
|
93
90
|
pageContext: {
|
|
@@ -107,7 +104,8 @@ function composeAnalytics(
|
|
|
107
104
|
const allDimensionsValues = {
|
|
108
105
|
...dimensionValues,
|
|
109
106
|
...automaticDimensionValues,
|
|
110
|
-
|
|
107
|
+
// TODO: remove any
|
|
108
|
+
} as Record<string, any>;
|
|
111
109
|
|
|
112
110
|
const allDimensions = [];
|
|
113
111
|
|
package/src/html.tsx
CHANGED
package/src/services/auth.ts
CHANGED