@griddo/cx 1.75.192 → 1.75.195

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.
@@ -21,28 +21,24 @@
21
21
  // │ Build metadata │ //
22
22
  // └─────────────────────────┘ //
23
23
 
24
- // Types
25
24
  import type { BuildProcessData, StoreMode } from "../types/global";
26
25
  import type { GatsbyPageObject, PageAdditionalInfo } from "../types/pages";
27
26
  import type { Site } from "../types/sites";
28
27
 
29
- // External libraries
30
- import chalk from "chalk";
31
- import dotenv from "dotenv";
32
28
  import fs from "fs";
33
29
  import fsp from "fs/promises";
34
- import pLimit from "p-limit";
35
30
  import path from "path";
36
31
  import v8 from "v8";
37
32
 
38
- // Services
33
+ import chalk from "chalk";
34
+ import dotenv from "dotenv";
35
+ import pLimit from "p-limit";
36
+
39
37
  import { DistributorService } from "./distributors";
40
38
  import { NavigationService } from "./navigation";
41
39
  import { RobotsService } from "./robots";
42
40
  import { SettingsService } from "./settings";
43
41
  import { SitesService } from "./sites";
44
-
45
- // Utils
46
42
  import { version as griddoVersion } from "../../package.json";
47
43
  import { createSha256, updatedSiteHash } from "../utils/cache";
48
44
  import { deleteSites } from "../utils/folders";
@@ -53,7 +49,7 @@ import {
53
49
  getMultiPageElements,
54
50
  getPaginatedPages,
55
51
  } from "../utils/pages";
56
- import { logInfo, walk } from "../utils/shared";
52
+ import { logInfo, removeProperties, siteList, walk } from "../utils/shared";
57
53
  import { checkSites, getSiteData, unpublishSites } from "../utils/sites";
58
54
 
59
55
  dotenv.config();
@@ -66,16 +62,17 @@ const GRIDDO_API_CONCURRENCY_COUNT = process.env.GRIDDO_API_CONCURRENCY_COUNT;
66
62
  const PUBLIC_API_URL = process.env.PUBLIC_API_URL as string;
67
63
  const RENDER_ID = process.env.RENDERID || new Date().valueOf().toString();
68
64
 
69
- // Constants shared between Gatsby phases.
65
+ // Consts
70
66
  const CREATED_PAGES: Array<number> = [];
71
67
  const BUILD_PROCESS_DATA: BuildProcessData = {};
68
+ const UNWANTED_PAGE_PROPS = ["editorID", "parentEditorID"];
72
69
 
73
70
  /**
74
- * Store service to fetch, process and save temporarily final pages and site
71
+ * Store service to fetch, process and save temporarily object pages and site
75
72
  * data to be consumed by external services (Griddo itself, Gatsby, etc.)
76
73
  *
77
74
  * Modes:
78
- * - File mode will save the final page objects in individual files in the file system.
75
+ * - File mode will save the final page objects in individual json files in the file system.
79
76
  * - Memory mode will save the final page objects in an array of objects in memory.
80
77
  *
81
78
  * @example
@@ -91,6 +88,7 @@ const BUILD_PROCESS_DATA: BuildProcessData = {};
91
88
  class StoreService {
92
89
  static basePath: string;
93
90
  static mode: "file" | "memory";
91
+ static sanitize? = false;
94
92
  static pages: Array<GatsbyPageObject> = [];
95
93
  static sitesToPublish: Array<Site>;
96
94
  static buildProcessData: BuildProcessData;
@@ -99,14 +97,18 @@ class StoreService {
99
97
  // Public methods
100
98
 
101
99
  /**
102
- * Initialize the Store with a path to store the files in file mode and an option object to set the mode.
100
+ * Initialize the Store with a path to save files (file mode) and an option object to configure the Store.
103
101
  *
104
102
  * @param basePath The path to store the page files.
105
103
  * @param options An object configuration
106
104
  * @param options.mode Store mode
107
105
  * @todo Avoid initialize the Store with a `basePath` in memory mode.
108
106
  */
109
- public static init(basePath: string, options: { mode: StoreMode }) {
107
+ public static init(
108
+ basePath: string,
109
+ options: { mode: StoreMode; sanitize?: boolean }
110
+ ) {
111
+ this.sanitize = options?.sanitize;
110
112
  const { mode } = options;
111
113
  const griddoCxThreads = parseInt(GRIDDO_API_CONCURRENCY_COUNT || "10");
112
114
  const modeString = mode === "file" ? "File mode" : "Memory mode";
@@ -114,6 +116,10 @@ class StoreService {
114
116
  console.log(`🧶 Processing API page calls with ${griddoCxThreads} threads`);
115
117
  console.log(`📦 Griddo Store initialized - ${chalk.italic(modeString)}`);
116
118
 
119
+ if (this.sanitize) {
120
+ console.log(`🏥 Sanitize pages enabled`);
121
+ }
122
+
117
123
  if (mode === "file") {
118
124
  this.basePath = basePath;
119
125
  this.mode = mode;
@@ -133,9 +139,9 @@ class StoreService {
133
139
  }
134
140
 
135
141
  /**
136
- * Save the build data to the Store.
142
+ * Create a complete build fetching the necessary data from API.
137
143
  */
138
- public static async saveBuildData() {
144
+ public static async createBuildSource() {
139
145
  try {
140
146
  // Get sites objects to publish and unpublish.
141
147
  const { sitesToPublish, sitesToUnpublish } = await checkSites();
@@ -146,27 +152,15 @@ class StoreService {
146
152
  // If no activity in sites, exit
147
153
  if (!(sitesToPublish.length || sitesToUnpublish.length)) {
148
154
  console.warn("There are no sites to update");
149
-
150
155
  process.exit(0);
151
156
  }
152
157
 
153
- // Publish and unpublis sites
154
158
  console.log(
155
- chalk.green(
156
- "\n⬆️ ",
157
- `(${sitesToPublish.length}) Sites to publish:`,
158
- sitesToPublish.map(({ name }) => name).join(", "),
159
- "\n"
160
- )
159
+ chalk.green(`\n⬆ Sites to publish: ${siteList(sitesToPublish)}`)
161
160
  );
162
161
 
163
162
  console.log(
164
- chalk.red(
165
- "⬇️ ",
166
- `(${sitesToUnpublish.length}) Sites to unpublish:`,
167
- sitesToUnpublish.map(({ name }) => name).join(", "),
168
- "\n"
169
- )
163
+ chalk.red(`\n⬇ Sites to unpublish: ${siteList(sitesToUnpublish)}\n`)
170
164
  );
171
165
 
172
166
  // Unpublish (API) and delete sites
@@ -178,9 +172,8 @@ class StoreService {
178
172
  // Set robots information to use later in the `onPostBuild` phase.
179
173
  await RobotsService.loadRobots();
180
174
 
181
- // Array of sites (Promises)
182
- for (const site of sitesToPublish) {
183
- // Gets
175
+ const siteToPublishPromises = sitesToPublish.map(async (site) => {
176
+ // for (const site of sitesToPublish) {
184
177
  const { id: siteId, slug: siteSlug, theme, favicon } = site;
185
178
 
186
179
  const {
@@ -193,7 +186,6 @@ class StoreService {
193
186
  headers,
194
187
  footers,
195
188
  socials,
196
- // TODO: Check the false here...
197
189
  } = await getSiteData(siteId, false);
198
190
 
199
191
  const {
@@ -206,8 +198,6 @@ class StoreService {
206
198
  avoidDebugMetas,
207
199
  } = SettingsService.settings;
208
200
 
209
- // Sets
210
-
211
201
  BUILD_PROCESS_DATA[siteId] = {
212
202
  siteHash,
213
203
  unpublishHashes,
@@ -254,7 +244,7 @@ class StoreService {
254
244
  siteScript,
255
245
  };
256
246
 
257
- logInfo(`${validPagesIds.length} valid pages`);
247
+ logInfo(`𝍌 ${site.name} site`);
258
248
 
259
249
  // -------------------------------------------------------------------------
260
250
  // Pages loop promise creation
@@ -382,7 +372,15 @@ class StoreService {
382
372
  );
383
373
 
384
374
  await Promise.all(pagesToRender);
385
- }
375
+ });
376
+
377
+ // Create the pLimit array of promises
378
+ const limit = pLimit(1);
379
+ const sitesToPublishAwaited = siteToPublishPromises.map((site) =>
380
+ limit(() => site)
381
+ );
382
+
383
+ await Promise.all(sitesToPublishAwaited);
386
384
  } catch (e) {
387
385
  const error = e as { message: string };
388
386
 
@@ -393,7 +391,9 @@ class StoreService {
393
391
  }
394
392
 
395
393
  /**
396
- * Get the pages saved previously from the Store.
394
+ * Get all pages data from the Store.
395
+ * If the Store is in file mode `getPages` will return a Generator of pages.
396
+ * If the Store is in memory mode `getPages` will return an array of pages.
397
397
  */
398
398
  public static getPages() {
399
399
  if (this.mode === "file") {
@@ -409,6 +409,12 @@ class StoreService {
409
409
  * @param pages An array of pages to save in the store.
410
410
  */
411
411
  public static async savePages(pages: Array<GatsbyPageObject>) {
412
+ // WARNS: This mutate the page objects and could hurt the build render
413
+ // performance.
414
+ if (this.sanitize) {
415
+ pages.forEach((page) => removeProperties(page, UNWANTED_PAGE_PROPS));
416
+ }
417
+
412
418
  if (this.mode === "file") {
413
419
  await this.savePagesToFiles(pages);
414
420
  } else {
@@ -464,6 +470,7 @@ class StoreService {
464
470
  );
465
471
 
466
472
  for (const filePath of jsonFilePaths) {
473
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
467
474
  const page = require(filePath) as GatsbyPageObject;
468
475
  page.size = fs.statSync(filePath).size / 1024;
469
476
  yield { ...page };
package/src/types/api.ts CHANGED
@@ -1,8 +1,7 @@
1
- // Types
2
- import type { Core, Fields } from "@griddo/core";
3
1
  import type { Domains, Robots, Settings } from "./global";
4
2
  import type { APIPageObject } from "./pages";
5
3
  import type { Site } from "./sites";
4
+ import type { Core, Fields } from "@griddo/core";
6
5
 
7
6
  /** EndSiteRender Body */
8
7
  export type EndSiteRenderBody = {
@@ -20,7 +19,7 @@ export interface DistributorBody {
20
19
  order?: string;
21
20
  source?: Array<string>;
22
21
  quantity?: number;
23
- filter?: Array<any>;
22
+ filter?: Array<unknown>;
24
23
  fullRelations?: boolean;
25
24
  allLanguages?: boolean;
26
25
  fixed?: Array<number>;
@@ -112,13 +111,13 @@ export interface APIRequest {
112
111
  /** The URL of the API endpoint. */
113
112
  endpoint: string;
114
113
  /** The parameters to be sent in the request body. */
115
- body?: any;
114
+ body?: unknown;
116
115
  /** Indicates whether to use the cache to get the response from the API. */
117
116
  cached?: unknown;
118
117
  /** Number of connection attempts (in case it fails on the first attempt). */
119
118
  attempt?: number;
120
119
  /** Headers for the post api fetch */
121
- headers?: any;
120
+ headers?: Record<string, unknown>;
122
121
  }
123
122
 
124
123
  /** Type with the POST request properties. */
@@ -186,3 +185,14 @@ export type APIResponses =
186
185
  | DistributorResponse
187
186
  | PostSearchInfoResponse
188
187
  | AllPagesResponse;
188
+
189
+ // TODO: JSDoc
190
+ export interface ShowApiErrorOptions {
191
+ callInfo: {
192
+ endpoint?: string;
193
+ body?: unknown;
194
+ headers?: unknown;
195
+ attempt?: number;
196
+ };
197
+ breakProcess: boolean;
198
+ }
@@ -1,9 +1,10 @@
1
- // Types
2
- import type { Core, Fields } from "@griddo/core";
3
1
  import type { EndSiteRenderBody } from "./api";
2
+ import type { Core, Fields } from "@griddo/core";
4
3
 
4
+ // TODO: JSDoc
5
5
  export type StoreMode = "memory" | "file";
6
6
 
7
+ // TODO: JSDoc
7
8
  export interface Settings {
8
9
  apiVersion?: string;
9
10
  avoidCanonicalsOnSitemaps?: boolean;
@@ -27,9 +28,10 @@ export interface Settings {
27
28
  welcomeText2?: string;
28
29
  }
29
30
 
30
- /** ??? */
31
+ // TODO: JSDoc
31
32
  export type Petition = Record<string, unknown>;
32
33
 
34
+ // TODO: JSDoc
33
35
  export interface PostSearchInfoProps {
34
36
  title?: string;
35
37
  description: string;
@@ -42,6 +44,7 @@ export interface PostSearchInfoProps {
42
44
  url?: string;
43
45
  }
44
46
 
47
+ // TODO: JSDoc
45
48
  export interface FetchDataProps {
46
49
  page: Core.Page;
47
50
  component: {
@@ -50,6 +53,7 @@ export interface FetchDataProps {
50
53
  cached: boolean;
51
54
  }
52
55
 
56
+ // TODO: JSDoc
53
57
  export type Domains = Array<{
54
58
  id: number;
55
59
  slug: string;
@@ -59,6 +63,8 @@ export type Domains = Array<{
59
63
  /** Describes the type of build process data object. */
60
64
  export type BuildProcessData = Record<string, EndSiteRenderBody>;
61
65
 
66
+ // TODO: JSDoc
62
67
  export type Robot = { path: string; content: string };
63
68
 
69
+ // TODO: JSDoc
64
70
  export type Robots = Array<Robot>;
@@ -1,8 +1,7 @@
1
- // Types
2
- import type { Core, Fields } from "@griddo/core";
3
1
  import type { SocialsResponse } from "./api";
4
2
  import type { Settings } from "./global";
5
3
  import type { Site } from "./sites";
4
+ import type { Core, Fields } from "@griddo/core";
6
5
 
7
6
  // TODO: In @griddo/core the type Core.Page has header/footer as React-Types,
8
7
  // but API return `number | null`.
@@ -11,11 +10,13 @@ export type APIPageObject = Core.Page & {
11
10
  footer: number | null;
12
11
  };
13
12
 
13
+ // TODO: JSDoc
14
14
  export type CleanPage = Core.Page & {
15
15
  isRoot: boolean;
16
16
  defaultLang?: Core.SiteLanguage | undefined;
17
17
  };
18
18
 
19
+ // TODO: JSDoc
19
20
  export type RenderPage = Core.Page & {
20
21
  isRoot?: boolean;
21
22
  multiPageElements: MultiPageElements;
@@ -30,17 +31,19 @@ export type RenderPage = Core.Page & {
30
31
  mode: "list";
31
32
  };
32
33
 
34
+ // TODO: JSDoc
33
35
  export type GriddoSinglePage = Core.Page & {
34
36
  defaultLang?: Core.SiteLanguage;
35
37
  };
36
38
 
39
+ // TODO: JSDoc
37
40
  export type GriddoListPage = Core.Page & {
38
41
  page: APIPageObject;
39
42
  pages: Array<Array<Fields.QueriedDataItem>>;
40
43
  isRoot?: boolean;
41
44
  defaultLang?: Core.SiteLanguage;
42
45
  template: {
43
- [key: string]: any;
46
+ [key: string]: unknown;
44
47
  type: "template";
45
48
  templateType: string;
46
49
  activeSectionSlug: string;
@@ -49,6 +52,7 @@ export type GriddoListPage = Core.Page & {
49
52
  totalQueriedItems: Array<Fields.QueriedDataItem>;
50
53
  };
51
54
 
55
+ // TODO: JSDoc
52
56
  export type GriddoMultiPage = Core.Page & {
53
57
  header: number | null;
54
58
  footer: number | null;
@@ -57,6 +61,7 @@ export type GriddoMultiPage = Core.Page & {
57
61
  defaultLang?: Core.SiteLanguage | undefined;
58
62
  };
59
63
 
64
+ // TODO: JSDoc
60
65
  export interface AdditionalInfo {
61
66
  baseUrl: string;
62
67
  BUILD_MODE?: string;
@@ -81,6 +86,7 @@ export interface AdditionalInfo {
81
86
  theme: string;
82
87
  }
83
88
 
89
+ // TODO: JSDoc
84
90
  export interface PageAdditionalInfo extends AdditionalInfo {
85
91
  navigations: {
86
92
  header: Record<string, unknown> | null;
@@ -88,6 +94,7 @@ export interface PageAdditionalInfo extends AdditionalInfo {
88
94
  };
89
95
  }
90
96
 
97
+ // TODO: JSDoc
91
98
  export type GatsbyPageObject = {
92
99
  matchPath?: string;
93
100
  path: string;
@@ -134,6 +141,7 @@ export type GatsbyPageObject = {
134
141
  };
135
142
  };
136
143
 
144
+ // TODO: JSDoc
137
145
  export type MultiPageElements = Array<{
138
146
  component: string;
139
147
  title: string | Required<Fields.Heading>;
@@ -1,7 +1,6 @@
1
- // Types
2
- import type { Core } from "@griddo/core";
3
1
  import type { AllPagesResponse, SocialsResponse } from "./api";
4
2
  import type { Footer, Header } from "./navigation";
3
+ import type { Core } from "@griddo/core";
5
4
 
6
5
  /**
7
6
  * Describe a Griddo site object from API.
@@ -46,11 +45,12 @@ export interface Site
46
45
  updated: boolean;
47
46
  }
48
47
 
48
+ // TODO: JSDoc
49
49
  export interface SiteData {
50
50
  siteInfo: Site;
51
- validPagesIds: number[];
51
+ validPagesIds: Array<number>;
52
52
  siteHash: string | null;
53
- unpublishHashes: string[];
53
+ unpublishHashes: Array<string>;
54
54
  siteLangs: Array<Core.SiteLanguage>;
55
55
  defaultLang: Core.SiteLanguage | undefined;
56
56
  headers: Array<Header>;
@@ -59,6 +59,8 @@ export interface SiteData {
59
59
  sitePages: AllPagesResponse;
60
60
  }
61
61
 
62
+ // TODO: JSDoc
62
63
  export type SiteHash = string | null;
63
64
 
65
+ // TODO: JSDoc
64
66
  export type HashSites = Record<string, number | string>;
@@ -1,4 +1,3 @@
1
- // Types
2
1
  import type { Core, Fields } from "@griddo/core";
3
2
 
4
3
  /** Describe a template object from a Griddo Page */
package/src/utils/api.ts CHANGED
@@ -1,4 +1,3 @@
1
- // Types
2
1
  import type {
3
2
  APIRequest,
4
3
  APIResponses,
@@ -6,19 +5,17 @@ import type {
6
5
  GetAPI,
7
6
  PostAPI,
8
7
  PutAPI,
8
+ ShowApiErrorOptions,
9
9
  } from "../types/api";
10
+ import type { Method } from "axios";
10
11
 
11
- // External libraries
12
- import axios, { Method } from "axios";
12
+ import axios from "axios";
13
13
  import chalk from "chalk";
14
14
  import dotenv from "dotenv";
15
15
 
16
- // Services
17
- import { AuthService } from "../services/auth";
18
-
19
- // Utils
20
16
  import { getCache, saveCache } from "./cache";
21
17
  import { delay, getSafeSiteId, logInfo, msToSec } from "./shared";
18
+ import { AuthService } from "../services/auth";
22
19
 
23
20
  dotenv.config();
24
21
 
@@ -32,7 +29,7 @@ const {
32
29
  *
33
30
  * @template T Response Type returned.
34
31
  * @returns {Promise<T>} A promise that is resolved with the data from the API response.
35
- * @todo Maybe remove the loggin responsability
32
+ *
36
33
  * @example
37
34
  * const response = await requestAPI<Site>({
38
35
  * endpoint: "...",
@@ -69,14 +66,13 @@ async function requestAPI<T extends APIResponses>(
69
66
  } catch (e) {
70
67
  const error = e as Error;
71
68
 
72
- showApiError(
73
- error,
74
- { endpoint, body, attempt },
75
- error.response.status !== 404
76
- );
69
+ showApiError(error, {
70
+ callInfo: { endpoint, body, attempt },
71
+ breakProcess: error.response.status !== 404,
72
+ });
77
73
 
78
74
  if (error.response.status === 404) {
79
- // @ts-expect-error
75
+ // @ts-expect-error page maybe will be 404
80
76
  return null;
81
77
  }
82
78
 
@@ -98,6 +94,12 @@ async function requestAPI<T extends APIResponses>(
98
94
  }
99
95
  }
100
96
 
97
+ /**
98
+ * Make a GET request to the Griddo API.
99
+ *
100
+ * @template T Response Type returned.
101
+ * @returns A promise that is resolved with the data from the API response.
102
+ */
101
103
  async function getApi<T extends APIResponses>(props: GetAPI) {
102
104
  // Starts
103
105
  const start = new Date();
@@ -117,6 +119,12 @@ async function getApi<T extends APIResponses>(props: GetAPI) {
117
119
  return response;
118
120
  }
119
121
 
122
+ /**
123
+ * Make a PUT request to the Griddo API.
124
+ *
125
+ * @template T Response Type returned.
126
+ * @returns A promise that is resolved with the data from the API response.
127
+ */
120
128
  async function putApi<T extends APIResponses>(props: PutAPI) {
121
129
  // Starts
122
130
  const start = new Date();
@@ -134,6 +142,12 @@ async function putApi<T extends APIResponses>(props: PutAPI) {
134
142
  return response;
135
143
  }
136
144
 
145
+ /**
146
+ * Make a POST request to the Griddo API.
147
+ *
148
+ * @template T Response Type returned.
149
+ * @returns A promise that is resolved with the data from the API response.
150
+ */
137
151
  async function postApi<T extends APIResponses>(props: PostAPI) {
138
152
  // Starts
139
153
  const start = new Date();
@@ -161,18 +175,9 @@ async function postApi<T extends APIResponses>(props: PostAPI) {
161
175
  /**
162
176
  * Shows an API error through the terminal.
163
177
  */
164
- function showApiError(
165
- error: Error,
166
- callInfo: {
167
- endpoint?: string;
168
- // TODO: Remove any's
169
- body?: any;
170
- headers?: any;
171
- attempt?: number;
172
- } = {},
173
- breakProcess = true
174
- ) {
178
+ function showApiError(error: Error, options: ShowApiErrorOptions) {
175
179
  const { response, message, stack } = error;
180
+ const { breakProcess, callInfo } = options;
176
181
  const { status, statusText, data } = response || {};
177
182
  const callInfoArray = [];
178
183
 
@@ -1,13 +1,11 @@
1
- // Types
2
1
  import type { Petition } from "../types/global";
3
2
  import type { HashSites, SiteHash } from "../types/sites";
4
3
 
5
- // External libraries
6
4
  import crypto from "crypto";
7
5
  import fs from "fs";
8
6
  import path from "path";
9
7
 
10
- // Constants
8
+ // Consts
11
9
  const API_CACHE_DIR_PATH = path.resolve(__dirname, "./../../apiCache");
12
10
  const SITE_HASH_FILENAME = `${API_CACHE_DIR_PATH}/siteHash.json`;
13
11
 
@@ -24,8 +22,8 @@ function initCache() {
24
22
 
25
23
  /**
26
24
  * Generate a filename with a hash using a Petition object
27
- * TODO: Merge with createSha256
28
25
  *
26
+ * @todo Merge with createSha256
29
27
  * @param petition An object
30
28
  */
31
29
  function generateFilenameWithHash(petition: Petition) {
@@ -37,8 +35,8 @@ function generateFilenameWithHash(petition: Petition) {
37
35
 
38
36
  /**
39
37
  * Generate a filename with a hash using a string.
40
- * TODO: Merge with generateFilenameWithHash
41
38
  *
39
+ * @todo Merge with generateFilenameWithHash
42
40
  * @param data A string to create a sha256 based on.
43
41
  */
44
42
  function createSha256(data: string) {
@@ -54,11 +52,11 @@ function createSha256(data: string) {
54
52
  * @param petition An object.
55
53
  * @param content Content to be saved.
56
54
  */
57
- const saveCache = <T>(petition: Petition, content: T) => {
55
+ function saveCache<T>(petition: Petition, content: T) {
58
56
  const stringContent =
59
57
  typeof content === "string" ? content : JSON.stringify(content);
60
58
  fs.writeFileSync(generateFilenameWithHash(petition), stringContent, "utf8");
61
- };
59
+ }
62
60
 
63
61
  /**
64
62
  * Read a cache file and return it as an object
@@ -1,7 +1,5 @@
1
- // Types
2
1
  import type { Domains } from "../types/global";
3
2
 
4
- // Services
5
3
  import { AuthService } from "../services/auth";
6
4
  import { DomainsService } from "../services/domains";
7
5
 
@@ -1,11 +1,9 @@
1
- // Types
2
1
  import type { Site } from "../types/sites";
3
2
 
4
- // External libraries
5
- import fs from "fs-extra";
6
3
  import path from "path";
7
4
 
8
- // Utils
5
+ import fs from "fs-extra";
6
+
9
7
  import { resolveComponentsPath } from "./instance";
10
8
  import { logInfo } from "./shared";
11
9
 
@@ -107,21 +105,6 @@ async function updateDist() {
107
105
  }
108
106
  }
109
107
 
110
- /**
111
- * Copy the Griddo's `/dist` folder into the Griddo's `/public` folder.
112
- */
113
- async function prepareServe() {
114
- const src = "./dist";
115
- const dest = "./public";
116
-
117
- try {
118
- await fs.copy(src, dest);
119
- logInfo("Public copied");
120
- } catch (err) {
121
- console.warn("error", err);
122
- }
123
- }
124
-
125
108
  /**
126
109
  * Copy the instance's `/static` folder into the Gatsby's to take it into account for bundle.
127
110
  */
@@ -144,4 +127,4 @@ function prepareStaticFolder() {
144
127
  }
145
128
  }
146
129
 
147
- export { deleteSites, updateDist, prepareServe, prepareStaticFolder };
130
+ export { deleteSites, updateDist, prepareStaticFolder };