@eventcatalog/core 2.16.2 → 2.16.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/{chunk-5K2SMJL6.js → chunk-FVZU5WEI.js} +1 -1
- package/dist/{chunk-7V6DXP63.js → chunk-JLXI6Z6O.js} +1 -1
- package/dist/{chunk-D5BKFMHD.js → chunk-ULFGBIV2.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/package.json +69 -0
- package/eventcatalog/src/components/MDX/Accordion/Accordion.tsx +2 -2
- package/eventcatalog/src/components/MDX/AsyncAPI/AsyncAPI.astro +2 -2
- package/eventcatalog/src/components/MDX/ChannelInformation/ChannelInformation.tsx +2 -2
- package/eventcatalog/src/components/MDX/Flow/Flow.astro +2 -2
- package/eventcatalog/src/components/MDX/NodeGraph/DownloadButton.tsx +2 -2
- package/eventcatalog/src/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +2 -1
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.astro +12 -1
- package/eventcatalog/src/components/MDX/NodeGraph/NodeGraph.tsx +6 -5
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Channel.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Command.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Event.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Query.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Service.tsx +1 -1
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/Step.tsx +3 -3
- package/eventcatalog/src/components/MDX/NodeGraph/Nodes/User.tsx +3 -3
- package/eventcatalog/src/components/MDX/OpenAPI/OpenAPI.astro +2 -2
- package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewer.astro +2 -2
- package/eventcatalog/src/components/SideBars/CatalogResourcesSideBar/index.tsx +10 -1
- package/eventcatalog/src/components/Tables/Table.tsx +15 -5
- package/eventcatalog/src/components/Tables/columns/DomainTableColumns.tsx +4 -10
- package/eventcatalog/src/components/Tables/columns/FlowTableColumns.tsx +3 -3
- package/eventcatalog/src/components/Tables/columns/MessageTableColumns.tsx +5 -2
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +2 -8
- package/eventcatalog/src/components/Tables/columns/SharedColumns.tsx +44 -0
- package/eventcatalog/src/components/Tables/filters/custom-filters.ts +5 -0
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +12 -7
- package/eventcatalog/src/layouts/DiscoverLayout.astro +1 -1
- package/eventcatalog/src/layouts/VerticalSideBarLayout.astro +10 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/language.astro +6 -6
- package/eventcatalog/src/pages/visualiser/context-map/index.astro +30 -0
- package/eventcatalog/src/utils/collections/icons.ts +3 -0
- package/eventcatalog/src/utils/collections/services.ts +35 -0
- package/eventcatalog/src/utils/node-graphs/domains-node-graph.ts +206 -3
- package/eventcatalog/src/utils/node-graphs/flows-node-graph.ts +2 -2
- package/eventcatalog/src/utils/node-graphs/message-node-graph.ts +1 -1
- package/eventcatalog/src/utils/node-graphs/services-node-graph.ts +1 -1
- package/eventcatalog/src/utils/node-graphs/utils/utils.ts +1 -1
- package/package.json +2 -2
- package/bin/dist/eventcatalog.cjs +0 -558
- package/bin/dist/eventcatalog.config.cjs +0 -18
- package/bin/dist/eventcatalog.config.d.cts +0 -35
- package/bin/dist/eventcatalog.config.d.ts +0 -35
- package/bin/dist/eventcatalog.config.js +0 -0
- package/bin/dist/eventcatalog.d.cts +0 -1
- package/bin/dist/eventcatalog.d.ts +0 -1
- package/bin/dist/eventcatalog.js +0 -531
|
@@ -1,558 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
22
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
23
|
-
mod
|
|
24
|
-
));
|
|
25
|
-
|
|
26
|
-
// node_modules/tsup/assets/cjs_shims.js
|
|
27
|
-
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
28
|
-
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
29
|
-
|
|
30
|
-
// bin/eventcatalog.ts
|
|
31
|
-
var import_commander = require("commander");
|
|
32
|
-
var import_node_child_process = require("child_process");
|
|
33
|
-
var import_node_path4 = require("path");
|
|
34
|
-
var import_fs2 = __toESM(require("fs"), 1);
|
|
35
|
-
var import_node_path5 = __toESM(require("path"), 1);
|
|
36
|
-
var import_node_url = require("url");
|
|
37
|
-
var import_concurrently = __toESM(require("concurrently"), 1);
|
|
38
|
-
|
|
39
|
-
// scripts/generate.js
|
|
40
|
-
var import_node_path2 = __toESM(require("path"), 1);
|
|
41
|
-
|
|
42
|
-
// scripts/eventcatalog-config-file-utils.js
|
|
43
|
-
var import_promises = require("fs/promises");
|
|
44
|
-
var import_node_fs = require("fs");
|
|
45
|
-
var import_promises2 = require("fs/promises");
|
|
46
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
47
|
-
var import_uuid = require("uuid");
|
|
48
|
-
var import_url = require("url");
|
|
49
|
-
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
50
|
-
async function cleanup(projectDirectory) {
|
|
51
|
-
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
52
|
-
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
53
|
-
await (0, import_promises.rm)(filePath);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
57
|
-
try {
|
|
58
|
-
let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
59
|
-
const filePath = import_node_path.default.join(projectDirectory, "package.json");
|
|
60
|
-
const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
|
|
61
|
-
if (packageJson?.type !== "module") {
|
|
62
|
-
await (0, import_promises2.copyFile)(configFilePath, import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs"));
|
|
63
|
-
configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
64
|
-
}
|
|
65
|
-
const configFileURL = (0, import_url.pathToFileURL)(configFilePath).href;
|
|
66
|
-
const config = await import(
|
|
67
|
-
/* @vite-ignore */
|
|
68
|
-
configFileURL
|
|
69
|
-
);
|
|
70
|
-
return config.default;
|
|
71
|
-
} finally {
|
|
72
|
-
await cleanup(projectDirectory);
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
var writeEventCatalogConfigFile = async (projectDirectory, newConfig) => {
|
|
76
|
-
try {
|
|
77
|
-
const configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
78
|
-
let content = await (0, import_promises.readFile)(configFilePath, "utf8");
|
|
79
|
-
const startIndex = content.indexOf("export default {");
|
|
80
|
-
if (startIndex === -1) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
Object.entries(newConfig).forEach(([key, value]) => {
|
|
84
|
-
const valueString = JSON.stringify(value, null, 2).replace(/"/g, "'").replace(/\n/g, "\n ");
|
|
85
|
-
const keyRegex = new RegExp(`(${key}\\s*:)([^,}]+)`, "g");
|
|
86
|
-
if (content.match(keyRegex)) {
|
|
87
|
-
content = content.replace(keyRegex, `$1 ${valueString}`);
|
|
88
|
-
} else {
|
|
89
|
-
const insertPosition = content.indexOf("{", startIndex) + 1;
|
|
90
|
-
content = content.slice(0, insertPosition) + `
|
|
91
|
-
${key}: ${valueString},` + content.slice(insertPosition);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
await (0, import_promises.writeFile)(configFilePath, content);
|
|
95
|
-
} finally {
|
|
96
|
-
await cleanup(projectDirectory);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
100
|
-
try {
|
|
101
|
-
const config = await getEventCatalogConfigFile(projectDirectory);
|
|
102
|
-
if (!config.cId) {
|
|
103
|
-
await writeEventCatalogConfigFile(projectDirectory, { cId: (0, import_uuid.v4)() });
|
|
104
|
-
}
|
|
105
|
-
} catch (error) {
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
function addPropertyToFrontMatter(input, newProperty, newValue) {
|
|
109
|
-
const file = (0, import_gray_matter.default)(input);
|
|
110
|
-
return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// scripts/generate.js
|
|
114
|
-
function getDefaultExport(importedModule) {
|
|
115
|
-
if (importedModule === null || typeof importedModule !== "object") {
|
|
116
|
-
throw new Error("Invalid module");
|
|
117
|
-
}
|
|
118
|
-
if (typeof importedModule.default === "object" && importedModule.default !== null) {
|
|
119
|
-
return importedModule.default.default || importedModule.default;
|
|
120
|
-
}
|
|
121
|
-
if (typeof importedModule.default !== "undefined") {
|
|
122
|
-
return importedModule.default;
|
|
123
|
-
}
|
|
124
|
-
return importedModule;
|
|
125
|
-
}
|
|
126
|
-
var generate = async (PROJECT_DIRECTORY) => {
|
|
127
|
-
try {
|
|
128
|
-
const config = await getEventCatalogConfigFile(PROJECT_DIRECTORY);
|
|
129
|
-
const { generators = [] } = config;
|
|
130
|
-
if (!generators.length) {
|
|
131
|
-
console.log("No configured generators found, skipping generation");
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
for (const generator of generators) {
|
|
135
|
-
let plugin = generator[0];
|
|
136
|
-
const pluginConfig = generator[1];
|
|
137
|
-
if (plugin.startsWith("./")) {
|
|
138
|
-
plugin = import_node_path2.default.join(PROJECT_DIRECTORY, plugin);
|
|
139
|
-
}
|
|
140
|
-
if (plugin.includes("<rootDir>")) {
|
|
141
|
-
plugin = plugin.replace("<rootDir>", PROJECT_DIRECTORY);
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
const importedGenerator = await import(plugin);
|
|
145
|
-
const generator2 = getDefaultExport(importedGenerator);
|
|
146
|
-
await generator2({ eventCatalogConfig: {} }, pluginConfig);
|
|
147
|
-
} catch (error) {
|
|
148
|
-
console.error("Error loading plugin:", error);
|
|
149
|
-
await cleanup(PROJECT_DIRECTORY);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
await cleanup(PROJECT_DIRECTORY);
|
|
154
|
-
} catch (error) {
|
|
155
|
-
console.error(error);
|
|
156
|
-
await cleanup(PROJECT_DIRECTORY);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
// scripts/analytics/analytics.js
|
|
161
|
-
var import_axios = __toESM(require("axios"), 1);
|
|
162
|
-
var import_os = __toESM(require("os"), 1);
|
|
163
|
-
|
|
164
|
-
// package.json
|
|
165
|
-
var version = "2.14.3";
|
|
166
|
-
|
|
167
|
-
// scripts/constants.ts
|
|
168
|
-
var VERSION = version;
|
|
169
|
-
|
|
170
|
-
// scripts/analytics/analytics.js
|
|
171
|
-
async function raiseEvent(eventData) {
|
|
172
|
-
const url = "https://queue.simpleanalyticscdn.com/events";
|
|
173
|
-
const userAgent = `@eventcatalog/eventcatalog@${VERSION} (${import_os.default.platform()}; ${import_os.default.arch()}; Node/${process.version})`;
|
|
174
|
-
const headers = {
|
|
175
|
-
"Content-Type": "application/json"
|
|
176
|
-
};
|
|
177
|
-
const payload = {
|
|
178
|
-
type: "event",
|
|
179
|
-
hostname: "eventcatalog.dev",
|
|
180
|
-
event: "@eventcatalog/eventcatalog",
|
|
181
|
-
metadata: {
|
|
182
|
-
...eventData,
|
|
183
|
-
t: `t;${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
184
|
-
ua: userAgent
|
|
185
|
-
},
|
|
186
|
-
ua: userAgent
|
|
187
|
-
};
|
|
188
|
-
try {
|
|
189
|
-
await import_axios.default.post(url, payload, { headers });
|
|
190
|
-
} catch (error) {
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// scripts/analytics/log-build.js
|
|
195
|
-
var main = async (projectDir) => {
|
|
196
|
-
if (process.env.NODE_ENV === "CI") return;
|
|
197
|
-
try {
|
|
198
|
-
await verifyRequiredFieldsAreInCatalogConfigFile(projectDir);
|
|
199
|
-
const configFile = await getEventCatalogConfigFile(projectDir);
|
|
200
|
-
const { cId, organizationName, generators = [] } = configFile;
|
|
201
|
-
const generatorNames = generators.length > 0 ? generators.map((generator) => generator[0]) : ["none"];
|
|
202
|
-
await raiseEvent({
|
|
203
|
-
command: "build",
|
|
204
|
-
org: organizationName,
|
|
205
|
-
cId,
|
|
206
|
-
generators: generatorNames.toString()
|
|
207
|
-
});
|
|
208
|
-
} catch (error) {
|
|
209
|
-
}
|
|
210
|
-
};
|
|
211
|
-
var log_build_default = main;
|
|
212
|
-
|
|
213
|
-
// scripts/watcher.js
|
|
214
|
-
var import_watcher = __toESM(require("@parcel/watcher"), 1);
|
|
215
|
-
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
216
|
-
|
|
217
|
-
// scripts/map-catalog-to-astro.js
|
|
218
|
-
var import_node_path3 = __toESM(require("path"), 1);
|
|
219
|
-
var COLLECTION_KEYS = [
|
|
220
|
-
"events",
|
|
221
|
-
"commands",
|
|
222
|
-
"services",
|
|
223
|
-
"users",
|
|
224
|
-
"teams",
|
|
225
|
-
"domains",
|
|
226
|
-
"flows",
|
|
227
|
-
"pages",
|
|
228
|
-
"changelogs",
|
|
229
|
-
"queries",
|
|
230
|
-
"channels"
|
|
231
|
-
];
|
|
232
|
-
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
233
|
-
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
234
|
-
if (!isCatalogRelated(relativeFilePath)) {
|
|
235
|
-
return [];
|
|
236
|
-
}
|
|
237
|
-
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
238
|
-
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
239
|
-
return baseTargetPaths.map(
|
|
240
|
-
(base) => import_node_path3.default.join(astroDir, base, relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx"))
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
function removeBasePath(fullPath, basePath) {
|
|
244
|
-
const relativePath = import_node_path3.default.relative(basePath, fullPath);
|
|
245
|
-
return relativePath.startsWith("..") ? fullPath : relativePath;
|
|
246
|
-
}
|
|
247
|
-
function isCollectionKey(key) {
|
|
248
|
-
return COLLECTION_KEYS.includes(key);
|
|
249
|
-
}
|
|
250
|
-
function isCatalogRelated(filePath) {
|
|
251
|
-
const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
|
|
252
|
-
if ([
|
|
253
|
-
"eventcatalog.config.js",
|
|
254
|
-
// config file at root
|
|
255
|
-
"eventcatalog.styles.css",
|
|
256
|
-
// custom styles file at root
|
|
257
|
-
"components",
|
|
258
|
-
// custom components
|
|
259
|
-
"public",
|
|
260
|
-
// public assets
|
|
261
|
-
...COLLECTION_KEYS
|
|
262
|
-
].includes(filePathArr[0])) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
function getBaseTargetPaths(filePath) {
|
|
268
|
-
const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
|
|
269
|
-
if (isCollectionKey(filePathArr[0])) {
|
|
270
|
-
if (filePathArr[filePathArr.length - 1] == "changelog.md") {
|
|
271
|
-
return [import_node_path3.default.join("src", "content", "changelogs")];
|
|
272
|
-
}
|
|
273
|
-
if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
|
|
274
|
-
return [import_node_path3.default.join("src", "content")];
|
|
275
|
-
}
|
|
276
|
-
const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
|
|
277
|
-
if (hasExtension(filePath)) {
|
|
278
|
-
return [import_node_path3.default.join("public", "generated"), import_node_path3.default.join("src", "catalog-files")];
|
|
279
|
-
}
|
|
280
|
-
return [import_node_path3.default.join("public", "generated"), import_node_path3.default.join("src", "catalog-files"), import_node_path3.default.join("src", "content")];
|
|
281
|
-
}
|
|
282
|
-
if (filePathArr[0] == "components") {
|
|
283
|
-
return [import_node_path3.default.join("src", "custom-defined-components")];
|
|
284
|
-
}
|
|
285
|
-
if (filePathArr[0] == "public") {
|
|
286
|
-
return [import_node_path3.default.join("public")];
|
|
287
|
-
}
|
|
288
|
-
return [import_node_path3.default.join("/")];
|
|
289
|
-
}
|
|
290
|
-
function getRelativeTargetPath(filePath) {
|
|
291
|
-
const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
|
|
292
|
-
if (filePathArr[0] == "public" || filePathArr[0] == "components") {
|
|
293
|
-
filePathArr.shift();
|
|
294
|
-
}
|
|
295
|
-
const relativePath = [];
|
|
296
|
-
for (let i = filePathArr.length - 1; i >= 0; i--) {
|
|
297
|
-
relativePath.unshift(filePathArr[i]);
|
|
298
|
-
if (isCollectionKey(filePathArr[i])) break;
|
|
299
|
-
}
|
|
300
|
-
return import_node_path3.default.join(...relativePath);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// scripts/watcher.js
|
|
304
|
-
var import_rimraf = require("rimraf");
|
|
305
|
-
async function watch(projectDirectory, catalogDirectory, callback = void 0) {
|
|
306
|
-
const subscription = await import_watcher.default.subscribe(
|
|
307
|
-
projectDirectory,
|
|
308
|
-
compose(
|
|
309
|
-
/**
|
|
310
|
-
* @param {Error|null} err
|
|
311
|
-
* @param {Event[]} events
|
|
312
|
-
* @returns {unknown}
|
|
313
|
-
*/
|
|
314
|
-
(err, events) => {
|
|
315
|
-
if (err) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
for (let event of events) {
|
|
319
|
-
const { path: filePath, type } = event;
|
|
320
|
-
const astroPaths = mapCatalogToAstro({
|
|
321
|
-
filePath,
|
|
322
|
-
astroDir: catalogDirectory,
|
|
323
|
-
projectDir: projectDirectory
|
|
324
|
-
});
|
|
325
|
-
for (const astroPath of astroPaths) {
|
|
326
|
-
switch (type) {
|
|
327
|
-
case "create":
|
|
328
|
-
case "update":
|
|
329
|
-
try {
|
|
330
|
-
if (astroPath.endsWith(".mdx")) {
|
|
331
|
-
const content = import_node_fs2.default.readFileSync(astroPath, "utf-8");
|
|
332
|
-
const frontmatter = addPropertyToFrontMatter(content, "pathToFile", filePath);
|
|
333
|
-
import_node_fs2.default.writeFileSync(astroPath, frontmatter);
|
|
334
|
-
}
|
|
335
|
-
} catch (error) {
|
|
336
|
-
}
|
|
337
|
-
if (import_node_fs2.default.statSync(filePath).isDirectory()) import_node_fs2.default.mkdirSync(astroPath, { recursive: true });
|
|
338
|
-
else retryEPERM(import_node_fs2.default.cpSync)(filePath, astroPath);
|
|
339
|
-
break;
|
|
340
|
-
case "delete":
|
|
341
|
-
retryEPERM(import_rimraf.rimrafSync)(astroPath);
|
|
342
|
-
break;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
callback
|
|
348
|
-
),
|
|
349
|
-
{
|
|
350
|
-
ignore: [`**/${catalogDirectory}/!(${projectDirectory})**`]
|
|
351
|
-
}
|
|
352
|
-
);
|
|
353
|
-
return () => subscription.unsubscribe();
|
|
354
|
-
}
|
|
355
|
-
function compose(...fns) {
|
|
356
|
-
return function(err, events) {
|
|
357
|
-
fns.filter(Boolean).forEach((fn, i) => {
|
|
358
|
-
try {
|
|
359
|
-
fn(err, events);
|
|
360
|
-
} catch (error) {
|
|
361
|
-
console.error({ error });
|
|
362
|
-
throw error;
|
|
363
|
-
}
|
|
364
|
-
});
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
var MAX_RETRIES = 5;
|
|
368
|
-
var DELAY_MS = 100;
|
|
369
|
-
function retryEPERM(fn) {
|
|
370
|
-
return (...args) => {
|
|
371
|
-
let retries = 0;
|
|
372
|
-
while (retries < MAX_RETRIES) {
|
|
373
|
-
try {
|
|
374
|
-
return fn(...args);
|
|
375
|
-
} catch (err) {
|
|
376
|
-
if (err.code !== "EPERM") throw err;
|
|
377
|
-
setTimeout(() => {
|
|
378
|
-
}, DELAY_MS);
|
|
379
|
-
retries += 1;
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
// scripts/catalog-to-astro-content-directory.js
|
|
386
|
-
var import_glob = require("glob");
|
|
387
|
-
var path4 = __toESM(require("path"), 1);
|
|
388
|
-
var import_fs = __toESM(require("fs"), 1);
|
|
389
|
-
var import_url2 = require("url");
|
|
390
|
-
var import_node_os = __toESM(require("os"), 1);
|
|
391
|
-
var __filename2 = (0, import_url2.fileURLToPath)(importMetaUrl);
|
|
392
|
-
var rootPkg = path4.resolve(
|
|
393
|
-
path4.dirname(__filename2),
|
|
394
|
-
/**
|
|
395
|
-
* TODO: fix me =0
|
|
396
|
-
*
|
|
397
|
-
* The following is a workaround until organize the structure to have the correct path
|
|
398
|
-
* for any value of NODE_ENV
|
|
399
|
-
*
|
|
400
|
-
* @author carlosallexandre
|
|
401
|
-
*/
|
|
402
|
-
process.env.NODE_ENV === "test" ? "../" : "../../"
|
|
403
|
-
);
|
|
404
|
-
var copyFiles = async (source, target) => {
|
|
405
|
-
const files = await (0, import_glob.glob)(path4.join(source, "**"), {
|
|
406
|
-
nodir: true,
|
|
407
|
-
windowsPathsNoEscape: import_node_os.default.platform() == "win32"
|
|
408
|
-
});
|
|
409
|
-
for (const file of files) {
|
|
410
|
-
mapCatalogToAstro({
|
|
411
|
-
filePath: file,
|
|
412
|
-
astroDir: target,
|
|
413
|
-
projectDir: source
|
|
414
|
-
}).map((astroPath) => {
|
|
415
|
-
import_fs.default.cpSync(file, astroPath);
|
|
416
|
-
return { oldPath: file, newPath: astroPath };
|
|
417
|
-
}).map(({ oldPath, newPath }) => {
|
|
418
|
-
if (!oldPath.endsWith(".md") && !oldPath.endsWith(".mdx")) return;
|
|
419
|
-
try {
|
|
420
|
-
const content = import_fs.default.readFileSync(newPath, "utf-8");
|
|
421
|
-
const frontmatter = addPropertyToFrontMatter(content, "pathToFile", oldPath);
|
|
422
|
-
import_fs.default.writeFileSync(newPath, frontmatter);
|
|
423
|
-
} catch (error) {
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
|
-
};
|
|
428
|
-
var ensureAstroCollectionNotEmpty = async (astroDir) => {
|
|
429
|
-
const COLLECTIONS = [
|
|
430
|
-
"events",
|
|
431
|
-
"commands",
|
|
432
|
-
"services",
|
|
433
|
-
"users",
|
|
434
|
-
"teams",
|
|
435
|
-
"domains",
|
|
436
|
-
"flows",
|
|
437
|
-
"pages",
|
|
438
|
-
"changelogs",
|
|
439
|
-
"queries",
|
|
440
|
-
"channels"
|
|
441
|
-
];
|
|
442
|
-
const emptyCollections = [];
|
|
443
|
-
for (const collection of COLLECTIONS) {
|
|
444
|
-
const markdownFiles = await (0, import_glob.glob)(path4.join(astroDir, "src/content/", collection, "**"), {
|
|
445
|
-
nodir: true,
|
|
446
|
-
windowsPathsNoEscape: import_node_os.default.platform() == "win32"
|
|
447
|
-
});
|
|
448
|
-
if (markdownFiles.length === 0) emptyCollections.push(collection);
|
|
449
|
-
}
|
|
450
|
-
const defaultCollectionFilesDir = path4.join(rootPkg, "default-files-for-collections");
|
|
451
|
-
for (const collection of emptyCollections) {
|
|
452
|
-
const defaultFile = path4.join(defaultCollectionFilesDir, `${collection}.md`);
|
|
453
|
-
const targetDir = path4.join(astroDir, "src/content/", collection);
|
|
454
|
-
if (!import_fs.default.existsSync(targetDir)) {
|
|
455
|
-
import_fs.default.mkdirSync(targetDir, { recursive: true });
|
|
456
|
-
}
|
|
457
|
-
import_fs.default.cpSync(defaultFile, path4.join(targetDir, `${collection}.md`));
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
var catalogToAstro = async (source, astroDir) => {
|
|
461
|
-
const astroContentDir = path4.join(astroDir, "src/content/");
|
|
462
|
-
const astroConfigFile = import_fs.default.readFileSync(path4.join(astroContentDir, "config.ts"));
|
|
463
|
-
import_fs.default.rmSync(astroContentDir, { recursive: true });
|
|
464
|
-
import_fs.default.mkdirSync(astroContentDir);
|
|
465
|
-
import_fs.default.writeFileSync(path4.join(astroContentDir, "config.ts"), astroConfigFile);
|
|
466
|
-
await verifyRequiredFieldsAreInCatalogConfigFile(source);
|
|
467
|
-
await copyFiles(source, astroDir);
|
|
468
|
-
await ensureAstroCollectionNotEmpty(astroDir);
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
// bin/eventcatalog.ts
|
|
472
|
-
var currentDir = import_node_path5.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
473
|
-
var program = new import_commander.Command().version(VERSION);
|
|
474
|
-
var dir = import_node_path5.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
475
|
-
var core = import_node_path5.default.resolve(process.env.CATALOG_DIR || (0, import_node_path4.join)(dir, ".eventcatalog-core"));
|
|
476
|
-
var eventCatalogDir = import_node_path5.default.resolve((0, import_node_path4.join)(currentDir, "../../eventcatalog/"));
|
|
477
|
-
program.name("eventcatalog").description("Documentation tool for event-driven architectures");
|
|
478
|
-
var ensureDir = (dir2) => {
|
|
479
|
-
if (!import_fs2.default.existsSync(dir2)) {
|
|
480
|
-
import_fs2.default.mkdirSync(dir2);
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
var copyCore = () => {
|
|
484
|
-
ensureDir(core);
|
|
485
|
-
if (eventCatalogDir === core) {
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
|
-
import_fs2.default.cpSync(eventCatalogDir, core, {
|
|
489
|
-
recursive: true,
|
|
490
|
-
filter: (src) => {
|
|
491
|
-
return true;
|
|
492
|
-
}
|
|
493
|
-
});
|
|
494
|
-
};
|
|
495
|
-
var clearCore = () => {
|
|
496
|
-
if (import_fs2.default.existsSync(core)) import_fs2.default.rmSync(core, { recursive: true });
|
|
497
|
-
};
|
|
498
|
-
program.command("dev").description("Run development server of EventCatalog").option("-d, --debug", "Output EventCatalog application information into your terminal").option("--force-recreate", "Recreate the eventcatalog-core directory", false).action(async (options) => {
|
|
499
|
-
console.log("Setting up EventCatalog....");
|
|
500
|
-
if (options.debug) {
|
|
501
|
-
console.log("Debug mode enabled");
|
|
502
|
-
console.log("PROJECT_DIR", dir);
|
|
503
|
-
console.log("CATALOG_DIR", core);
|
|
504
|
-
}
|
|
505
|
-
if (options.forceRecreate) clearCore();
|
|
506
|
-
copyCore();
|
|
507
|
-
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
508
|
-
await catalogToAstro(dir, core);
|
|
509
|
-
let watchUnsub;
|
|
510
|
-
try {
|
|
511
|
-
watchUnsub = await watch(dir, core);
|
|
512
|
-
const { result } = (0, import_concurrently.default)([
|
|
513
|
-
{
|
|
514
|
-
name: "astro",
|
|
515
|
-
command: "npx astro dev",
|
|
516
|
-
cwd: core,
|
|
517
|
-
env: {
|
|
518
|
-
PROJECT_DIR: dir,
|
|
519
|
-
CATALOG_DIR: core
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
]);
|
|
523
|
-
await result;
|
|
524
|
-
} catch (err) {
|
|
525
|
-
console.error(err);
|
|
526
|
-
} finally {
|
|
527
|
-
await watchUnsub?.();
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
program.command("build").description("Run build of EventCatalog").action(async (options) => {
|
|
531
|
-
console.log("Building EventCatalog...");
|
|
532
|
-
copyCore();
|
|
533
|
-
await log_build_default(dir);
|
|
534
|
-
await catalogToAstro(dir, core);
|
|
535
|
-
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build`, {
|
|
536
|
-
cwd: core,
|
|
537
|
-
stdio: "inherit"
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
var previewCatalog = () => {
|
|
541
|
-
copyCore();
|
|
542
|
-
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro preview --root ${dir} --port 3000`, {
|
|
543
|
-
cwd: core,
|
|
544
|
-
stdio: "inherit"
|
|
545
|
-
});
|
|
546
|
-
};
|
|
547
|
-
program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options) => {
|
|
548
|
-
console.log("Starting preview of your build...");
|
|
549
|
-
previewCatalog();
|
|
550
|
-
});
|
|
551
|
-
program.command("start").description("Serves the contents of your eventcatalog build directory").action((options) => {
|
|
552
|
-
console.log("Starting preview of your build...");
|
|
553
|
-
previewCatalog();
|
|
554
|
-
});
|
|
555
|
-
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
556
|
-
await generate(dir);
|
|
557
|
-
});
|
|
558
|
-
program.parseAsync();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __copyProps = (to, from, except, desc) => {
|
|
7
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
-
for (let key of __getOwnPropNames(from))
|
|
9
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
-
}
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// bin/eventcatalog.config.ts
|
|
17
|
-
var eventcatalog_config_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(eventcatalog_config_exports);
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
type SideBarConfig = {
|
|
2
|
-
visible: boolean;
|
|
3
|
-
};
|
|
4
|
-
interface Config {
|
|
5
|
-
title: string;
|
|
6
|
-
tagline: false;
|
|
7
|
-
organizationName: string;
|
|
8
|
-
homepageLink: string;
|
|
9
|
-
editUrl: string;
|
|
10
|
-
landingPage?: string;
|
|
11
|
-
base?: string;
|
|
12
|
-
port?: string;
|
|
13
|
-
trailingSlash?: boolean;
|
|
14
|
-
logo?: {
|
|
15
|
-
alt: string;
|
|
16
|
-
src: string;
|
|
17
|
-
text?: string;
|
|
18
|
-
};
|
|
19
|
-
asyncAPI?: {
|
|
20
|
-
renderParsedSchemas?: boolean;
|
|
21
|
-
};
|
|
22
|
-
mdxOptimize?: boolean;
|
|
23
|
-
docs: {
|
|
24
|
-
sidebar: {
|
|
25
|
-
showPageHeadings: true;
|
|
26
|
-
services?: SideBarConfig;
|
|
27
|
-
messages?: SideBarConfig;
|
|
28
|
-
domains?: SideBarConfig;
|
|
29
|
-
teams?: SideBarConfig;
|
|
30
|
-
users?: SideBarConfig;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type { Config };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
type SideBarConfig = {
|
|
2
|
-
visible: boolean;
|
|
3
|
-
};
|
|
4
|
-
interface Config {
|
|
5
|
-
title: string;
|
|
6
|
-
tagline: false;
|
|
7
|
-
organizationName: string;
|
|
8
|
-
homepageLink: string;
|
|
9
|
-
editUrl: string;
|
|
10
|
-
landingPage?: string;
|
|
11
|
-
base?: string;
|
|
12
|
-
port?: string;
|
|
13
|
-
trailingSlash?: boolean;
|
|
14
|
-
logo?: {
|
|
15
|
-
alt: string;
|
|
16
|
-
src: string;
|
|
17
|
-
text?: string;
|
|
18
|
-
};
|
|
19
|
-
asyncAPI?: {
|
|
20
|
-
renderParsedSchemas?: boolean;
|
|
21
|
-
};
|
|
22
|
-
mdxOptimize?: boolean;
|
|
23
|
-
docs: {
|
|
24
|
-
sidebar: {
|
|
25
|
-
showPageHeadings: true;
|
|
26
|
-
services?: SideBarConfig;
|
|
27
|
-
messages?: SideBarConfig;
|
|
28
|
-
domains?: SideBarConfig;
|
|
29
|
-
teams?: SideBarConfig;
|
|
30
|
-
users?: SideBarConfig;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export type { Config };
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|