@eventcatalog/core 2.14.3 → 2.16.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/README.md +2 -1
- package/bin/eventcatalog.js +2 -0
- package/default-files-for-collections/ubiquitousLanguages.md +7 -0
- package/dist/analytics/analytics.cjs +71 -0
- package/dist/analytics/analytics.d.cts +3 -0
- package/dist/analytics/analytics.d.ts +3 -0
- package/dist/analytics/analytics.js +7 -0
- package/dist/analytics/log-build.cjs +155 -0
- package/dist/analytics/log-build.d.cts +7 -0
- package/dist/analytics/log-build.d.ts +7 -0
- package/dist/analytics/log-build.js +9 -0
- package/dist/catalog-to-astro-content-directory.cjs +286 -0
- package/dist/catalog-to-astro-content-directory.d.cts +3 -0
- package/dist/catalog-to-astro-content-directory.d.ts +3 -0
- package/dist/catalog-to-astro-content-directory.js +8 -0
- package/dist/chunk-55YPRY5U.js +87 -0
- package/dist/chunk-5RNDOKYT.js +97 -0
- package/dist/chunk-6VJTKPOS.js +30 -0
- package/dist/chunk-BT6ILNB3.js +33 -0
- package/dist/chunk-DMGFALQN.js +9 -0
- package/dist/chunk-E7TXTI7G.js +78 -0
- package/{scripts/watcher.js → dist/chunk-NTCYOR4N.js} +29 -52
- package/dist/chunk-YEQVKHST.js +56 -0
- package/dist/constants.cjs +35 -0
- package/dist/constants.d.cts +3 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +6 -0
- package/dist/eventcatalog-config-file-utils.cjs +116 -0
- package/dist/eventcatalog-config-file-utils.d.cts +7 -0
- package/dist/eventcatalog-config-file-utils.d.ts +7 -0
- package/dist/eventcatalog-config-file-utils.js +14 -0
- package/{bin/dist → dist}/eventcatalog.cjs +35 -36
- package/{bin/dist → dist}/eventcatalog.config.cjs +1 -1
- package/dist/eventcatalog.config.js +0 -0
- package/dist/eventcatalog.d.cts +2 -0
- package/dist/eventcatalog.d.ts +2 -0
- package/dist/eventcatalog.js +116 -0
- package/dist/generate.cjs +121 -0
- package/dist/generate.d.cts +3 -0
- package/dist/generate.d.ts +3 -0
- package/dist/generate.js +7 -0
- package/dist/map-catalog-to-astro.cjs +131 -0
- package/dist/map-catalog-to-astro.d.cts +28 -0
- package/dist/map-catalog-to-astro.d.ts +28 -0
- package/dist/map-catalog-to-astro.js +6 -0
- package/dist/watcher.cjs +231 -0
- package/dist/watcher.d.cts +21 -0
- package/dist/watcher.d.ts +21 -0
- package/dist/watcher.js +8 -0
- package/{src → eventcatalog/src}/components/MDX/NodeGraph/Edges/AnimatedMessageEdge.tsx +1 -1
- package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.tsx +28 -38
- package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.astro +6 -1
- package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/index.tsx +19 -1
- package/{src → eventcatalog/src}/components/SideBars/DomainSideBar.astro +23 -0
- package/eventcatalog/src/components/Tables/columns/ServiceTableColumns.tsx +196 -0
- package/{src → eventcatalog/src}/content/config.ts +18 -0
- package/eventcatalog/src/hooks/eventcatalog-visualizer.ts +89 -0
- package/eventcatalog/src/pages/docs/[type]/[id]/language.astro +301 -0
- package/{src → eventcatalog/src}/utils/collections/domains.ts +17 -2
- package/{src → eventcatalog/src}/utils/collections/icons.ts +3 -0
- package/{src → eventcatalog/src}/utils/node-graphs/message-node-graph.ts +2 -27
- package/{src → eventcatalog/src}/utils/node-graphs/utils/utils.ts +60 -3
- package/package.json +12 -3
- package/.all-contributorsrc +0 -436
- package/.changeset/config.json +0 -11
- package/.github/CODEOWNERS +0 -3
- package/.github/ISSUE_TEMPLATE/bug.yml +0 -84
- package/.github/ISSUE_TEMPLATE/config.yml +0 -5
- package/.github/ISSUE_TEMPLATE/feature.yml +0 -48
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -14
- package/.github/funding.yml +0 -1
- package/.github/workflows/lint.yml +0 -22
- package/.github/workflows/release.yml +0 -34
- package/.github/workflows/test-bin.yml +0 -29
- package/.github/workflows/test-e2e.yml +0 -27
- package/.github/workflows/verify-build.yml +0 -28
- package/.prettierignore +0 -7
- package/.prettierrc +0 -18
- package/CHANGELOG.md +0 -1296
- package/bin/dist/eventcatalog.d.cts +0 -1
- package/bin/dist/eventcatalog.d.ts +0 -1
- package/bin/dist/eventcatalog.js +0 -531
- package/bin/eventcatalog.config.ts +0 -34
- package/images/example.png +0 -0
- package/images/sponsors/gravitee-logo-black.svg +0 -54
- package/images/sponsors/hookdeck.svg +0 -11
- package/images/sponsors/oso-logo-green.png +0 -0
- package/scripts/analytics/analytics.js +0 -31
- package/scripts/analytics/log-build.js +0 -26
- package/scripts/build-ci.js +0 -27
- package/scripts/catalog-to-astro-content-directory.js +0 -115
- package/scripts/ci/test.js +0 -24
- package/scripts/constants.ts +0 -3
- package/scripts/eventcatalog-config-file-utils.js +0 -89
- package/scripts/generate.js +0 -65
- package/scripts/map-catalog-to-astro.js +0 -174
- package/scripts/start-catalog-locally.js +0 -26
- package/src/components/Tables/columns/ServiceTableColumns.tsx +0 -164
- /package/{bin/dist → dist}/eventcatalog.config.d.cts +0 -0
- /package/{bin/dist → dist}/eventcatalog.config.d.ts +0 -0
- /package/{astro.config.mjs → eventcatalog/astro.config.mjs} +0 -0
- /package/{global.d.ts → eventcatalog/global.d.ts} +0 -0
- /package/{public → eventcatalog/public}/favicon.ico +0 -0
- /package/{public → eventcatalog/public}/icons/asyncapi.svg +0 -0
- /package/{public → eventcatalog/public}/icons/discord.svg +0 -0
- /package/{public → eventcatalog/public}/icons/github-purple.svg +0 -0
- /package/{public → eventcatalog/public}/icons/github.svg +0 -0
- /package/{public → eventcatalog/public}/icons/ms-teams.svg +0 -0
- /package/{public → eventcatalog/public}/icons/openapi.svg +0 -0
- /package/{public → eventcatalog/public}/icons/protocols/kafka.svg +0 -0
- /package/{public → eventcatalog/public}/icons/x-twitter.svg +0 -0
- /package/{public → eventcatalog/public}/icons/youtube.svg +0 -0
- /package/{public → eventcatalog/public}/logo.png +0 -0
- /package/{public → eventcatalog/public}/openapi.yml +0 -0
- /package/{public → eventcatalog/public}/opengraph.png +0 -0
- /package/{public → eventcatalog/public}/slack-icon.svg +0 -0
- /package/{src → eventcatalog/src}/components/DiscoverInsight.astro +0 -0
- /package/{src → eventcatalog/src}/components/DocsNavigation.astro +0 -0
- /package/{src → eventcatalog/src}/components/Header.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/OwnersList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillListFlat.styles.css +0 -0
- /package/{src → eventcatalog/src}/components/Lists/PillListFlat.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/ProtocolList.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Lists/RepositoryList.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/SpecificationsList.astro +0 -0
- /package/{src → eventcatalog/src}/components/Lists/VersionList.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/Accordion.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/Accordion.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Accordion/AccordionGroup.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Admonition.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/AsyncAPI/AsyncAPI.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/ChannelInformation/ChannelInformation.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/File.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Flow/Flow.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/DownloadButton.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraph.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/NodeGraphPortal.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Channel.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Command.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Event.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/ExternalSystem.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Query.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Service.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/Step.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/NodeGraph/Nodes/User.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/OpenAPI/OpenAPI.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Schema.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewer.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/SchemaViewer/SchemaViewerPortal.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Steps/Step.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Steps/Steps.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Tiles/Tile.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/Tiles/Tiles.astro +0 -0
- /package/{src → eventcatalog/src}/components/MDX/components.tsx +0 -0
- /package/{src → eventcatalog/src}/components/MDX/page-components.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Search.astro +0 -0
- /package/{src → eventcatalog/src}/components/Seo.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/CatalogResourcesSideBar/styles.css +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ChannelSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/MessageSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/SideBars/ServiceSideBar.astro +0 -0
- /package/{src → eventcatalog/src}/components/Tables/DebouncedInput.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/Table.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/DomainTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/FlowTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/MessageTableColumns.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/columns/index.tsx +0 -0
- /package/{src → eventcatalog/src}/components/Tables/filters/custom-filters.ts +0 -0
- /package/{src → eventcatalog/src}/env.d.ts +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/WebSocket.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/amqp.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/eventbridge.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/googlepubsub.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/http.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/index.ts +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/jms.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/kafka.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/mercure.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/mqtt.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/nats.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/pulsar.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/redis.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/sns.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/solace.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/sqs.svg +0 -0
- /package/{src → eventcatalog/src}/icons/protocols/ws.svg +0 -0
- /package/{src → eventcatalog/src}/layouts/CustomDocsPageLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/DiscoverLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/Footer.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/PlainPage.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/VerticalSideBarLayout.astro +0 -0
- /package/{src → eventcatalog/src}/layouts/VisualiserLayout.astro +0 -0
- /package/{src → eventcatalog/src}/pages/discover/[type]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/changelog/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/spec/_styles.css +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/[version]/spec/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/[type]/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/teams/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/docs/users/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/visualiser/[type]/[id]/[version]/index.astro +0 -0
- /package/{src → eventcatalog/src}/pages/visualiser/[type]/[id]/index.astro +0 -0
- /package/{src → eventcatalog/src}/remark-plugins/mermaid.ts +0 -0
- /package/{src → eventcatalog/src}/types/index.ts +0 -0
- /package/{src → eventcatalog/src}/utils/channels.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/changelogs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/file-diffs.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/flows.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/services.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/util.ts +0 -0
- /package/{src → eventcatalog/src}/utils/collections/versions.ts +0 -0
- /package/{src → eventcatalog/src}/utils/colors.ts +0 -0
- /package/{src → eventcatalog/src}/utils/commands.ts +0 -0
- /package/{src → eventcatalog/src}/utils/eventcatalog-config/catalog.ts +0 -0
- /package/{src → eventcatalog/src}/utils/events.ts +0 -0
- /package/{src → eventcatalog/src}/utils/example-remark-plugin.mjs +0 -0
- /package/{src → eventcatalog/src}/utils/messages.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/domains-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/flows-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/node-graphs/services-node-graph.ts +0 -0
- /package/{src → eventcatalog/src}/utils/page-loaders/page-data-loader.ts +0 -0
- /package/{src → eventcatalog/src}/utils/pages.ts +0 -0
- /package/{src → eventcatalog/src}/utils/queries.ts +0 -0
- /package/{src → eventcatalog/src}/utils/teams.ts +0 -0
- /package/{src → eventcatalog/src}/utils/url-builder.ts +0 -0
- /package/{src → eventcatalog/src}/utils/users.ts +0 -0
- /package/{tailwind.config.mjs → eventcatalog/tailwind.config.mjs} +0 -0
- /package/{tsconfig.json → eventcatalog/tsconfig.json} +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
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/eventcatalog-config-file-utils.js
|
|
31
|
+
var eventcatalog_config_file_utils_exports = {};
|
|
32
|
+
__export(eventcatalog_config_file_utils_exports, {
|
|
33
|
+
addPropertyToFrontMatter: () => addPropertyToFrontMatter,
|
|
34
|
+
cleanup: () => cleanup,
|
|
35
|
+
getEventCatalogConfigFile: () => getEventCatalogConfigFile,
|
|
36
|
+
verifyRequiredFieldsAreInCatalogConfigFile: () => verifyRequiredFieldsAreInCatalogConfigFile,
|
|
37
|
+
writeEventCatalogConfigFile: () => writeEventCatalogConfigFile
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(eventcatalog_config_file_utils_exports);
|
|
40
|
+
var import_promises = require("fs/promises");
|
|
41
|
+
var import_node_fs = require("fs");
|
|
42
|
+
var import_promises2 = require("fs/promises");
|
|
43
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
44
|
+
var import_uuid = require("uuid");
|
|
45
|
+
var import_url = require("url");
|
|
46
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
47
|
+
async function cleanup(projectDirectory) {
|
|
48
|
+
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
49
|
+
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
50
|
+
await (0, import_promises.rm)(filePath);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
54
|
+
try {
|
|
55
|
+
let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
56
|
+
const filePath = import_node_path.default.join(projectDirectory, "package.json");
|
|
57
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
|
|
58
|
+
if (packageJson?.type !== "module") {
|
|
59
|
+
await (0, import_promises2.copyFile)(configFilePath, import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs"));
|
|
60
|
+
configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
61
|
+
}
|
|
62
|
+
const configFileURL = (0, import_url.pathToFileURL)(configFilePath).href;
|
|
63
|
+
const config = await import(
|
|
64
|
+
/* @vite-ignore */
|
|
65
|
+
configFileURL
|
|
66
|
+
);
|
|
67
|
+
return config.default;
|
|
68
|
+
} finally {
|
|
69
|
+
await cleanup(projectDirectory);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
var writeEventCatalogConfigFile = async (projectDirectory, newConfig) => {
|
|
73
|
+
try {
|
|
74
|
+
const configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
75
|
+
let content = await (0, import_promises.readFile)(configFilePath, "utf8");
|
|
76
|
+
const startIndex = content.indexOf("export default {");
|
|
77
|
+
if (startIndex === -1) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
Object.entries(newConfig).forEach(([key, value]) => {
|
|
81
|
+
const valueString = JSON.stringify(value, null, 2).replace(/"/g, "'").replace(/\n/g, "\n ");
|
|
82
|
+
const keyRegex = new RegExp(`(${key}\\s*:)([^,}]+)`, "g");
|
|
83
|
+
if (content.match(keyRegex)) {
|
|
84
|
+
content = content.replace(keyRegex, `$1 ${valueString}`);
|
|
85
|
+
} else {
|
|
86
|
+
const insertPosition = content.indexOf("{", startIndex) + 1;
|
|
87
|
+
content = content.slice(0, insertPosition) + `
|
|
88
|
+
${key}: ${valueString},` + content.slice(insertPosition);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
await (0, import_promises.writeFile)(configFilePath, content);
|
|
92
|
+
} finally {
|
|
93
|
+
await cleanup(projectDirectory);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
97
|
+
try {
|
|
98
|
+
const config = await getEventCatalogConfigFile(projectDirectory);
|
|
99
|
+
if (!config.cId) {
|
|
100
|
+
await writeEventCatalogConfigFile(projectDirectory, { cId: (0, import_uuid.v4)() });
|
|
101
|
+
}
|
|
102
|
+
} catch (error) {
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
function addPropertyToFrontMatter(input, newProperty, newValue) {
|
|
106
|
+
const file = (0, import_gray_matter.default)(input);
|
|
107
|
+
return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
|
|
108
|
+
}
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
addPropertyToFrontMatter,
|
|
112
|
+
cleanup,
|
|
113
|
+
getEventCatalogConfigFile,
|
|
114
|
+
verifyRequiredFieldsAreInCatalogConfigFile,
|
|
115
|
+
writeEventCatalogConfigFile
|
|
116
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function cleanup(projectDirectory: any): Promise<void>;
|
|
2
|
+
declare function addPropertyToFrontMatter(input: any, newProperty: any, newValue: any): string;
|
|
3
|
+
declare function getEventCatalogConfigFile(projectDirectory: any): Promise<any>;
|
|
4
|
+
declare function writeEventCatalogConfigFile(projectDirectory: any, newConfig: any): Promise<void>;
|
|
5
|
+
declare function verifyRequiredFieldsAreInCatalogConfigFile(projectDirectory: any): Promise<void>;
|
|
6
|
+
|
|
7
|
+
export { addPropertyToFrontMatter, cleanup, getEventCatalogConfigFile, verifyRequiredFieldsAreInCatalogConfigFile, writeEventCatalogConfigFile };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare function cleanup(projectDirectory: any): Promise<void>;
|
|
2
|
+
declare function addPropertyToFrontMatter(input: any, newProperty: any, newValue: any): string;
|
|
3
|
+
declare function getEventCatalogConfigFile(projectDirectory: any): Promise<any>;
|
|
4
|
+
declare function writeEventCatalogConfigFile(projectDirectory: any, newConfig: any): Promise<void>;
|
|
5
|
+
declare function verifyRequiredFieldsAreInCatalogConfigFile(projectDirectory: any): Promise<void>;
|
|
6
|
+
|
|
7
|
+
export { addPropertyToFrontMatter, cleanup, getEventCatalogConfigFile, verifyRequiredFieldsAreInCatalogConfigFile, writeEventCatalogConfigFile };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addPropertyToFrontMatter,
|
|
3
|
+
cleanup,
|
|
4
|
+
getEventCatalogConfigFile,
|
|
5
|
+
verifyRequiredFieldsAreInCatalogConfigFile,
|
|
6
|
+
writeEventCatalogConfigFile
|
|
7
|
+
} from "./chunk-E7TXTI7G.js";
|
|
8
|
+
export {
|
|
9
|
+
addPropertyToFrontMatter,
|
|
10
|
+
cleanup,
|
|
11
|
+
getEventCatalogConfigFile,
|
|
12
|
+
verifyRequiredFieldsAreInCatalogConfigFile,
|
|
13
|
+
writeEventCatalogConfigFile
|
|
14
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
1
|
"use strict";
|
|
3
2
|
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
@@ -27,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
26
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL("file:" + __filename).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
28
27
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
29
28
|
|
|
30
|
-
//
|
|
29
|
+
// src/eventcatalog.ts
|
|
31
30
|
var import_commander = require("commander");
|
|
32
31
|
var import_node_child_process = require("child_process");
|
|
33
32
|
var import_node_path4 = require("path");
|
|
@@ -36,10 +35,10 @@ var import_node_path5 = __toESM(require("path"), 1);
|
|
|
36
35
|
var import_node_url = require("url");
|
|
37
36
|
var import_concurrently = __toESM(require("concurrently"), 1);
|
|
38
37
|
|
|
39
|
-
//
|
|
38
|
+
// src/generate.js
|
|
40
39
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
41
40
|
|
|
42
|
-
//
|
|
41
|
+
// src/eventcatalog-config-file-utils.js
|
|
43
42
|
var import_promises = require("fs/promises");
|
|
44
43
|
var import_node_fs = require("fs");
|
|
45
44
|
var import_promises2 = require("fs/promises");
|
|
@@ -110,7 +109,7 @@ function addPropertyToFrontMatter(input, newProperty, newValue) {
|
|
|
110
109
|
return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
|
|
111
110
|
}
|
|
112
111
|
|
|
113
|
-
//
|
|
112
|
+
// src/generate.js
|
|
114
113
|
function getDefaultExport(importedModule) {
|
|
115
114
|
if (importedModule === null || typeof importedModule !== "object") {
|
|
116
115
|
throw new Error("Invalid module");
|
|
@@ -157,17 +156,17 @@ var generate = async (PROJECT_DIRECTORY) => {
|
|
|
157
156
|
}
|
|
158
157
|
};
|
|
159
158
|
|
|
160
|
-
//
|
|
159
|
+
// src/analytics/analytics.js
|
|
161
160
|
var import_axios = __toESM(require("axios"), 1);
|
|
162
161
|
var import_os = __toESM(require("os"), 1);
|
|
163
162
|
|
|
164
163
|
// package.json
|
|
165
|
-
var version = "2.
|
|
164
|
+
var version = "2.16.0";
|
|
166
165
|
|
|
167
|
-
//
|
|
166
|
+
// src/constants.ts
|
|
168
167
|
var VERSION = version;
|
|
169
168
|
|
|
170
|
-
//
|
|
169
|
+
// src/analytics/analytics.js
|
|
171
170
|
async function raiseEvent(eventData) {
|
|
172
171
|
const url = "https://queue.simpleanalyticscdn.com/events";
|
|
173
172
|
const userAgent = `@eventcatalog/eventcatalog@${VERSION} (${import_os.default.platform()}; ${import_os.default.arch()}; Node/${process.version})`;
|
|
@@ -191,7 +190,7 @@ async function raiseEvent(eventData) {
|
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
|
|
194
|
-
//
|
|
193
|
+
// src/analytics/log-build.js
|
|
195
194
|
var main = async (projectDir) => {
|
|
196
195
|
if (process.env.NODE_ENV === "CI") return;
|
|
197
196
|
try {
|
|
@@ -210,11 +209,11 @@ var main = async (projectDir) => {
|
|
|
210
209
|
};
|
|
211
210
|
var log_build_default = main;
|
|
212
211
|
|
|
213
|
-
//
|
|
212
|
+
// src/watcher.js
|
|
214
213
|
var import_watcher = __toESM(require("@parcel/watcher"), 1);
|
|
215
214
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
216
215
|
|
|
217
|
-
//
|
|
216
|
+
// src/map-catalog-to-astro.js
|
|
218
217
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
219
218
|
var COLLECTION_KEYS = [
|
|
220
219
|
"events",
|
|
@@ -227,7 +226,8 @@ var COLLECTION_KEYS = [
|
|
|
227
226
|
"pages",
|
|
228
227
|
"changelogs",
|
|
229
228
|
"queries",
|
|
230
|
-
"channels"
|
|
229
|
+
"channels",
|
|
230
|
+
"ubiquitousLanguages"
|
|
231
231
|
];
|
|
232
232
|
function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
233
233
|
const relativeFilePath = removeBasePath(filePath, projectDir);
|
|
@@ -237,7 +237,11 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
|
|
|
237
237
|
const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
|
|
238
238
|
const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
|
|
239
239
|
return baseTargetPaths.map(
|
|
240
|
-
(base) => import_node_path3.default.join(
|
|
240
|
+
(base) => import_node_path3.default.join(
|
|
241
|
+
astroDir,
|
|
242
|
+
base,
|
|
243
|
+
relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx").replace("ubiquitous-language.md", "ubiquitous-language.mdx")
|
|
244
|
+
)
|
|
241
245
|
);
|
|
242
246
|
}
|
|
243
247
|
function removeBasePath(fullPath, basePath) {
|
|
@@ -270,6 +274,9 @@ function getBaseTargetPaths(filePath) {
|
|
|
270
274
|
if (filePathArr[filePathArr.length - 1] == "changelog.md") {
|
|
271
275
|
return [import_node_path3.default.join("src", "content", "changelogs")];
|
|
272
276
|
}
|
|
277
|
+
if (filePathArr[filePathArr.length - 1] == "ubiquitous-language.md") {
|
|
278
|
+
return [import_node_path3.default.join("src", "content", "ubiquitousLanguages")];
|
|
279
|
+
}
|
|
273
280
|
if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
|
|
274
281
|
return [import_node_path3.default.join("src", "content")];
|
|
275
282
|
}
|
|
@@ -300,7 +307,7 @@ function getRelativeTargetPath(filePath) {
|
|
|
300
307
|
return import_node_path3.default.join(...relativePath);
|
|
301
308
|
}
|
|
302
309
|
|
|
303
|
-
//
|
|
310
|
+
// src/watcher.js
|
|
304
311
|
var import_rimraf = require("rimraf");
|
|
305
312
|
async function watch(projectDirectory, catalogDirectory, callback = void 0) {
|
|
306
313
|
const subscription = await import_watcher.default.subscribe(
|
|
@@ -382,25 +389,14 @@ function retryEPERM(fn) {
|
|
|
382
389
|
};
|
|
383
390
|
}
|
|
384
391
|
|
|
385
|
-
//
|
|
392
|
+
// src/catalog-to-astro-content-directory.js
|
|
386
393
|
var import_glob = require("glob");
|
|
387
394
|
var path4 = __toESM(require("path"), 1);
|
|
388
395
|
var import_fs = __toESM(require("fs"), 1);
|
|
389
396
|
var import_url2 = require("url");
|
|
390
397
|
var import_node_os = __toESM(require("os"), 1);
|
|
391
398
|
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
|
-
);
|
|
399
|
+
var rootPkg = path4.resolve(path4.dirname(__filename2), "../");
|
|
404
400
|
var copyFiles = async (source, target) => {
|
|
405
401
|
const files = await (0, import_glob.glob)(path4.join(source, "**"), {
|
|
406
402
|
nodir: true,
|
|
@@ -437,7 +433,8 @@ var ensureAstroCollectionNotEmpty = async (astroDir) => {
|
|
|
437
433
|
"pages",
|
|
438
434
|
"changelogs",
|
|
439
435
|
"queries",
|
|
440
|
-
"channels"
|
|
436
|
+
"channels",
|
|
437
|
+
"ubiquitousLanguages"
|
|
441
438
|
];
|
|
442
439
|
const emptyCollections = [];
|
|
443
440
|
for (const collection of COLLECTIONS) {
|
|
@@ -468,12 +465,12 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
468
465
|
await ensureAstroCollectionNotEmpty(astroDir);
|
|
469
466
|
};
|
|
470
467
|
|
|
471
|
-
//
|
|
468
|
+
// src/eventcatalog.ts
|
|
472
469
|
var currentDir = import_node_path5.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
473
470
|
var program = new import_commander.Command().version(VERSION);
|
|
474
471
|
var dir = import_node_path5.default.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
475
472
|
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, "
|
|
473
|
+
var eventCatalogDir = import_node_path5.default.resolve((0, import_node_path4.join)(currentDir, "../eventcatalog/"));
|
|
477
474
|
program.name("eventcatalog").description("Documentation tool for event-driven architectures");
|
|
478
475
|
var ensureDir = (dir2) => {
|
|
479
476
|
if (!import_fs2.default.existsSync(dir2)) {
|
|
@@ -512,7 +509,7 @@ program.command("dev").description("Run development server of EventCatalog").opt
|
|
|
512
509
|
const { result } = (0, import_concurrently.default)([
|
|
513
510
|
{
|
|
514
511
|
name: "astro",
|
|
515
|
-
command: "
|
|
512
|
+
command: "npx astro dev",
|
|
516
513
|
cwd: core,
|
|
517
514
|
env: {
|
|
518
515
|
PROJECT_DIR: dir,
|
|
@@ -532,14 +529,13 @@ program.command("build").description("Run build of EventCatalog").action(async (
|
|
|
532
529
|
copyCore();
|
|
533
530
|
await log_build_default(dir);
|
|
534
531
|
await catalogToAstro(dir, core);
|
|
535
|
-
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}'
|
|
532
|
+
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build`, {
|
|
536
533
|
cwd: core,
|
|
537
534
|
stdio: "inherit"
|
|
538
535
|
});
|
|
539
536
|
});
|
|
540
537
|
var previewCatalog = () => {
|
|
541
|
-
|
|
542
|
-
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npm run preview -- --root ${dir} --port 3000`, {
|
|
538
|
+
(0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro preview --root ${dir} --port 3000`, {
|
|
543
539
|
cwd: core,
|
|
544
540
|
stdio: "inherit"
|
|
545
541
|
});
|
|
@@ -555,4 +551,7 @@ program.command("start").description("Serves the contents of your eventcatalog b
|
|
|
555
551
|
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
556
552
|
await generate(dir);
|
|
557
553
|
});
|
|
558
|
-
program.parseAsync()
|
|
554
|
+
program.parseAsync().then(() => process.exit(0)).catch((err) => {
|
|
555
|
+
console.error(err);
|
|
556
|
+
process.exit(1);
|
|
557
|
+
});
|
|
@@ -13,6 +13,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
13
13
|
};
|
|
14
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
15
|
|
|
16
|
-
//
|
|
16
|
+
// src/eventcatalog.config.ts
|
|
17
17
|
var eventcatalog_config_exports = {};
|
|
18
18
|
module.exports = __toCommonJS(eventcatalog_config_exports);
|
|
File without changes
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
log_build_default
|
|
3
|
+
} from "./chunk-6VJTKPOS.js";
|
|
4
|
+
import "./chunk-BT6ILNB3.js";
|
|
5
|
+
import {
|
|
6
|
+
catalogToAstro
|
|
7
|
+
} from "./chunk-55YPRY5U.js";
|
|
8
|
+
import {
|
|
9
|
+
VERSION
|
|
10
|
+
} from "./chunk-DMGFALQN.js";
|
|
11
|
+
import {
|
|
12
|
+
generate
|
|
13
|
+
} from "./chunk-YEQVKHST.js";
|
|
14
|
+
import {
|
|
15
|
+
watch
|
|
16
|
+
} from "./chunk-NTCYOR4N.js";
|
|
17
|
+
import "./chunk-E7TXTI7G.js";
|
|
18
|
+
import "./chunk-5RNDOKYT.js";
|
|
19
|
+
|
|
20
|
+
// src/eventcatalog.ts
|
|
21
|
+
import { Command } from "commander";
|
|
22
|
+
import { execSync } from "node:child_process";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import fs from "fs";
|
|
25
|
+
import path from "node:path";
|
|
26
|
+
import { fileURLToPath } from "node:url";
|
|
27
|
+
import concurrently from "concurrently";
|
|
28
|
+
var currentDir = path.dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
var program = new Command().version(VERSION);
|
|
30
|
+
var dir = path.resolve(process.env.PROJECT_DIR || process.cwd());
|
|
31
|
+
var core = path.resolve(process.env.CATALOG_DIR || join(dir, ".eventcatalog-core"));
|
|
32
|
+
var eventCatalogDir = path.resolve(join(currentDir, "../eventcatalog/"));
|
|
33
|
+
program.name("eventcatalog").description("Documentation tool for event-driven architectures");
|
|
34
|
+
var ensureDir = (dir2) => {
|
|
35
|
+
if (!fs.existsSync(dir2)) {
|
|
36
|
+
fs.mkdirSync(dir2);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var copyCore = () => {
|
|
40
|
+
ensureDir(core);
|
|
41
|
+
if (eventCatalogDir === core) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
fs.cpSync(eventCatalogDir, core, {
|
|
45
|
+
recursive: true,
|
|
46
|
+
filter: (src) => {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
var clearCore = () => {
|
|
52
|
+
if (fs.existsSync(core)) fs.rmSync(core, { recursive: true });
|
|
53
|
+
};
|
|
54
|
+
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) => {
|
|
55
|
+
console.log("Setting up EventCatalog....");
|
|
56
|
+
if (options.debug) {
|
|
57
|
+
console.log("Debug mode enabled");
|
|
58
|
+
console.log("PROJECT_DIR", dir);
|
|
59
|
+
console.log("CATALOG_DIR", core);
|
|
60
|
+
}
|
|
61
|
+
if (options.forceRecreate) clearCore();
|
|
62
|
+
copyCore();
|
|
63
|
+
console.log("EventCatalog is starting at http://localhost:3000/docs");
|
|
64
|
+
await catalogToAstro(dir, core);
|
|
65
|
+
let watchUnsub;
|
|
66
|
+
try {
|
|
67
|
+
watchUnsub = await watch(dir, core);
|
|
68
|
+
const { result } = concurrently([
|
|
69
|
+
{
|
|
70
|
+
name: "astro",
|
|
71
|
+
command: "npx astro dev",
|
|
72
|
+
cwd: core,
|
|
73
|
+
env: {
|
|
74
|
+
PROJECT_DIR: dir,
|
|
75
|
+
CATALOG_DIR: core
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]);
|
|
79
|
+
await result;
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error(err);
|
|
82
|
+
} finally {
|
|
83
|
+
await watchUnsub?.();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
program.command("build").description("Run build of EventCatalog").action(async (options) => {
|
|
87
|
+
console.log("Building EventCatalog...");
|
|
88
|
+
copyCore();
|
|
89
|
+
await log_build_default(dir);
|
|
90
|
+
await catalogToAstro(dir, core);
|
|
91
|
+
execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro build`, {
|
|
92
|
+
cwd: core,
|
|
93
|
+
stdio: "inherit"
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
var previewCatalog = () => {
|
|
97
|
+
execSync(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' npx astro preview --root ${dir} --port 3000`, {
|
|
98
|
+
cwd: core,
|
|
99
|
+
stdio: "inherit"
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
program.command("preview").description("Serves the contents of your eventcatalog build directory").action((options) => {
|
|
103
|
+
console.log("Starting preview of your build...");
|
|
104
|
+
previewCatalog();
|
|
105
|
+
});
|
|
106
|
+
program.command("start").description("Serves the contents of your eventcatalog build directory").action((options) => {
|
|
107
|
+
console.log("Starting preview of your build...");
|
|
108
|
+
previewCatalog();
|
|
109
|
+
});
|
|
110
|
+
program.command("generate [siteDir]").description("Start the generator scripts.").action(async () => {
|
|
111
|
+
await generate(dir);
|
|
112
|
+
});
|
|
113
|
+
program.parseAsync().then(() => process.exit(0)).catch((err) => {
|
|
114
|
+
console.error(err);
|
|
115
|
+
process.exit(1);
|
|
116
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
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/generate.js
|
|
31
|
+
var generate_exports = {};
|
|
32
|
+
__export(generate_exports, {
|
|
33
|
+
generate: () => generate
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(generate_exports);
|
|
36
|
+
var import_node_path2 = __toESM(require("path"), 1);
|
|
37
|
+
|
|
38
|
+
// src/eventcatalog-config-file-utils.js
|
|
39
|
+
var import_promises = require("fs/promises");
|
|
40
|
+
var import_node_fs = require("fs");
|
|
41
|
+
var import_promises2 = require("fs/promises");
|
|
42
|
+
var import_node_path = __toESM(require("path"), 1);
|
|
43
|
+
var import_uuid = require("uuid");
|
|
44
|
+
var import_url = require("url");
|
|
45
|
+
var import_gray_matter = __toESM(require("gray-matter"), 1);
|
|
46
|
+
async function cleanup(projectDirectory) {
|
|
47
|
+
const filePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
48
|
+
if ((0, import_node_fs.existsSync)(filePath)) {
|
|
49
|
+
await (0, import_promises.rm)(filePath);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
53
|
+
try {
|
|
54
|
+
let configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.js");
|
|
55
|
+
const filePath = import_node_path.default.join(projectDirectory, "package.json");
|
|
56
|
+
const packageJson = JSON.parse(await (0, import_promises.readFile)(filePath, "utf-8"));
|
|
57
|
+
if (packageJson?.type !== "module") {
|
|
58
|
+
await (0, import_promises2.copyFile)(configFilePath, import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs"));
|
|
59
|
+
configFilePath = import_node_path.default.join(projectDirectory, "eventcatalog.config.mjs");
|
|
60
|
+
}
|
|
61
|
+
const configFileURL = (0, import_url.pathToFileURL)(configFilePath).href;
|
|
62
|
+
const config = await import(
|
|
63
|
+
/* @vite-ignore */
|
|
64
|
+
configFileURL
|
|
65
|
+
);
|
|
66
|
+
return config.default;
|
|
67
|
+
} finally {
|
|
68
|
+
await cleanup(projectDirectory);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/generate.js
|
|
73
|
+
function getDefaultExport(importedModule) {
|
|
74
|
+
if (importedModule === null || typeof importedModule !== "object") {
|
|
75
|
+
throw new Error("Invalid module");
|
|
76
|
+
}
|
|
77
|
+
if (typeof importedModule.default === "object" && importedModule.default !== null) {
|
|
78
|
+
return importedModule.default.default || importedModule.default;
|
|
79
|
+
}
|
|
80
|
+
if (typeof importedModule.default !== "undefined") {
|
|
81
|
+
return importedModule.default;
|
|
82
|
+
}
|
|
83
|
+
return importedModule;
|
|
84
|
+
}
|
|
85
|
+
var generate = async (PROJECT_DIRECTORY) => {
|
|
86
|
+
try {
|
|
87
|
+
const config = await getEventCatalogConfigFile(PROJECT_DIRECTORY);
|
|
88
|
+
const { generators = [] } = config;
|
|
89
|
+
if (!generators.length) {
|
|
90
|
+
console.log("No configured generators found, skipping generation");
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
for (const generator of generators) {
|
|
94
|
+
let plugin = generator[0];
|
|
95
|
+
const pluginConfig = generator[1];
|
|
96
|
+
if (plugin.startsWith("./")) {
|
|
97
|
+
plugin = import_node_path2.default.join(PROJECT_DIRECTORY, plugin);
|
|
98
|
+
}
|
|
99
|
+
if (plugin.includes("<rootDir>")) {
|
|
100
|
+
plugin = plugin.replace("<rootDir>", PROJECT_DIRECTORY);
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const importedGenerator = await import(plugin);
|
|
104
|
+
const generator2 = getDefaultExport(importedGenerator);
|
|
105
|
+
await generator2({ eventCatalogConfig: {} }, pluginConfig);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.error("Error loading plugin:", error);
|
|
108
|
+
await cleanup(PROJECT_DIRECTORY);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
await cleanup(PROJECT_DIRECTORY);
|
|
113
|
+
} catch (error) {
|
|
114
|
+
console.error(error);
|
|
115
|
+
await cleanup(PROJECT_DIRECTORY);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
119
|
+
0 && (module.exports = {
|
|
120
|
+
generate
|
|
121
|
+
});
|