@eventcatalog/core 4.7.1 → 4.7.3
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/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/catalog-to-astro-content-directory.cjs +65 -13
- package/dist/catalog-to-astro-content-directory.js +2 -1
- package/dist/{chunk-B2DV3HIK.js → chunk-GINIJSFI.js} +3 -3
- package/dist/{chunk-NK3O75ST.js → chunk-IALEXWSE.js} +1 -1
- package/dist/{chunk-DRXKILAB.js → chunk-SMDTRRED.js} +1 -1
- package/dist/{chunk-W3SAPOZU.js → chunk-T4RVWPIQ.js} +6 -0
- package/dist/chunk-T5IUG523.js +54 -0
- package/dist/{chunk-U7HRSTMK.js → chunk-V4FAVGI7.js} +1 -1
- package/dist/{chunk-QC6KK6U7.js → chunk-XXJX3WWF.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/custom-components.cjs +89 -0
- package/dist/custom-components.d.cts +4 -0
- package/dist/custom-components.d.ts +4 -0
- package/dist/custom-components.js +8 -0
- package/dist/eventcatalog.cjs +206 -152
- package/dist/eventcatalog.js +12 -11
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/package.json +2 -2
|
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
140
140
|
var import_os = __toESM(require("os"), 1);
|
|
141
141
|
|
|
142
142
|
// package.json
|
|
143
|
-
var version = "4.7.
|
|
143
|
+
var version = "4.7.3";
|
|
144
144
|
|
|
145
145
|
// src/constants.ts
|
|
146
146
|
var VERSION = version;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-GINIJSFI.js";
|
|
4
|
+
import "../chunk-SMDTRRED.js";
|
|
4
5
|
import "../chunk-K2XIENVT.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-U7HRSTMK.js";
|
|
6
|
+
import "../chunk-V4FAVGI7.js";
|
|
7
7
|
import "../chunk-6QENHZZP.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
|
@@ -40,7 +40,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
40
40
|
|
|
41
41
|
// src/catalog-to-astro-content-directory.js
|
|
42
42
|
var import_glob = require("glob");
|
|
43
|
-
var
|
|
43
|
+
var path4 = __toESM(require("path"), 1);
|
|
44
44
|
var import_fs = __toESM(require("fs"), 1);
|
|
45
45
|
var import_url2 = require("url");
|
|
46
46
|
var import_node_os2 = __toESM(require("os"), 1);
|
|
@@ -261,26 +261,77 @@ function getRelativeTargetPath(filePath) {
|
|
|
261
261
|
return import_node_path2.default.join(...relativePath);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
// src/custom-components.js
|
|
265
|
+
var import_promises2 = __toESM(require("fs/promises"), 1);
|
|
266
|
+
var import_node_path3 = __toESM(require("path"), 1);
|
|
267
|
+
var isCustomComponentPath = (projectDirectory, filePath) => {
|
|
268
|
+
const [rootDirectory, childDirectory] = import_node_path3.default.relative(projectDirectory, filePath).split(import_node_path3.default.sep);
|
|
269
|
+
return rootDirectory === "components" || rootDirectory === "federated" && childDirectory === "components";
|
|
270
|
+
};
|
|
271
|
+
var readDirectory = async (directory) => {
|
|
272
|
+
try {
|
|
273
|
+
return await import_promises2.default.readdir(directory, { withFileTypes: true });
|
|
274
|
+
} catch (error) {
|
|
275
|
+
if (error.code === "ENOENT") return [];
|
|
276
|
+
throw error;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
var mergeDirectory = async (sourceDirectory, destinationDirectory) => {
|
|
280
|
+
for (const entry of await readDirectory(sourceDirectory)) {
|
|
281
|
+
const sourcePath = import_node_path3.default.join(sourceDirectory, entry.name);
|
|
282
|
+
const destinationPath = import_node_path3.default.join(destinationDirectory, entry.name);
|
|
283
|
+
if (entry.isDirectory()) {
|
|
284
|
+
const destinationEntry = await import_promises2.default.stat(destinationPath).catch((error) => {
|
|
285
|
+
if (error.code === "ENOENT") return void 0;
|
|
286
|
+
throw error;
|
|
287
|
+
});
|
|
288
|
+
if (destinationEntry && !destinationEntry.isDirectory()) {
|
|
289
|
+
await import_promises2.default.rm(destinationPath, { recursive: true, force: true });
|
|
290
|
+
}
|
|
291
|
+
await import_promises2.default.mkdir(destinationPath, { recursive: true });
|
|
292
|
+
await mergeDirectory(sourcePath, destinationPath);
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
await import_promises2.default.rm(destinationPath, { recursive: true, force: true });
|
|
296
|
+
await import_promises2.default.copyFile(sourcePath, destinationPath);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
var syncCustomComponents = async (projectDirectory, catalogDirectory) => {
|
|
300
|
+
const destinationDirectory = import_node_path3.default.join(catalogDirectory, "src", "custom-defined-components");
|
|
301
|
+
const destinationParent = import_node_path3.default.dirname(destinationDirectory);
|
|
302
|
+
await import_promises2.default.mkdir(destinationParent, { recursive: true });
|
|
303
|
+
const stagingDirectory = await import_promises2.default.mkdtemp(import_node_path3.default.join(destinationParent, ".custom-defined-components.staging-"));
|
|
304
|
+
try {
|
|
305
|
+
await mergeDirectory(import_node_path3.default.join(projectDirectory, "federated", "components"), stagingDirectory);
|
|
306
|
+
await mergeDirectory(import_node_path3.default.join(projectDirectory, "components"), stagingDirectory);
|
|
307
|
+
await import_promises2.default.rm(destinationDirectory, { recursive: true, force: true });
|
|
308
|
+
await import_promises2.default.rename(stagingDirectory, destinationDirectory);
|
|
309
|
+
} finally {
|
|
310
|
+
await import_promises2.default.rm(stagingDirectory, { recursive: true, force: true });
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
264
314
|
// src/catalog-to-astro-content-directory.js
|
|
265
315
|
var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
|
|
266
|
-
var rootPkg =
|
|
316
|
+
var rootPkg = path4.resolve(path4.dirname(__filename2), "../");
|
|
267
317
|
var copyFiles = async (source, target) => {
|
|
268
|
-
const files = await (0, import_glob.glob)(
|
|
318
|
+
const files = await (0, import_glob.glob)(path4.join(source, "**"), {
|
|
269
319
|
nodir: true,
|
|
270
320
|
windowsPathsNoEscape: import_node_os2.default.platform() == "win32",
|
|
271
321
|
ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
|
|
272
322
|
});
|
|
273
|
-
const snippets = await (0, import_glob.glob)(
|
|
323
|
+
const snippets = await (0, import_glob.glob)(path4.join(source, "snippets/**/*.mdx"), {
|
|
274
324
|
nodir: true,
|
|
275
325
|
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
276
326
|
});
|
|
277
327
|
if (snippets.length > 0) {
|
|
278
328
|
files.push(...snippets);
|
|
279
329
|
}
|
|
280
|
-
if (import_fs.default.existsSync(
|
|
281
|
-
files.push(
|
|
330
|
+
if (import_fs.default.existsSync(path4.join(source, ".env"))) {
|
|
331
|
+
files.push(path4.join(source, ".env"));
|
|
282
332
|
}
|
|
283
333
|
for (const file of files) {
|
|
334
|
+
if (isCustomComponentPath(source, file)) continue;
|
|
284
335
|
mapCatalogToAstro({
|
|
285
336
|
filePath: file,
|
|
286
337
|
astroDir: target,
|
|
@@ -292,9 +343,9 @@ var copyFiles = async (source, target) => {
|
|
|
292
343
|
}
|
|
293
344
|
};
|
|
294
345
|
var clearCustomPages = async (target) => {
|
|
295
|
-
const customPagesDir =
|
|
346
|
+
const customPagesDir = path4.join(target, "src", "custom-pages");
|
|
296
347
|
if (import_fs.default.existsSync(customPagesDir)) import_fs.default.rmSync(customPagesDir, { recursive: true });
|
|
297
|
-
const staleCodeFiles = await (0, import_glob.glob)(
|
|
348
|
+
const staleCodeFiles = await (0, import_glob.glob)(path4.join(target, "public", "generated", "pages", "**/*.{astro,ts,js,mjs}"), {
|
|
298
349
|
nodir: true,
|
|
299
350
|
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
300
351
|
});
|
|
@@ -303,8 +354,8 @@ var clearCustomPages = async (target) => {
|
|
|
303
354
|
}
|
|
304
355
|
};
|
|
305
356
|
var removeGeneratedLikeC4Sources = async (target) => {
|
|
306
|
-
const generatedDir =
|
|
307
|
-
const files = await (0, import_glob.glob)(
|
|
357
|
+
const generatedDir = path4.join(target, "public", "generated");
|
|
358
|
+
const files = await (0, import_glob.glob)(path4.join(generatedDir, "**/*.{c4,likec4}"), {
|
|
308
359
|
nodir: true,
|
|
309
360
|
windowsPathsNoEscape: import_node_os2.default.platform() == "win32"
|
|
310
361
|
});
|
|
@@ -313,15 +364,16 @@ var removeGeneratedLikeC4Sources = async (target) => {
|
|
|
313
364
|
}
|
|
314
365
|
};
|
|
315
366
|
var catalogToAstro = async (source, astroDir) => {
|
|
316
|
-
const astroContentDir =
|
|
367
|
+
const astroContentDir = path4.join(astroDir, "src/content/");
|
|
317
368
|
if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
|
|
318
369
|
import_fs.default.mkdirSync(astroContentDir);
|
|
319
370
|
await verifyRequiredFieldsAreInCatalogConfigFile(source);
|
|
320
|
-
if (!import_fs.default.existsSync(
|
|
321
|
-
import_fs.default.writeFileSync(
|
|
371
|
+
if (!import_fs.default.existsSync(path4.join(source, "eventcatalog.styles.css"))) {
|
|
372
|
+
import_fs.default.writeFileSync(path4.join(source, "eventcatalog.styles.css"), "");
|
|
322
373
|
}
|
|
323
374
|
await clearCustomPages(astroDir);
|
|
324
375
|
await removeGeneratedLikeC4Sources(astroDir);
|
|
376
|
+
await syncCustomComponents(source, astroDir);
|
|
325
377
|
await copyFiles(source, astroDir);
|
|
326
378
|
};
|
|
327
379
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
raiseEvent
|
|
3
|
+
} from "./chunk-SMDTRRED.js";
|
|
1
4
|
import {
|
|
2
5
|
countResources,
|
|
3
6
|
serializeCounts
|
|
4
7
|
} from "./chunk-K2XIENVT.js";
|
|
5
|
-
import {
|
|
6
|
-
raiseEvent
|
|
7
|
-
} from "./chunk-DRXKILAB.js";
|
|
8
8
|
import {
|
|
9
9
|
getEventCatalogConfigFile,
|
|
10
10
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
mapCatalogToAstro
|
|
3
3
|
} from "./chunk-W5JQON7Z.js";
|
|
4
|
+
import {
|
|
5
|
+
isCustomComponentPath,
|
|
6
|
+
syncCustomComponents
|
|
7
|
+
} from "./chunk-T5IUG523.js";
|
|
4
8
|
import {
|
|
5
9
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
6
10
|
} from "./chunk-6QENHZZP.js";
|
|
@@ -30,6 +34,7 @@ var copyFiles = async (source, target) => {
|
|
|
30
34
|
files.push(path.join(source, ".env"));
|
|
31
35
|
}
|
|
32
36
|
for (const file of files) {
|
|
37
|
+
if (isCustomComponentPath(source, file)) continue;
|
|
33
38
|
mapCatalogToAstro({
|
|
34
39
|
filePath: file,
|
|
35
40
|
astroDir: target,
|
|
@@ -71,6 +76,7 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
71
76
|
}
|
|
72
77
|
await clearCustomPages(astroDir);
|
|
73
78
|
await removeGeneratedLikeC4Sources(astroDir);
|
|
79
|
+
await syncCustomComponents(source, astroDir);
|
|
74
80
|
await copyFiles(source, astroDir);
|
|
75
81
|
};
|
|
76
82
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// src/custom-components.js
|
|
2
|
+
import fs from "fs/promises";
|
|
3
|
+
import path from "path";
|
|
4
|
+
var isCustomComponentPath = (projectDirectory, filePath) => {
|
|
5
|
+
const [rootDirectory, childDirectory] = path.relative(projectDirectory, filePath).split(path.sep);
|
|
6
|
+
return rootDirectory === "components" || rootDirectory === "federated" && childDirectory === "components";
|
|
7
|
+
};
|
|
8
|
+
var readDirectory = async (directory) => {
|
|
9
|
+
try {
|
|
10
|
+
return await fs.readdir(directory, { withFileTypes: true });
|
|
11
|
+
} catch (error) {
|
|
12
|
+
if (error.code === "ENOENT") return [];
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var mergeDirectory = async (sourceDirectory, destinationDirectory) => {
|
|
17
|
+
for (const entry of await readDirectory(sourceDirectory)) {
|
|
18
|
+
const sourcePath = path.join(sourceDirectory, entry.name);
|
|
19
|
+
const destinationPath = path.join(destinationDirectory, entry.name);
|
|
20
|
+
if (entry.isDirectory()) {
|
|
21
|
+
const destinationEntry = await fs.stat(destinationPath).catch((error) => {
|
|
22
|
+
if (error.code === "ENOENT") return void 0;
|
|
23
|
+
throw error;
|
|
24
|
+
});
|
|
25
|
+
if (destinationEntry && !destinationEntry.isDirectory()) {
|
|
26
|
+
await fs.rm(destinationPath, { recursive: true, force: true });
|
|
27
|
+
}
|
|
28
|
+
await fs.mkdir(destinationPath, { recursive: true });
|
|
29
|
+
await mergeDirectory(sourcePath, destinationPath);
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
await fs.rm(destinationPath, { recursive: true, force: true });
|
|
33
|
+
await fs.copyFile(sourcePath, destinationPath);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var syncCustomComponents = async (projectDirectory, catalogDirectory) => {
|
|
37
|
+
const destinationDirectory = path.join(catalogDirectory, "src", "custom-defined-components");
|
|
38
|
+
const destinationParent = path.dirname(destinationDirectory);
|
|
39
|
+
await fs.mkdir(destinationParent, { recursive: true });
|
|
40
|
+
const stagingDirectory = await fs.mkdtemp(path.join(destinationParent, ".custom-defined-components.staging-"));
|
|
41
|
+
try {
|
|
42
|
+
await mergeDirectory(path.join(projectDirectory, "federated", "components"), stagingDirectory);
|
|
43
|
+
await mergeDirectory(path.join(projectDirectory, "components"), stagingDirectory);
|
|
44
|
+
await fs.rm(destinationDirectory, { recursive: true, force: true });
|
|
45
|
+
await fs.rename(stagingDirectory, destinationDirectory);
|
|
46
|
+
} finally {
|
|
47
|
+
await fs.rm(stagingDirectory, { recursive: true, force: true });
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export {
|
|
52
|
+
isCustomComponentPath,
|
|
53
|
+
syncCustomComponents
|
|
54
|
+
};
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/custom-components.js
|
|
31
|
+
var custom_components_exports = {};
|
|
32
|
+
__export(custom_components_exports, {
|
|
33
|
+
isCustomComponentPath: () => isCustomComponentPath,
|
|
34
|
+
syncCustomComponents: () => syncCustomComponents
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(custom_components_exports);
|
|
37
|
+
var import_promises = __toESM(require("fs/promises"), 1);
|
|
38
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
39
|
+
var isCustomComponentPath = (projectDirectory, filePath) => {
|
|
40
|
+
const [rootDirectory, childDirectory] = import_node_path.default.relative(projectDirectory, filePath).split(import_node_path.default.sep);
|
|
41
|
+
return rootDirectory === "components" || rootDirectory === "federated" && childDirectory === "components";
|
|
42
|
+
};
|
|
43
|
+
var readDirectory = async (directory) => {
|
|
44
|
+
try {
|
|
45
|
+
return await import_promises.default.readdir(directory, { withFileTypes: true });
|
|
46
|
+
} catch (error) {
|
|
47
|
+
if (error.code === "ENOENT") return [];
|
|
48
|
+
throw error;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var mergeDirectory = async (sourceDirectory, destinationDirectory) => {
|
|
52
|
+
for (const entry of await readDirectory(sourceDirectory)) {
|
|
53
|
+
const sourcePath = import_node_path.default.join(sourceDirectory, entry.name);
|
|
54
|
+
const destinationPath = import_node_path.default.join(destinationDirectory, entry.name);
|
|
55
|
+
if (entry.isDirectory()) {
|
|
56
|
+
const destinationEntry = await import_promises.default.stat(destinationPath).catch((error) => {
|
|
57
|
+
if (error.code === "ENOENT") return void 0;
|
|
58
|
+
throw error;
|
|
59
|
+
});
|
|
60
|
+
if (destinationEntry && !destinationEntry.isDirectory()) {
|
|
61
|
+
await import_promises.default.rm(destinationPath, { recursive: true, force: true });
|
|
62
|
+
}
|
|
63
|
+
await import_promises.default.mkdir(destinationPath, { recursive: true });
|
|
64
|
+
await mergeDirectory(sourcePath, destinationPath);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
await import_promises.default.rm(destinationPath, { recursive: true, force: true });
|
|
68
|
+
await import_promises.default.copyFile(sourcePath, destinationPath);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var syncCustomComponents = async (projectDirectory, catalogDirectory) => {
|
|
72
|
+
const destinationDirectory = import_node_path.default.join(catalogDirectory, "src", "custom-defined-components");
|
|
73
|
+
const destinationParent = import_node_path.default.dirname(destinationDirectory);
|
|
74
|
+
await import_promises.default.mkdir(destinationParent, { recursive: true });
|
|
75
|
+
const stagingDirectory = await import_promises.default.mkdtemp(import_node_path.default.join(destinationParent, ".custom-defined-components.staging-"));
|
|
76
|
+
try {
|
|
77
|
+
await mergeDirectory(import_node_path.default.join(projectDirectory, "federated", "components"), stagingDirectory);
|
|
78
|
+
await mergeDirectory(import_node_path.default.join(projectDirectory, "components"), stagingDirectory);
|
|
79
|
+
await import_promises.default.rm(destinationDirectory, { recursive: true, force: true });
|
|
80
|
+
await import_promises.default.rename(stagingDirectory, destinationDirectory);
|
|
81
|
+
} finally {
|
|
82
|
+
await import_promises.default.rm(stagingDirectory, { recursive: true, force: true });
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
isCustomComponentPath,
|
|
88
|
+
syncCustomComponents
|
|
89
|
+
});
|