@eventcatalog/core 2.29.4 → 2.30.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.
Files changed (51) hide show
  1. package/dist/analytics/analytics.cjs +1 -1
  2. package/dist/analytics/analytics.js +2 -2
  3. package/dist/analytics/log-build.cjs +1 -1
  4. package/dist/analytics/log-build.js +3 -3
  5. package/dist/catalog-to-astro-content-directory.cjs +24 -64
  6. package/dist/catalog-to-astro-content-directory.d.cts +2 -1
  7. package/dist/catalog-to-astro-content-directory.d.ts +2 -1
  8. package/dist/catalog-to-astro-content-directory.js +6 -4
  9. package/dist/{chunk-7PSA2C5C.js → chunk-4Q54XOED.js} +1 -1
  10. package/dist/chunk-DE2TXYKB.js +59 -0
  11. package/dist/{chunk-FIY5JLSQ.js → chunk-HAYFEAB4.js} +3 -18
  12. package/dist/{chunk-6DVICCCE.js → chunk-MZLYNODU.js} +1 -1
  13. package/dist/{chunk-DH6NCUJX.js → chunk-T2XS2ZVB.js} +1 -1
  14. package/dist/{chunk-WUCY3QHK.js → chunk-UKJ7F5WR.js} +4 -12
  15. package/dist/constants.cjs +1 -1
  16. package/dist/constants.js +1 -1
  17. package/dist/eventcatalog.cjs +59 -88
  18. package/dist/eventcatalog.js +43 -24
  19. package/dist/map-catalog-to-astro.cjs +3 -18
  20. package/dist/map-catalog-to-astro.js +1 -1
  21. package/dist/watcher.cjs +6 -30
  22. package/dist/watcher.js +2 -2
  23. package/eventcatalog/astro.config.mjs +5 -0
  24. package/eventcatalog/src/components/MDX/Schema.astro +4 -3
  25. package/eventcatalog/src/components/MDX/SchemaViewer/SchemaViewer.astro +3 -3
  26. package/eventcatalog/src/components/SideBars/MessageSideBar.astro +1 -0
  27. package/eventcatalog/src/components/SideNav/TreeView/getTreeView.ts +2 -2
  28. package/eventcatalog/src/content.config.ts +94 -34
  29. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/asyncapi/index.astro +11 -6
  30. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/changelog/index.astro +7 -1
  31. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/index.astro +4 -2
  32. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/_OpenAPI.tsx +1 -1
  33. package/eventcatalog/src/pages/docs/[type]/[id]/[version]/spec/index.astro +12 -5
  34. package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +2 -2
  35. package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +55 -0
  36. package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +2 -2
  37. package/eventcatalog/src/pages/docs/llm/llms.txt.ts +2 -2
  38. package/eventcatalog/src/pages/docs/teams/[id].md.ts +2 -2
  39. package/eventcatalog/src/pages/docs/users/[id].md.ts +2 -2
  40. package/eventcatalog/src/pages/rss/[resource]/rss.xml.js +2 -2
  41. package/eventcatalog/src/utils/channels.ts +2 -2
  42. package/eventcatalog/src/utils/collections/changelogs.ts +6 -2
  43. package/eventcatalog/src/utils/collections/domains.ts +5 -3
  44. package/eventcatalog/src/utils/collections/file-diffs.ts +1 -1
  45. package/eventcatalog/src/utils/collections/flows.ts +2 -2
  46. package/eventcatalog/src/utils/collections/services.ts +8 -6
  47. package/eventcatalog/src/utils/commands.ts +2 -2
  48. package/eventcatalog/src/utils/events.ts +2 -2
  49. package/eventcatalog/src/utils/queries.ts +2 -2
  50. package/package.json +6 -5
  51. package/dist/chunk-R2NILSWL.js +0 -82
@@ -37,7 +37,7 @@ var import_axios = __toESM(require("axios"), 1);
37
37
  var import_os = __toESM(require("os"), 1);
38
38
 
39
39
  // package.json
40
- var version = "2.29.4";
40
+ var version = "2.30.0";
41
41
 
42
42
  // src/constants.ts
43
43
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-DH6NCUJX.js";
4
- import "../chunk-7PSA2C5C.js";
3
+ } from "../chunk-T2XS2ZVB.js";
4
+ import "../chunk-4Q54XOED.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -106,7 +106,7 @@ var import_axios = __toESM(require("axios"), 1);
106
106
  var import_os = __toESM(require("os"), 1);
107
107
 
108
108
  // package.json
109
- var version = "2.29.4";
109
+ var version = "2.30.0";
110
110
 
111
111
  // src/constants.ts
112
112
  var VERSION = version;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-6DVICCCE.js";
4
- import "../chunk-DH6NCUJX.js";
5
- import "../chunk-7PSA2C5C.js";
3
+ } from "../chunk-MZLYNODU.js";
4
+ import "../chunk-T2XS2ZVB.js";
5
+ import "../chunk-4Q54XOED.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/catalog-to-astro-content-directory.js
31
31
  var catalog_to_astro_content_directory_exports = {};
32
32
  __export(catalog_to_astro_content_directory_exports, {
33
- catalogToAstro: () => catalogToAstro
33
+ catalogToAstro: () => catalogToAstro,
34
+ checkAndConvertMdToMdx: () => checkAndConvertMdToMdx
34
35
  });
35
36
  module.exports = __toCommonJS(catalog_to_astro_content_directory_exports);
36
37
 
@@ -111,10 +112,6 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
111
112
  } catch (error) {
112
113
  }
113
114
  };
114
- function addPropertyToFrontMatter(input, newProperty, newValue) {
115
- const file = (0, import_gray_matter.default)(input);
116
- return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
117
- }
118
115
 
119
116
  // src/map-catalog-to-astro.js
120
117
  var import_node_path2 = __toESM(require("path"), 1);
@@ -138,13 +135,7 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
138
135
  }
139
136
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
140
137
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
141
- return baseTargetPaths.map(
142
- (base) => import_node_path2.default.join(
143
- astroDir,
144
- base,
145
- relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx").replace("ubiquitous-language.md", "ubiquitous-language.mdx")
146
- )
147
- );
138
+ return baseTargetPaths.map((base) => import_node_path2.default.join(astroDir, base, relativeTargetPath));
148
139
  }
149
140
  function removeBasePath(fullPath, basePath) {
150
141
  const relativePath = import_node_path2.default.relative(basePath, fullPath);
@@ -173,20 +164,11 @@ function isCatalogRelated(filePath) {
173
164
  function getBaseTargetPaths(filePath) {
174
165
  const filePathArr = filePath.split(import_node_path2.default.sep).filter(Boolean);
175
166
  if (isCollectionKey(filePathArr[0])) {
176
- if (filePathArr[filePathArr.length - 1] == "changelog.md") {
177
- return [import_node_path2.default.join("src", "content", "changelogs")];
178
- }
179
- if (filePathArr[filePathArr.length - 1] == "ubiquitous-language.md") {
180
- return [import_node_path2.default.join("src", "content", "ubiquitousLanguages")];
181
- }
182
- if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
183
- return [import_node_path2.default.join("src", "content")];
184
- }
185
167
  const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
186
168
  if (hasExtension(filePath)) {
187
- return [import_node_path2.default.join("public", "generated"), import_node_path2.default.join("src", "catalog-files")];
169
+ return [import_node_path2.default.join("public", "generated")];
188
170
  }
189
- return [import_node_path2.default.join("public", "generated"), import_node_path2.default.join("src", "catalog-files"), import_node_path2.default.join("src", "content")];
171
+ return [import_node_path2.default.join("public", "generated")];
190
172
  }
191
173
  if (filePathArr[0] == "components") {
192
174
  return [import_node_path2.default.join("src", "custom-defined-components")];
@@ -215,7 +197,8 @@ var rootPkg = path3.resolve(path3.dirname(__filename2), "../");
215
197
  var copyFiles = async (source, target) => {
216
198
  const files = await (0, import_glob.glob)(path3.join(source, "**"), {
217
199
  nodir: true,
218
- windowsPathsNoEscape: import_node_os.default.platform() == "win32"
200
+ windowsPathsNoEscape: import_node_os.default.platform() == "win32",
201
+ ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
219
202
  });
220
203
  for (const file of files) {
221
204
  mapCatalogToAstro({
@@ -225,56 +208,33 @@ var copyFiles = async (source, target) => {
225
208
  }).map((astroPath) => {
226
209
  import_fs.default.cpSync(file, astroPath);
227
210
  return { oldPath: file, newPath: astroPath };
228
- }).map(({ oldPath, newPath }) => {
229
- if (!oldPath.endsWith(".md") && !oldPath.endsWith(".mdx")) return;
230
- try {
231
- const content = import_fs.default.readFileSync(newPath, "utf-8");
232
- const frontmatter = addPropertyToFrontMatter(content, "pathToFile", oldPath);
233
- import_fs.default.writeFileSync(newPath, frontmatter);
234
- } catch (error) {
235
- }
236
211
  });
237
212
  }
238
213
  };
239
- var ensureAstroCollectionNotEmpty = async (astroDir) => {
240
- const COLLECTIONS = [
241
- "events",
242
- "commands",
243
- "services",
244
- "domains",
245
- "flows",
246
- "changelogs",
247
- "queries",
248
- "channels",
249
- "ubiquitousLanguages"
250
- ];
251
- const emptyCollections = [];
252
- for (const collection of COLLECTIONS) {
253
- const markdownFiles = await (0, import_glob.glob)(path3.join(astroDir, "src/content/", collection, "**"), {
254
- nodir: true,
255
- windowsPathsNoEscape: import_node_os.default.platform() == "win32"
256
- });
257
- if (markdownFiles.length === 0) emptyCollections.push(collection);
258
- }
259
- const defaultCollectionFilesDir = path3.join(rootPkg, "default-files-for-collections");
260
- for (const collection of emptyCollections) {
261
- const defaultFile = path3.join(defaultCollectionFilesDir, `${collection}.md`);
262
- const targetDir = path3.join(astroDir, "src/content/", collection);
263
- if (!import_fs.default.existsSync(targetDir)) {
264
- import_fs.default.mkdirSync(targetDir, { recursive: true });
265
- }
266
- import_fs.default.cpSync(defaultFile, path3.join(targetDir, `${collection}.md`));
267
- }
268
- };
269
214
  var catalogToAstro = async (source, astroDir) => {
270
215
  const astroContentDir = path3.join(astroDir, "src/content/");
271
216
  if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
272
217
  import_fs.default.mkdirSync(astroContentDir);
273
218
  await verifyRequiredFieldsAreInCatalogConfigFile(source);
274
219
  await copyFiles(source, astroDir);
275
- await ensureAstroCollectionNotEmpty(astroDir);
220
+ };
221
+ var checkAndConvertMdToMdx = async (source, astroDir) => {
222
+ const files = await (0, import_glob.glob)(path3.join(source, "**"), {
223
+ nodir: true,
224
+ windowsPathsNoEscape: import_node_os.default.platform() == "win32",
225
+ ignore: ["node_modules/**", "**/dist/**"]
226
+ });
227
+ if (files.some((file) => file.endsWith(".md"))) {
228
+ console.log(`EventCatalog now requires all markdown files to be .mdx files. Converting all .md files to .mdx...`);
229
+ }
230
+ for (const file of files) {
231
+ if (file.endsWith(".md")) {
232
+ import_fs.default.renameSync(file, file.replace(".md", ".mdx"));
233
+ }
234
+ }
276
235
  };
277
236
  // Annotate the CommonJS export names for ESM import in node:
278
237
  0 && (module.exports = {
279
- catalogToAstro
238
+ catalogToAstro,
239
+ checkAndConvertMdToMdx
280
240
  });
@@ -1,3 +1,4 @@
1
1
  declare function catalogToAstro(source: any, astroDir: any): Promise<void>;
2
+ declare function checkAndConvertMdToMdx(source: any, astroDir: any): Promise<void>;
2
3
 
3
- export { catalogToAstro };
4
+ export { catalogToAstro, checkAndConvertMdToMdx };
@@ -1,3 +1,4 @@
1
1
  declare function catalogToAstro(source: any, astroDir: any): Promise<void>;
2
+ declare function checkAndConvertMdToMdx(source: any, astroDir: any): Promise<void>;
2
3
 
3
- export { catalogToAstro };
4
+ export { catalogToAstro, checkAndConvertMdToMdx };
@@ -1,8 +1,10 @@
1
1
  import {
2
- catalogToAstro
3
- } from "./chunk-R2NILSWL.js";
2
+ catalogToAstro,
3
+ checkAndConvertMdToMdx
4
+ } from "./chunk-DE2TXYKB.js";
4
5
  import "./chunk-E7TXTI7G.js";
5
- import "./chunk-FIY5JLSQ.js";
6
+ import "./chunk-HAYFEAB4.js";
6
7
  export {
7
- catalogToAstro
8
+ catalogToAstro,
9
+ checkAndConvertMdToMdx
8
10
  };
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.29.4";
2
+ var version = "2.30.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -0,0 +1,59 @@
1
+ import {
2
+ verifyRequiredFieldsAreInCatalogConfigFile
3
+ } from "./chunk-E7TXTI7G.js";
4
+ import {
5
+ mapCatalogToAstro
6
+ } from "./chunk-HAYFEAB4.js";
7
+
8
+ // src/catalog-to-astro-content-directory.js
9
+ import { glob } from "glob";
10
+ import * as path from "node:path";
11
+ import fs from "fs";
12
+ import { fileURLToPath } from "url";
13
+ import os from "node:os";
14
+ var __filename = fileURLToPath(import.meta.url);
15
+ var rootPkg = path.resolve(path.dirname(__filename), "../");
16
+ var copyFiles = async (source, target) => {
17
+ const files = await glob(path.join(source, "**"), {
18
+ nodir: true,
19
+ windowsPathsNoEscape: os.platform() == "win32",
20
+ ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
21
+ });
22
+ for (const file of files) {
23
+ mapCatalogToAstro({
24
+ filePath: file,
25
+ astroDir: target,
26
+ projectDir: source
27
+ }).map((astroPath) => {
28
+ fs.cpSync(file, astroPath);
29
+ return { oldPath: file, newPath: astroPath };
30
+ });
31
+ }
32
+ };
33
+ var catalogToAstro = async (source, astroDir) => {
34
+ const astroContentDir = path.join(astroDir, "src/content/");
35
+ if (fs.existsSync(astroContentDir)) fs.rmSync(astroContentDir, { recursive: true });
36
+ fs.mkdirSync(astroContentDir);
37
+ await verifyRequiredFieldsAreInCatalogConfigFile(source);
38
+ await copyFiles(source, astroDir);
39
+ };
40
+ var checkAndConvertMdToMdx = async (source, astroDir) => {
41
+ const files = await glob(path.join(source, "**"), {
42
+ nodir: true,
43
+ windowsPathsNoEscape: os.platform() == "win32",
44
+ ignore: ["node_modules/**", "**/dist/**"]
45
+ });
46
+ if (files.some((file) => file.endsWith(".md"))) {
47
+ console.log(`EventCatalog now requires all markdown files to be .mdx files. Converting all .md files to .mdx...`);
48
+ }
49
+ for (const file of files) {
50
+ if (file.endsWith(".md")) {
51
+ fs.renameSync(file, file.replace(".md", ".mdx"));
52
+ }
53
+ }
54
+ };
55
+
56
+ export {
57
+ catalogToAstro,
58
+ checkAndConvertMdToMdx
59
+ };
@@ -20,13 +20,7 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
20
20
  }
21
21
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
22
22
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
23
- return baseTargetPaths.map(
24
- (base) => path.join(
25
- astroDir,
26
- base,
27
- relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx").replace("ubiquitous-language.md", "ubiquitous-language.mdx")
28
- )
29
- );
23
+ return baseTargetPaths.map((base) => path.join(astroDir, base, relativeTargetPath));
30
24
  }
31
25
  function removeBasePath(fullPath, basePath) {
32
26
  const relativePath = path.relative(basePath, fullPath);
@@ -55,20 +49,11 @@ function isCatalogRelated(filePath) {
55
49
  function getBaseTargetPaths(filePath) {
56
50
  const filePathArr = filePath.split(path.sep).filter(Boolean);
57
51
  if (isCollectionKey(filePathArr[0])) {
58
- if (filePathArr[filePathArr.length - 1] == "changelog.md") {
59
- return [path.join("src", "content", "changelogs")];
60
- }
61
- if (filePathArr[filePathArr.length - 1] == "ubiquitous-language.md") {
62
- return [path.join("src", "content", "ubiquitousLanguages")];
63
- }
64
- if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
65
- return [path.join("src", "content")];
66
- }
67
52
  const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
68
53
  if (hasExtension(filePath)) {
69
- return [path.join("public", "generated"), path.join("src", "catalog-files")];
54
+ return [path.join("public", "generated")];
70
55
  }
71
- return [path.join("public", "generated"), path.join("src", "catalog-files"), path.join("src", "content")];
56
+ return [path.join("public", "generated")];
72
57
  }
73
58
  if (filePathArr[0] == "components") {
74
59
  return [path.join("src", "custom-defined-components")];
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-DH6NCUJX.js";
3
+ } from "./chunk-T2XS2ZVB.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-7PSA2C5C.js";
3
+ } from "./chunk-4Q54XOED.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,9 +1,6 @@
1
- import {
2
- addPropertyToFrontMatter
3
- } from "./chunk-E7TXTI7G.js";
4
1
  import {
5
2
  mapCatalogToAstro
6
- } from "./chunk-FIY5JLSQ.js";
3
+ } from "./chunk-HAYFEAB4.js";
7
4
 
8
5
  // src/watcher.js
9
6
  import watcher from "@parcel/watcher";
@@ -24,6 +21,9 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
24
21
  }
25
22
  for (let event of events) {
26
23
  const { path: filePath, type } = event;
24
+ if (filePath.endsWith(".mdx") || filePath.endsWith(".md")) {
25
+ continue;
26
+ }
27
27
  const astroPaths = mapCatalogToAstro({
28
28
  filePath,
29
29
  astroDir: catalogDirectory,
@@ -38,14 +38,6 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
38
38
  } else {
39
39
  retryEPERM(fs.cpSync)(filePath, astroPath);
40
40
  }
41
- try {
42
- if (astroPath.endsWith(".mdx")) {
43
- const content = fs.readFileSync(astroPath, "utf-8");
44
- const frontmatter = addPropertyToFrontMatter(content, "pathToFile", filePath);
45
- fs.writeFileSync(astroPath, frontmatter);
46
- }
47
- } catch (error) {
48
- }
49
41
  break;
50
42
  case "delete":
51
43
  retryEPERM(rimrafSync)(astroPath);
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.29.4";
28
+ var version = "2.30.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-7PSA2C5C.js";
3
+ } from "./chunk-4Q54XOED.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -104,10 +104,6 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
104
104
  } catch (error) {
105
105
  }
106
106
  };
107
- function addPropertyToFrontMatter(input, newProperty, newValue) {
108
- const file = (0, import_gray_matter.default)(input);
109
- return import_gray_matter.default.stringify(file.content, { ...file.data, [newProperty]: newValue });
110
- }
111
107
 
112
108
  // src/generate.js
113
109
  function getDefaultExport(importedModule) {
@@ -161,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
161
157
  var import_os = __toESM(require("os"), 1);
162
158
 
163
159
  // package.json
164
- var version = "2.29.4";
160
+ var version = "2.30.0";
165
161
 
166
162
  // src/constants.ts
167
163
  var VERSION = version;
@@ -235,13 +231,7 @@ function mapCatalogToAstro({ filePath, astroDir, projectDir }) {
235
231
  }
236
232
  const baseTargetPaths = getBaseTargetPaths(relativeFilePath);
237
233
  const relativeTargetPath = getRelativeTargetPath(relativeFilePath);
238
- return baseTargetPaths.map(
239
- (base) => import_node_path3.default.join(
240
- astroDir,
241
- base,
242
- relativeTargetPath.replace("index.md", "index.mdx").replace("changelog.md", "changelog.mdx").replace("ubiquitous-language.md", "ubiquitous-language.mdx")
243
- )
244
- );
234
+ return baseTargetPaths.map((base) => import_node_path3.default.join(astroDir, base, relativeTargetPath));
245
235
  }
246
236
  function removeBasePath(fullPath, basePath) {
247
237
  const relativePath = import_node_path3.default.relative(basePath, fullPath);
@@ -270,20 +260,11 @@ function isCatalogRelated(filePath) {
270
260
  function getBaseTargetPaths(filePath) {
271
261
  const filePathArr = filePath.split(import_node_path3.default.sep).filter(Boolean);
272
262
  if (isCollectionKey(filePathArr[0])) {
273
- if (filePathArr[filePathArr.length - 1] == "changelog.md") {
274
- return [import_node_path3.default.join("src", "content", "changelogs")];
275
- }
276
- if (filePathArr[filePathArr.length - 1] == "ubiquitous-language.md") {
277
- return [import_node_path3.default.join("src", "content", "ubiquitousLanguages")];
278
- }
279
- if (filePathArr[filePathArr.length - 1].match(/\.md$/)) {
280
- return [import_node_path3.default.join("src", "content")];
281
- }
282
263
  const hasExtension = (str) => /\.[a-zA-Z0-9]{2,}$/.test(str);
283
264
  if (hasExtension(filePath)) {
284
- return [import_node_path3.default.join("public", "generated"), import_node_path3.default.join("src", "catalog-files")];
265
+ return [import_node_path3.default.join("public", "generated")];
285
266
  }
286
- return [import_node_path3.default.join("public", "generated"), import_node_path3.default.join("src", "catalog-files"), import_node_path3.default.join("src", "content")];
267
+ return [import_node_path3.default.join("public", "generated")];
287
268
  }
288
269
  if (filePathArr[0] == "components") {
289
270
  return [import_node_path3.default.join("src", "custom-defined-components")];
@@ -324,6 +305,9 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
324
305
  }
325
306
  for (let event of events) {
326
307
  const { path: filePath, type } = event;
308
+ if (filePath.endsWith(".mdx") || filePath.endsWith(".md")) {
309
+ continue;
310
+ }
327
311
  const astroPaths = mapCatalogToAstro({
328
312
  filePath,
329
313
  astroDir: catalogDirectory,
@@ -338,14 +322,6 @@ async function watch(projectDirectory, catalogDirectory, callback = void 0) {
338
322
  } else {
339
323
  retryEPERM(import_node_fs2.default.cpSync)(filePath, astroPath);
340
324
  }
341
- try {
342
- if (astroPath.endsWith(".mdx")) {
343
- const content = import_node_fs2.default.readFileSync(astroPath, "utf-8");
344
- const frontmatter = addPropertyToFrontMatter(content, "pathToFile", filePath);
345
- import_node_fs2.default.writeFileSync(astroPath, frontmatter);
346
- }
347
- } catch (error) {
348
- }
349
325
  break;
350
326
  case "delete":
351
327
  retryEPERM(import_rimraf.rimrafSync)(astroPath);
@@ -403,7 +379,8 @@ var rootPkg = path5.resolve(path5.dirname(__filename2), "../");
403
379
  var copyFiles = async (source, target) => {
404
380
  const files = await (0, import_glob.glob)(path5.join(source, "**"), {
405
381
  nodir: true,
406
- windowsPathsNoEscape: import_node_os.default.platform() == "win32"
382
+ windowsPathsNoEscape: import_node_os.default.platform() == "win32",
383
+ ignore: ["node_modules/**", "**/dist/**", "**/teams", "**/users", "**/*.mdx", "**/*.md", "**/package.json", "**/Dockerfile"]
407
384
  });
408
385
  for (const file of files) {
409
386
  mapCatalogToAstro({
@@ -413,54 +390,30 @@ var copyFiles = async (source, target) => {
413
390
  }).map((astroPath) => {
414
391
  import_fs.default.cpSync(file, astroPath);
415
392
  return { oldPath: file, newPath: astroPath };
416
- }).map(({ oldPath, newPath }) => {
417
- if (!oldPath.endsWith(".md") && !oldPath.endsWith(".mdx")) return;
418
- try {
419
- const content = import_fs.default.readFileSync(newPath, "utf-8");
420
- const frontmatter = addPropertyToFrontMatter(content, "pathToFile", oldPath);
421
- import_fs.default.writeFileSync(newPath, frontmatter);
422
- } catch (error) {
423
- }
424
393
  });
425
394
  }
426
395
  };
427
- var ensureAstroCollectionNotEmpty = async (astroDir) => {
428
- const COLLECTIONS = [
429
- "events",
430
- "commands",
431
- "services",
432
- "domains",
433
- "flows",
434
- "changelogs",
435
- "queries",
436
- "channels",
437
- "ubiquitousLanguages"
438
- ];
439
- const emptyCollections = [];
440
- for (const collection of COLLECTIONS) {
441
- const markdownFiles = await (0, import_glob.glob)(path5.join(astroDir, "src/content/", collection, "**"), {
442
- nodir: true,
443
- windowsPathsNoEscape: import_node_os.default.platform() == "win32"
444
- });
445
- if (markdownFiles.length === 0) emptyCollections.push(collection);
446
- }
447
- const defaultCollectionFilesDir = path5.join(rootPkg, "default-files-for-collections");
448
- for (const collection of emptyCollections) {
449
- const defaultFile = path5.join(defaultCollectionFilesDir, `${collection}.md`);
450
- const targetDir = path5.join(astroDir, "src/content/", collection);
451
- if (!import_fs.default.existsSync(targetDir)) {
452
- import_fs.default.mkdirSync(targetDir, { recursive: true });
453
- }
454
- import_fs.default.cpSync(defaultFile, path5.join(targetDir, `${collection}.md`));
455
- }
456
- };
457
396
  var catalogToAstro = async (source, astroDir) => {
458
397
  const astroContentDir = path5.join(astroDir, "src/content/");
459
398
  if (import_fs.default.existsSync(astroContentDir)) import_fs.default.rmSync(astroContentDir, { recursive: true });
460
399
  import_fs.default.mkdirSync(astroContentDir);
461
400
  await verifyRequiredFieldsAreInCatalogConfigFile(source);
462
401
  await copyFiles(source, astroDir);
463
- await ensureAstroCollectionNotEmpty(astroDir);
402
+ };
403
+ var checkAndConvertMdToMdx = async (source, astroDir) => {
404
+ const files = await (0, import_glob.glob)(path5.join(source, "**"), {
405
+ nodir: true,
406
+ windowsPathsNoEscape: import_node_os.default.platform() == "win32",
407
+ ignore: ["node_modules/**", "**/dist/**"]
408
+ });
409
+ if (files.some((file) => file.endsWith(".md"))) {
410
+ console.log(`EventCatalog now requires all markdown files to be .mdx files. Converting all .md files to .mdx...`);
411
+ }
412
+ for (const file of files) {
413
+ if (file.endsWith(".md")) {
414
+ import_fs.default.renameSync(file, file.replace(".md", ".mdx"));
415
+ }
416
+ }
464
417
  };
465
418
 
466
419
  // src/resolve-catalog-dependencies.js
@@ -555,6 +508,7 @@ var isBackstagePluginEnabled = async (licenseKey) => {
555
508
 
556
509
  // src/eventcatalog.ts
557
510
  var import_update_notifier = __toESM(require("update-notifier"), 1);
511
+ var import_stream = __toESM(require("stream"), 1);
558
512
  var currentDir = import_node_path7.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
559
513
  var program = new import_commander.Command().version(VERSION);
560
514
  var dir = import_node_path7.default.resolve(process.env.PROJECT_DIR || process.cwd());
@@ -628,24 +582,40 @@ program.command("dev").description("Run development server of EventCatalog").opt
628
582
  if (options.forceRecreate) clearCore();
629
583
  copyCore();
630
584
  await resolve_catalog_dependencies_default(dir, core);
585
+ await checkAndConvertMdToMdx(dir, core);
631
586
  await catalogToAstro(dir, core);
632
587
  const canEmbedPages = await isBackstagePluginEnabled();
633
588
  checkForUpdate();
634
589
  let watchUnsub;
635
590
  try {
636
591
  watchUnsub = await watch(dir, core);
637
- const { result } = (0, import_concurrently.default)([
638
- {
639
- name: "astro",
640
- command: `npx astro dev ${command.args.join(" ").trim()}`,
641
- cwd: core,
642
- env: {
643
- PROJECT_DIR: dir,
644
- CATALOG_DIR: core,
645
- ENABLE_EMBED: canEmbedPages
592
+ const { result } = (0, import_concurrently.default)(
593
+ [
594
+ {
595
+ name: "astro",
596
+ // Ignore any "Empty collection" messages
597
+ command: process.platform === "win32" ? `npx astro dev ${command.args.join(" ").trim()} | findstr /V "The collection"` : `npx astro dev ${command.args.join(" ").trim()} 2>&1 | grep -v "The collection.*does not exist"`,
598
+ cwd: core,
599
+ env: {
600
+ PROJECT_DIR: dir,
601
+ CATALOG_DIR: core,
602
+ ENABLE_EMBED: canEmbedPages
603
+ }
646
604
  }
605
+ ],
606
+ {
607
+ raw: true,
608
+ outputStream: new import_stream.default.Writable({
609
+ write(chunk, encoding, callback) {
610
+ const text = chunk.toString();
611
+ if (!(text.includes("The collection") && text.includes("does not exist"))) {
612
+ process.stdout.write(chunk);
613
+ }
614
+ callback();
615
+ }
616
+ })
647
617
  }
648
- ]);
618
+ );
649
619
  await result;
650
620
  } catch (err) {
651
621
  console.error(err);
@@ -658,16 +628,17 @@ program.command("build").description("Run build of EventCatalog").action(async (
658
628
  copyCore();
659
629
  await log_build_default(dir);
660
630
  await resolve_catalog_dependencies_default(dir, core);
631
+ await checkAndConvertMdToMdx(dir, core);
661
632
  await catalogToAstro(dir, core);
662
633
  const canEmbedPages = await isBackstagePluginEnabled();
663
634
  checkForUpdate();
664
- (0, import_node_child_process.execSync)(
665
- `cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} npx astro build ${command.args.join(" ").trim()}`,
666
- {
667
- cwd: core,
668
- stdio: "inherit"
669
- }
670
- );
635
+ const windowsCommand = `npx astro build ${command.args.join(" ").trim()} | findstr /V "The collection"`;
636
+ const unixCommand = `npx astro build ${command.args.join(" ").trim()} 2>&1 | grep -v "The collection.*does not exist"`;
637
+ const buildCommand = process.platform === "win32" ? windowsCommand : unixCommand;
638
+ (0, import_node_child_process.execSync)(`cross-env PROJECT_DIR='${dir}' CATALOG_DIR='${core}' ENABLE_EMBED=${canEmbedPages} ${buildCommand}`, {
639
+ cwd: core,
640
+ stdio: "inherit"
641
+ });
671
642
  });
672
643
  var previewCatalog = ({ command, canEmbedPages = false }) => {
673
644
  (0, import_node_child_process.execSync)(