@eventcatalog/core 2.17.2 → 2.18.0
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 +2 -1
- package/dist/catalog-to-astro-content-directory.js +2 -2
- package/dist/{chunk-5RNDOKYT.js → chunk-7JDTB3U5.js} +2 -1
- package/dist/{chunk-EG3QHOOT.js → chunk-BOJXPVWN.js} +1 -1
- package/dist/chunk-HKXWXCBU.js +50 -0
- package/dist/{chunk-Q27R4PJA.js → chunk-PXBZMWYY.js} +1 -1
- package/dist/{chunk-NTCYOR4N.js → chunk-SHCMAL37.js} +3 -3
- package/dist/{chunk-55YPRY5U.js → chunk-WF34R5UT.js} +3 -3
- package/dist/{chunk-XSTP7ECG.js → chunk-XDIRGQ5U.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +54 -8
- package/dist/eventcatalog.config.d.cts +10 -0
- package/dist/eventcatalog.config.d.ts +10 -0
- package/dist/eventcatalog.js +12 -7
- package/dist/map-catalog-to-astro.cjs +2 -1
- package/dist/map-catalog-to-astro.js +1 -1
- package/dist/resolve-catalog-dependencies.cjs +112 -0
- package/dist/resolve-catalog-dependencies.d.cts +3 -0
- package/dist/resolve-catalog-dependencies.d.ts +3 -0
- package/dist/resolve-catalog-dependencies.js +7 -0
- package/dist/watcher.cjs +2 -1
- package/dist/watcher.js +2 -2
- package/eventcatalog/package-lock.json +564 -545
- package/eventcatalog/package.json +1 -1
- package/eventcatalog/src/utils/collections/domains.ts +12 -6
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-BOJXPVWN.js";
|
|
4
|
+
import "../chunk-PXBZMWYY.js";
|
|
5
|
+
import "../chunk-XDIRGQ5U.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
|
@@ -130,7 +130,8 @@ var COLLECTION_KEYS = [
|
|
|
130
130
|
"changelogs",
|
|
131
131
|
"queries",
|
|
132
132
|
"channels",
|
|
133
|
-
"ubiquitousLanguages"
|
|
133
|
+
"ubiquitousLanguages",
|
|
134
|
+
"dependencies"
|
|
134
135
|
];
|
|
135
136
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
136
137
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
@@ -12,7 +12,8 @@ var COLLECTION_KEYS = [
|
|
|
12
12
|
"changelogs",
|
|
13
13
|
"queries",
|
|
14
14
|
"channels",
|
|
15
|
-
"ubiquitousLanguages"
|
|
15
|
+
"ubiquitousLanguages",
|
|
16
|
+
"dependencies"
|
|
16
17
|
];
|
|
17
18
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
18
19
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getEventCatalogConfigFile
|
|
3
|
+
} from "./chunk-E7TXTI7G.js";
|
|
4
|
+
|
|
5
|
+
// src/resolve-catalog-dependencies.js
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
var resolve_catalog_dependencies_default = async (catalogDir, core) => {
|
|
9
|
+
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
10
|
+
const dependencies = catalogConfig?.dependencies ?? null;
|
|
11
|
+
if (!dependencies) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const dependenciesDir = path.join(catalogDir, "dependencies");
|
|
15
|
+
if (fs.existsSync(dependenciesDir)) {
|
|
16
|
+
fs.rmSync(dependenciesDir, { recursive: true, force: true });
|
|
17
|
+
}
|
|
18
|
+
fs.mkdirSync(dependenciesDir, { recursive: true });
|
|
19
|
+
const resourceTypes = Object.keys(dependencies);
|
|
20
|
+
for (const resourceType of resourceTypes) {
|
|
21
|
+
for (const dependency of dependencies[resourceType]) {
|
|
22
|
+
const resource = {
|
|
23
|
+
id: dependency.id,
|
|
24
|
+
version: dependency.version || "1.0.0"
|
|
25
|
+
};
|
|
26
|
+
const markdown = `---
|
|
27
|
+
id: ${resource.id}
|
|
28
|
+
name: ${resource.id}
|
|
29
|
+
version: ${resource.version}
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
:::warning
|
|
33
|
+
|
|
34
|
+
You are running EventCatalog with dependencies enabled.
|
|
35
|
+
|
|
36
|
+
This resource is mocked and is a dependency. This means that the resource is managed and owned by another catalog.
|
|
37
|
+
:::
|
|
38
|
+
|
|
39
|
+
`;
|
|
40
|
+
const resourceFile = path.join(dependenciesDir, resourceType, resource.id, `index.md`);
|
|
41
|
+
fs.mkdirSync(path.dirname(resourceFile), { recursive: true });
|
|
42
|
+
fs.writeFileSync(resourceFile, markdown);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
resolve_catalog_dependencies_default
|
|
50
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mapCatalogToAstro
|
|
3
|
+
} from "./chunk-7JDTB3U5.js";
|
|
1
4
|
import {
|
|
2
5
|
addPropertyToFrontMatter,
|
|
3
6
|
verifyRequiredFieldsAreInCatalogConfigFile
|
|
4
7
|
} from "./chunk-E7TXTI7G.js";
|
|
5
|
-
import {
|
|
6
|
-
mapCatalogToAstro
|
|
7
|
-
} from "./chunk-5RNDOKYT.js";
|
|
8
8
|
|
|
9
9
|
// src/catalog-to-astro-content-directory.js
|
|
10
10
|
import { glob } from "glob";
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -29,9 +29,9 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
29
29
|
// src/eventcatalog.ts
|
|
30
30
|
var import_commander = require("commander");
|
|
31
31
|
var import_node_child_process = require("child_process");
|
|
32
|
-
var
|
|
32
|
+
var import_node_path5 = require("path");
|
|
33
33
|
var import_fs2 = __toESM(require("fs"), 1);
|
|
34
|
-
var
|
|
34
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
35
35
|
var import_node_url = require("url");
|
|
36
36
|
var import_concurrently = __toESM(require("concurrently"), 1);
|
|
37
37
|
|
|
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
|
|
|
161
161
|
var import_os = __toESM(require("os"), 1);
|
|
162
162
|
|
|
163
163
|
// package.json
|
|
164
|
-
var version = "2.
|
|
164
|
+
var version = "2.18.0";
|
|
165
165
|
|
|
166
166
|
// src/constants.ts
|
|
167
167
|
var VERSION = version;
|
|
@@ -227,7 +227,8 @@ var COLLECTION_KEYS = [
|
|
|
227
227
|
"changelogs",
|
|
228
228
|
"queries",
|
|
229
229
|
"channels",
|
|
230
|
-
"ubiquitousLanguages"
|
|
230
|
+
"ubiquitousLanguages",
|
|
231
|
+
"dependencies"
|
|
231
232
|
];
|
|
232
233
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
233
234
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
@@ -465,12 +466,55 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
465
466
|
await ensureAstroCollectionNotEmpty(astroDir);
|
|
466
467
|
};
|
|
467
468
|
|
|
469
|
+
// src/resolve-catalog-dependencies.js
|
|
470
|
+
var import_node_path4 = __toESM(require("path"), 1);
|
|
471
|
+
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
472
|
+
var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
473
|
+
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
474
|
+
const dependencies = catalogConfig?.dependencies ?? null;
|
|
475
|
+
if (!dependencies) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const dependenciesDir = import_node_path4.default.join(catalogDir, "dependencies");
|
|
479
|
+
if (import_node_fs3.default.existsSync(dependenciesDir)) {
|
|
480
|
+
import_node_fs3.default.rmSync(dependenciesDir, { recursive: true, force: true });
|
|
481
|
+
}
|
|
482
|
+
import_node_fs3.default.mkdirSync(dependenciesDir, { recursive: true });
|
|
483
|
+
const resourceTypes = Object.keys(dependencies);
|
|
484
|
+
for (const resourceType of resourceTypes) {
|
|
485
|
+
for (const dependency of dependencies[resourceType]) {
|
|
486
|
+
const resource = {
|
|
487
|
+
id: dependency.id,
|
|
488
|
+
version: dependency.version || "1.0.0"
|
|
489
|
+
};
|
|
490
|
+
const markdown = `---
|
|
491
|
+
id: ${resource.id}
|
|
492
|
+
name: ${resource.id}
|
|
493
|
+
version: ${resource.version}
|
|
494
|
+
---
|
|
495
|
+
|
|
496
|
+
:::warning
|
|
497
|
+
|
|
498
|
+
You are running EventCatalog with dependencies enabled.
|
|
499
|
+
|
|
500
|
+
This resource is mocked and is a dependency. This means that the resource is managed and owned by another catalog.
|
|
501
|
+
:::
|
|
502
|
+
|
|
503
|
+
`;
|
|
504
|
+
const resourceFile = import_node_path4.default.join(dependenciesDir, resourceType, resource.id, `index.md`);
|
|
505
|
+
import_node_fs3.default.mkdirSync(import_node_path4.default.dirname(resourceFile), { recursive: true });
|
|
506
|
+
import_node_fs3.default.writeFileSync(resourceFile, markdown);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
return;
|
|
510
|
+
};
|
|
511
|
+
|
|
468
512
|
// src/eventcatalog.ts
|
|
469
|
-
var currentDir =
|
|
513
|
+
var currentDir = import_node_path6.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
470
514
|
var program = new import_commander.Command().version(VERSION);
|
|
471
|
-
var dir =
|
|
472
|
-
var core =
|
|
473
|
-
var eventCatalogDir =
|
|
515
|
+
var dir = import_node_path6.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
516
|
+
var core = import_node_path6.default.resolve(process.env.CATALOG_DIR || (0, import_node_path5.join)(dir, ".eventcatalog-core"));
|
|
517
|
+
var eventCatalogDir = import_node_path6.default.resolve((0, import_node_path5.join)(currentDir, "../eventcatalog/"));
|
|
474
518
|
program.name("eventcatalog").description("Documentation tool for event-driven architectures");
|
|
475
519
|
var ensureDir = (dir2) => {
|
|
476
520
|
if (!import_fs2.default.existsSync(dir2)) {
|
|
@@ -502,6 +546,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
502
546
|
if (options.forceRecreate) clearCore();
|
|
503
547
|
copyCore();
|
|
504
548
|
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
549
|
+
await resolve_catalog_dependencies_default(dir, core);
|
|
505
550
|
await catalogToAstro(dir, core);
|
|
506
551
|
let watchUnsub;
|
|
507
552
|
try {
|
|
@@ -528,6 +573,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
528
573
|
console.log("Building EventCatalog...");
|
|
529
574
|
copyCore();
|
|
530
575
|
await log_build_default(dir);
|
|
576
|
+
await resolve_catalog_dependencies_default(dir, core);
|
|
531
577
|
await catalogToAstro(dir, core);
|
|
532
578
|
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build ${command.args.join(" ").trim()}`, {
|
|
533
579
|
cwd: core,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
type SideBarConfig = {
|
|
2
2
|
visible: boolean;
|
|
3
3
|
};
|
|
4
|
+
type ResourceDependency = {
|
|
5
|
+
id: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
};
|
|
4
8
|
interface Config {
|
|
5
9
|
title: string;
|
|
6
10
|
tagline: false;
|
|
@@ -30,6 +34,12 @@ interface Config {
|
|
|
30
34
|
users?: SideBarConfig;
|
|
31
35
|
};
|
|
32
36
|
};
|
|
37
|
+
dependencies?: {
|
|
38
|
+
commands?: ResourceDependency[];
|
|
39
|
+
events?: ResourceDependency[];
|
|
40
|
+
services?: ResourceDependency[];
|
|
41
|
+
domains?: ResourceDependency[];
|
|
42
|
+
};
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
export type { Config };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
type SideBarConfig = {
|
|
2
2
|
visible: boolean;
|
|
3
3
|
};
|
|
4
|
+
type ResourceDependency = {
|
|
5
|
+
id: string;
|
|
6
|
+
version?: string;
|
|
7
|
+
};
|
|
4
8
|
interface Config {
|
|
5
9
|
title: string;
|
|
6
10
|
tagline: false;
|
|
@@ -30,6 +34,12 @@ interface Config {
|
|
|
30
34
|
users?: SideBarConfig;
|
|
31
35
|
};
|
|
32
36
|
};
|
|
37
|
+
dependencies?: {
|
|
38
|
+
commands?: ResourceDependency[];
|
|
39
|
+
events?: ResourceDependency[];
|
|
40
|
+
services?: ResourceDependency[];
|
|
41
|
+
domains?: ResourceDependency[];
|
|
42
|
+
};
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
export type { Config };
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
watch
|
|
3
|
+
} from "./chunk-SHCMAL37.js";
|
|
1
4
|
import {
|
|
2
5
|
log_build_default
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-BOJXPVWN.js";
|
|
7
|
+
import "./chunk-PXBZMWYY.js";
|
|
5
8
|
import {
|
|
6
9
|
catalogToAstro
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-WF34R5UT.js";
|
|
8
11
|
import {
|
|
9
12
|
VERSION
|
|
10
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-XDIRGQ5U.js";
|
|
11
14
|
import {
|
|
12
15
|
generate
|
|
13
16
|
} from "./chunk-YEQVKHST.js";
|
|
17
|
+
import "./chunk-7JDTB3U5.js";
|
|
14
18
|
import {
|
|
15
|
-
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
resolve_catalog_dependencies_default
|
|
20
|
+
} from "./chunk-HKXWXCBU.js";
|
|
17
21
|
import "./chunk-E7TXTI7G.js";
|
|
18
|
-
import "./chunk-5RNDOKYT.js";
|
|
19
22
|
|
|
20
23
|
// src/eventcatalog.ts
|
|
21
24
|
import { Command } from "commander";
|
|
@@ -61,6 +64,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
61
64
|
if (options.forceRecreate) clearCore();
|
|
62
65
|
copyCore();
|
|
63
66
|
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
67
|
+
await resolve_catalog_dependencies_default(dir, core);
|
|
64
68
|
await catalogToAstro(dir, core);
|
|
65
69
|
let watchUnsub;
|
|
66
70
|
try {
|
|
@@ -87,6 +91,7 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
87
91
|
console.log("Building EventCatalog...");
|
|
88
92
|
copyCore();
|
|
89
93
|
await log_build_default(dir);
|
|
94
|
+
await resolve_catalog_dependencies_default(dir, core);
|
|
90
95
|
await catalogToAstro(dir, core);
|
|
91
96
|
execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build ${command.args.join(" ").trim()}`, {
|
|
92
97
|
cwd: core,
|
|
@@ -46,7 +46,8 @@ var COLLECTION_KEYS = [
|
|
|
46
46
|
"changelogs",
|
|
47
47
|
"queries",
|
|
48
48
|
"channels",
|
|
49
|
-
"ubiquitousLanguages"
|
|
49
|
+
"ubiquitousLanguages",
|
|
50
|
+
"dependencies"
|
|
50
51
|
];
|
|
51
52
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
52
53
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
@@ -0,0 +1,112 @@
|
|
|
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/resolve-catalog-dependencies.js
|
|
31
|
+
var resolve_catalog_dependencies_exports = {};
|
|
32
|
+
__export(resolve_catalog_dependencies_exports, {
|
|
33
|
+
default: () => resolve_catalog_dependencies_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(resolve_catalog_dependencies_exports);
|
|
36
|
+
|
|
37
|
+
// src/eventcatalog-config-file-utils.js
|
|
38
|
+
var import_promises = require("fs/promises");
|
|
39
|
+
var import_node_fs = require("fs");
|
|
40
|
+
var import_promises2 = require("fs/promises");
|
|
41
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
42
|
+
var import_uuid = require("uuid");
|
|
43
|
+
var import_url = require("url");
|
|
44
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
45
|
+
async function cleanup(projectDirectory) {
|
|
46
|
+
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
47
|
+
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
48
|
+
await (0, import_promises.rm)(filePath);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
52
|
+
try {
|
|
53
|
+
let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
54
|
+
const filePath = import_node_path.default.join(projectDirectory, "package.json");
|
|
55
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
|
|
56
|
+
if (packageJson?.type !== "module") {
|
|
57
|
+
await (0, import_promises2.copyFile)(configFilePath, import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs"));
|
|
58
|
+
configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
59
|
+
}
|
|
60
|
+
const configFileURL = (0, import_url.pathToFileURL)(configFilePath).href;
|
|
61
|
+
const config = await import(
|
|
62
|
+
/* @vite-ignore */
|
|
63
|
+
configFileURL
|
|
64
|
+
);
|
|
65
|
+
return config.default;
|
|
66
|
+
} finally {
|
|
67
|
+
await cleanup(projectDirectory);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/resolve-catalog-dependencies.js
|
|
72
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
73
|
+
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
74
|
+
var resolve_catalog_dependencies_default = async (catalogDir, core) => {
|
|
75
|
+
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
76
|
+
const dependencies = catalogConfig?.dependencies ?? null;
|
|
77
|
+
if (!dependencies) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const dependenciesDir = import_node_path2.default.join(catalogDir, "dependencies");
|
|
81
|
+
if (import_node_fs2.default.existsSync(dependenciesDir)) {
|
|
82
|
+
import_node_fs2.default.rmSync(dependenciesDir, { recursive: true, force: true });
|
|
83
|
+
}
|
|
84
|
+
import_node_fs2.default.mkdirSync(dependenciesDir, { recursive: true });
|
|
85
|
+
const resourceTypes = Object.keys(dependencies);
|
|
86
|
+
for (const resourceType of resourceTypes) {
|
|
87
|
+
for (const dependency of dependencies[resourceType]) {
|
|
88
|
+
const resource = {
|
|
89
|
+
id: dependency.id,
|
|
90
|
+
version: dependency.version || "1.0.0"
|
|
91
|
+
};
|
|
92
|
+
const markdown = `---
|
|
93
|
+
id: ${resource.id}
|
|
94
|
+
name: ${resource.id}
|
|
95
|
+
version: ${resource.version}
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
:::warning
|
|
99
|
+
|
|
100
|
+
You are running EventCatalog with dependencies enabled.
|
|
101
|
+
|
|
102
|
+
This resource is mocked and is a dependency. This means that the resource is managed and owned by another catalog.
|
|
103
|
+
:::
|
|
104
|
+
|
|
105
|
+
`;
|
|
106
|
+
const resourceFile = import_node_path2.default.join(dependenciesDir, resourceType, resource.id, `index.md`);
|
|
107
|
+
import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(resourceFile), { recursive: true });
|
|
108
|
+
import_node_fs2.default.writeFileSync(resourceFile, markdown);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return;
|
|
112
|
+
};
|
package/dist/watcher.cjs
CHANGED
|
@@ -50,7 +50,8 @@ var COLLECTION_KEYS = [
|
|
|
50
50
|
"changelogs",
|
|
51
51
|
"queries",
|
|
52
52
|
"channels",
|
|
53
|
-
"ubiquitousLanguages"
|
|
53
|
+
"ubiquitousLanguages",
|
|
54
|
+
"dependencies"
|
|
54
55
|
];
|
|
55
56
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
56
57
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|