@eventcatalog/core 2.33.3 → 2.33.4

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.
@@ -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.33.3";
40
+ var version = "2.33.4";
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-5QUF2S7L.js";
4
- import "../chunk-557OECV4.js";
3
+ } from "../chunk-AUIYWFSM.js";
4
+ import "../chunk-2OM7CIOD.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.33.3";
109
+ var version = "2.33.4";
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-5TXSONUY.js";
4
- import "../chunk-5QUF2S7L.js";
5
- import "../chunk-557OECV4.js";
3
+ } from "../chunk-MRFHOQZ5.js";
4
+ import "../chunk-AUIYWFSM.js";
5
+ import "../chunk-2OM7CIOD.js";
6
6
  import "../chunk-E7TXTI7G.js";
7
7
  export {
8
8
  log_build_default as default
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "2.33.3";
2
+ var version = "2.33.4";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-557OECV4.js";
3
+ } from "./chunk-2OM7CIOD.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import axios from "axios";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "./chunk-5QUF2S7L.js";
3
+ } from "./chunk-AUIYWFSM.js";
4
4
  import {
5
5
  getEventCatalogConfigFile,
6
6
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "2.33.3";
28
+ var version = "2.33.4";
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-557OECV4.js";
3
+ } from "./chunk-2OM7CIOD.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -157,7 +157,7 @@ var import_axios = __toESM(require("axios"), 1);
157
157
  var import_os = __toESM(require("os"), 1);
158
158
 
159
159
  // package.json
160
- var version = "2.33.3";
160
+ var version = "2.33.4";
161
161
 
162
162
  // src/constants.ts
163
163
  var VERSION = version;
@@ -6,15 +6,15 @@ import {
6
6
  } from "./chunk-UKJ7F5WR.js";
7
7
  import {
8
8
  log_build_default
9
- } from "./chunk-5TXSONUY.js";
10
- import "./chunk-5QUF2S7L.js";
9
+ } from "./chunk-MRFHOQZ5.js";
10
+ import "./chunk-AUIYWFSM.js";
11
11
  import {
12
12
  catalogToAstro,
13
13
  checkAndConvertMdToMdx
14
14
  } from "./chunk-7SI5EVOX.js";
15
15
  import {
16
16
  VERSION
17
- } from "./chunk-557OECV4.js";
17
+ } from "./chunk-2OM7CIOD.js";
18
18
  import {
19
19
  isBackstagePluginEnabled,
20
20
  isEventCatalogScaleEnabled,
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { buildUrl } from '@utils/url-builder';
3
3
  import type { SidebarItem } from '../types';
4
+ import { ExternalLinkIcon } from 'lucide-react';
4
5
 
5
6
  interface NestedItemProps {
6
7
  item: SidebarItem;
@@ -89,16 +90,45 @@ const NestedItem: React.FC<NestedItemProps> = ({
89
90
  );
90
91
  }
91
92
 
92
- const itemPath = item.slug ? buildUrl(`/docs/custom/${item.slug}`) : '#';
93
+ let itemPath = item.slug ? buildUrl(`/docs/custom/${item.slug}`) : '#';
93
94
  const isActive = currentPath === itemPath || currentPath.endsWith(`/${item.slug}`);
94
95
 
96
+ // Convert string style to React CSSProperties if needed
97
+ const attrs = item.attrs
98
+ ? {
99
+ ...item.attrs,
100
+ style:
101
+ typeof item.attrs.style === 'string'
102
+ ? item.attrs.style
103
+ .split(';')
104
+ .filter((style) => style.trim())
105
+ .reduce((acc, style) => {
106
+ const [key, value] = style.split(':').map((s) => s.trim());
107
+ const camelKey = key.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
108
+ return { ...acc, [camelKey]: value };
109
+ }, {})
110
+ : item.attrs.style,
111
+ }
112
+ : null;
113
+
114
+ const isExternalLink = item.slug?.startsWith('http');
115
+
116
+ if (isExternalLink && item.slug) {
117
+ itemPath = item.slug;
118
+ }
119
+
95
120
  return (
96
121
  <a
97
122
  href={itemPath}
123
+ {...(attrs || {})}
98
124
  className={`flex items-center px-2 py-1.5 text-xs ${isActive ? 'bg-purple-100 text-purple-900 font-medium' : 'text-gray-600 hover:bg-purple-100'} rounded-md`}
99
125
  data-active={isActive}
126
+ target={isExternalLink ? '_blank' : undefined}
100
127
  >
101
- <span className="truncate">{item.label}</span>
128
+ <span className="truncate flex items-center gap-1.5">
129
+ {item.label}
130
+ {isExternalLink && <ExternalLinkIcon className="w-3 -mt-0.5 h-3" />}
131
+ </span>
102
132
  {item.badge && item?.badge?.text && (
103
133
  <span
104
134
  className={`text-${item.badge.color || 'purple'}-600 ml-2 text-[10px] font-medium bg-${item.badge.color || 'purple'}-50 px-2 py-0.5 rounded uppercase`}
@@ -1,6 +1,8 @@
1
1
  export interface SidebarItem {
2
2
  label: string;
3
3
  slug?: string;
4
+ link?: string;
5
+ attrs?: Record<string, string>;
4
6
  items?: SidebarItem[];
5
7
  badge?: {
6
8
  text: string;
@@ -1,4 +1,3 @@
1
- // import { getCollection } from "astro:content";
2
1
  import config from '@config';
3
2
  import fs from 'node:fs';
4
3
  import path from 'node:path';
@@ -16,6 +15,8 @@ type SidebarItem = {
16
15
  items?: SidebarItem[];
17
16
  badge?: Badge;
18
17
  collapsed?: boolean;
18
+ link?: string;
19
+ attrs?: Record<string, string>;
19
20
  };
20
21
 
21
22
  type SideBarConfigurationItem = {
@@ -28,6 +29,8 @@ type SideBarConfigurationItem = {
28
29
  };
29
30
  badge?: Badge;
30
31
  collapsed?: boolean;
32
+ link?: string;
33
+ attrs?: Record<string, string>;
31
34
  };
32
35
 
33
36
  type AdjacentPage = {
@@ -52,39 +55,45 @@ const processAutoGeneratedDirectory = async (
52
55
  collapsed?: boolean
53
56
  ): Promise<SidebarItem> => {
54
57
  // @ts-ignore
55
- const files = fs.readdirSync(path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory));
56
-
57
- // Convert files to frontmatter
58
- const docsWithFrontmatter = files.map((file) => {
59
- // @ts-ignore
60
- const content = fs.readFileSync(path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory, file), 'utf8');
61
- const { data } = matter(content);
62
- return { ...data, file };
63
- });
64
-
65
- // If user defined slug use it, otherwise use the file
66
- const astroIdsForFiles = docsWithFrontmatter.map(
67
- (doc: any) => doc.slug || path.join(DOCS_DIR, directory, doc.file).replace('.mdx', '')
68
- );
58
+ const items = fs.readdirSync(path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory));
69
59
 
70
- const entries = await Promise.all(
71
- astroIdsForFiles.map(async (astroId) => {
72
- const entry = await getEntry('customPages', astroId);
73
- return entry;
74
- })
75
- );
60
+ const allItems: SidebarItem[] = [];
76
61
 
77
- // Filter anything we haven't found
78
- const filteredEntries = entries.filter((entry) => entry !== undefined);
62
+ for (const item of items) {
63
+ const fullPath = path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory, item);
64
+ const isDirectory = fs.statSync(fullPath).isDirectory();
65
+
66
+ if (isDirectory) {
67
+ // Recursively process subdirectory
68
+ const subdirResult = await processAutoGeneratedDirectory(
69
+ path.join(directory, item),
70
+ item, // Use directory name as label
71
+ undefined, // No badge for subdirectories
72
+ collapsed // Inherit collapsed state
73
+ );
74
+ allItems.push(subdirResult);
75
+ } else {
76
+ // Process file
77
+ const content = fs.readFileSync(fullPath, 'utf8');
78
+ const { data } = matter(content);
79
+
80
+ const astroId = data.slug || path.join(DOCS_DIR, directory, item).replace('.mdx', '');
81
+ const entry = await getEntry('customPages', astroId.toLowerCase());
82
+
83
+ if (entry) {
84
+ allItems.push({
85
+ label: entry.data.title,
86
+ slug: entry.data.slug || entry.id.replace(DOCS_DIR, ''),
87
+ });
88
+ }
89
+ }
90
+ }
79
91
 
80
92
  return {
81
93
  label,
82
94
  badge,
83
95
  collapsed,
84
- items: filteredEntries.map((entry) => ({
85
- label: entry?.data?.title,
86
- slug: entry?.data?.slug || entry?.id.replace(DOCS_DIR, ''),
87
- })),
96
+ items: allItems,
88
97
  };
89
98
  };
90
99
 
@@ -118,7 +127,16 @@ const processSidebarItems = async (items: SideBarConfigurationItem[]): Promise<S
118
127
  }
119
128
  // Otherwise, it's a regular item
120
129
  else {
121
- processedItems.push(item as SidebarItem);
130
+ // if its a link, add it to the processedItems
131
+ if (item.link) {
132
+ processedItems.push({
133
+ label: item.label,
134
+ slug: item.link,
135
+ attrs: item.attrs,
136
+ });
137
+ } else {
138
+ processedItems.push(item as SidebarItem);
139
+ }
122
140
  }
123
141
  }
124
142
 
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/event-catalog/eventcatalog.git"
7
7
  },
8
8
  "type": "module",
9
- "version": "2.33.3",
9
+ "version": "2.33.4",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },