@griddo/cx 10.4.21 → 10.4.23

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.
Files changed (49) hide show
  1. package/build/adapters/gatsby/utils.d.ts +21 -15
  2. package/build/browser/index.d.ts +1 -1
  3. package/build/browser/index.js +1 -1
  4. package/build/build-complete.js +21 -21
  5. package/build/index.d.ts +2 -3
  6. package/build/index.js +30 -34
  7. package/build/react/Foo/index.d.ts +3 -0
  8. package/build/react/index.d.ts +1 -1
  9. package/build/react/index.js +1 -0
  10. package/build/reset-render.js +21 -21
  11. package/build/run-start-render.js +29 -33
  12. package/build/start-render.js +30 -34
  13. package/build/types/global.d.ts +1 -0
  14. package/build/upload-search-content.js +22 -22
  15. package/build/utils/{shared.d.ts → core-utils.d.ts} +44 -2
  16. package/build/utils/folders.d.ts +6 -1
  17. package/build/utils/store.d.ts +1 -1
  18. package/cx.config.js +7 -0
  19. package/exporter/adapters/gatsby/index.ts +67 -14
  20. package/exporter/adapters/gatsby/utils.ts +116 -31
  21. package/exporter/browser/index.ts +1 -1
  22. package/exporter/build-complete.ts +5 -5
  23. package/exporter/index.ts +6 -5
  24. package/exporter/react/Foo/index.tsx +7 -0
  25. package/exporter/react/index.tsx +3 -0
  26. package/exporter/services/distributors.ts +1 -1
  27. package/exporter/services/robots.ts +1 -1
  28. package/exporter/services/store.ts +9 -16
  29. package/exporter/start-render.ts +1 -1
  30. package/exporter/types/global.ts +1 -0
  31. package/exporter/utils/api.ts +1 -1
  32. package/exporter/utils/cache.ts +1 -1
  33. package/exporter/utils/{shared.ts → core-utils.ts} +120 -20
  34. package/exporter/utils/create-build-data.ts +1 -1
  35. package/exporter/utils/domains.ts +3 -0
  36. package/exporter/utils/folders.ts +38 -2
  37. package/exporter/utils/health-checks.ts +1 -1
  38. package/exporter/utils/searches.ts +1 -1
  39. package/exporter/utils/sites.ts +12 -18
  40. package/exporter/utils/store.ts +2 -3
  41. package/gatsby-config.ts +10 -6
  42. package/gatsby-node.ts +20 -11
  43. package/package.json +8 -5
  44. package/src/components/template.tsx +2 -1
  45. package/src/gatsby-node-utils.ts +2 -39
  46. package/src/types.ts +6 -7
  47. package/build/utils/temp-utils.d.ts +0 -10
  48. package/exporter/react/index.ts +0 -5
  49. package/exporter/utils/temp-utils.ts +0 -103
@@ -1,103 +0,0 @@
1
- import path from "node:path";
2
-
3
- import fsx from "fs-extra";
4
-
5
- import { createDirsSync, removeDirsSync } from "./folders";
6
- import { CXConfig } from "../types/global";
7
-
8
- const config = getConfig();
9
-
10
- function getConfig(): CXConfig {
11
- try {
12
- // eslint-disable-next-line @typescript-eslint/no-var-requires, node/no-missing-require, node/no-unpublished-require
13
- const configModule = require("../../cx.config.js");
14
- const config = configModule.default;
15
-
16
- return config;
17
- } catch (error) {
18
- console.log("Error while reading configuration file");
19
- process.exit(1);
20
- }
21
- }
22
-
23
- /**
24
- * Update the Griddo's `/dist` dir with the contents from `public` dir only
25
- * with files of type: js, json and css.
26
- */
27
- async function legacy__createDistFromGatsbyPublic(
28
- domain: string,
29
- needsAssetPrefix: boolean
30
- ) {
31
- const { __cx, __ssg } = config.paths(domain);
32
-
33
- const cxDistDir = path.join(__cx, "dist");
34
- const cxAssetsDir = path.join(__cx, "assets");
35
- const cxDistDirWithDomain = path.join(__cx, "dist", domain);
36
- const publicDir = path.join(__ssg, "public");
37
-
38
- console.log(publicDir);
39
- const validFilesFromPublic = fsx
40
- .readdirSync(publicDir)
41
- .filter(
42
- (file) =>
43
- path.extname(file) === ".js" ||
44
- path.extname(file) === ".json" ||
45
- path.extname(file) === ".css"
46
- );
47
-
48
- const pageDataSrc = `${publicDir}/page-data`;
49
- const pageDataDest = `${cxAssetsDir}/page-data`;
50
-
51
- const projectStaticSrc = path.join(__ssg, "static");
52
- const projectStaticDest = cxAssetsDir;
53
-
54
- const gatsbyStaticSrc = `${cxDistDir}/static`;
55
- const gatsbyStaticDest = `${cxAssetsDir}/static`;
56
-
57
- try {
58
- fsx.mkdirSync(cxAssetsDir, { recursive: true });
59
- fsx.copySync(publicDir, cxDistDir);
60
-
61
- if (needsAssetPrefix) {
62
- fsx.copySync(pageDataSrc, pageDataDest);
63
- if (fsx.existsSync(projectStaticSrc)) {
64
- fsx.copySync(projectStaticSrc, projectStaticDest, { overwrite: false });
65
- }
66
- fsx.copySync(gatsbyStaticSrc, gatsbyStaticDest, { overwrite: false });
67
- if (fsx.existsSync(projectStaticSrc)) {
68
- fsx.copySync(projectStaticSrc, cxDistDirWithDomain, {
69
- overwrite: false,
70
- });
71
- }
72
-
73
- // Copia el resto de archivos...
74
- validFilesFromPublic.map(async (file) => {
75
- const fileSrc = `${publicDir}/${file}`;
76
- const fileDest = `${cxAssetsDir}/${file}`;
77
- fsx.copySync(fileSrc, fileDest);
78
- });
79
- }
80
- } catch (err) {
81
- console.error(err);
82
- }
83
- }
84
-
85
- async function griddoCreateInitialDirectories(domain: string) {
86
- const { __exports, __caches } = config.paths(domain);
87
-
88
- createDirsSync([__exports]);
89
- createDirsSync([__caches]);
90
- }
91
-
92
- async function griddoCleanDisposableDirectories(domain: string) {
93
- const { __cx } = config.paths(domain);
94
-
95
- removeDirsSync(__cx, ["store", "apiCache", "dist"]);
96
- }
97
-
98
- export {
99
- getConfig,
100
- griddoCleanDisposableDirectories,
101
- griddoCreateInitialDirectories,
102
- legacy__createDistFromGatsbyPublic,
103
- };