@eventcatalog/core 2.19.3 → 2.19.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.
- package/README.md +2 -1
- 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-HKXWXCBU.js → chunk-BLDONK5J.js} +15 -16
- package/dist/{chunk-QWOWEO4Q.js → chunk-FUEL2H2M.js} +1 -1
- package/dist/{chunk-XVQA6PHI.js → chunk-I6MZFFLJ.js} +1 -1
- package/dist/{chunk-GOZSBK4C.js → chunk-YCAXXE3T.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +16 -17
- package/dist/eventcatalog.js +4 -4
- package/dist/resolve-catalog-dependencies.cjs +15 -16
- package/dist/resolve-catalog-dependencies.js +1 -1
- package/eventcatalog/package.json +1 -1
- package/eventcatalog/src/components/Checkbox.astro +38 -0
- package/eventcatalog/src/components/Tables/Table.tsx +28 -2
- package/eventcatalog/src/layouts/DiscoverLayout.astro +8 -3
- package/eventcatalog/src/utils/collections/file-diffs.ts +3 -24
- package/eventcatalog/src/utils/collections/util.ts +12 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
<h4>Features: Documentation generator for Event Driven Architectures, Markdown driven, Document Domains/Services/Messages/Schemas and more, Content versioning, Assign Owners, Schemas, OpenAPI, MDX Components and more...</h4>
|
|
33
33
|
|
|
34
34
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
35
|
-
[](#contributors-)
|
|
36
36
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
37
37
|
|
|
38
38
|
[Read the Docs](https://eventcatalog.dev/) | [Edit the Docs](https://github.com/event-catalog/docs) | [View Demo](https://demo.eventcatalog.dev/docs)
|
|
@@ -251,6 +251,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
251
251
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/d-o-h"><img src="https://avatars.githubusercontent.com/u/23699653?v=4?s=100" width="100px;" alt="d-o-h"/><br /><sub><b>d-o-h</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=d-o-h" title="Code">💻</a></td>
|
|
252
252
|
<td align="center" valign="top" width="14.28%"><a href="https://pallares.io"><img src="https://avatars.githubusercontent.com/u/1077520?v=4?s=100" width="100px;" alt="Cristian Pallarés"/><br /><sub><b>Cristian Pallarés</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=skyrpex" title="Code">💻</a></td>
|
|
253
253
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/SebasRendon12"><img src="https://avatars.githubusercontent.com/u/69688183?v=4?s=100" width="100px;" alt="Sebastian Rendon"/><br /><sub><b>Sebastian Rendon</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=SebasRendon12" title="Code">💻</a></td>
|
|
254
|
+
<td align="center" valign="top" width="14.28%"><a href="http://craig0990.co.uk"><img src="https://avatars.githubusercontent.com/u/461897?v=4?s=100" width="100px;" alt="Craig Roberts"/><br /><sub><b>Craig Roberts</b></sub></a><br /><a href="https://github.com/event-catalog/eventcatalog/commits?author=craig0990" title="Code">💻</a></td>
|
|
254
255
|
</tr>
|
|
255
256
|
</tbody>
|
|
256
257
|
</table>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-FUEL2H2M.js";
|
|
4
|
+
import "../chunk-I6MZFFLJ.js";
|
|
5
|
+
import "../chunk-YCAXXE3T.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
// src/resolve-catalog-dependencies.js
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import fs from "node:fs";
|
|
8
|
+
import matter from "gray-matter";
|
|
8
9
|
var resolve_catalog_dependencies_default = async (catalogDir, core) => {
|
|
9
10
|
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
10
11
|
const dependencies = catalogConfig?.dependencies ?? null;
|
|
@@ -19,25 +20,23 @@ var resolve_catalog_dependencies_default = async (catalogDir, core) => {
|
|
|
19
20
|
const resourceTypes = Object.keys(dependencies);
|
|
20
21
|
for (const resourceType of resourceTypes) {
|
|
21
22
|
for (const dependency of dependencies[resourceType]) {
|
|
22
|
-
const
|
|
23
|
+
const frontmatter = {
|
|
23
24
|
id: dependency.id,
|
|
25
|
+
name: dependency.id,
|
|
24
26
|
version: dependency.version || "1.0.0"
|
|
25
27
|
};
|
|
26
|
-
const markdown =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
:::
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
`;
|
|
40
|
-
const resourceFile = path.join(dependenciesDir, resourceType, resource.id, `index.md`);
|
|
28
|
+
const markdown = matter.stringify(
|
|
29
|
+
{
|
|
30
|
+
content: [
|
|
31
|
+
":::warning",
|
|
32
|
+
"You are running EventCatalog with dependencies enabled.",
|
|
33
|
+
"This resource is mocked and is a dependency. This means that the resource is managed and owned by another catalog.",
|
|
34
|
+
":::"
|
|
35
|
+
].join("\n\n")
|
|
36
|
+
},
|
|
37
|
+
frontmatter
|
|
38
|
+
);
|
|
39
|
+
const resourceFile = path.join(dependenciesDir, resourceType, dependency.id, `index.md`);
|
|
41
40
|
fs.mkdirSync(path.dirname(resourceFile), { recursive: true });
|
|
42
41
|
fs.writeFileSync(resourceFile, markdown);
|
|
43
42
|
}
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -161,7 +161,7 @@ var import_axios = __toESM(require("axios"), 1);
|
|
|
161
161
|
var import_os = __toESM(require("os"), 1);
|
|
162
162
|
|
|
163
163
|
// package.json
|
|
164
|
-
var version = "2.19.
|
|
164
|
+
var version = "2.19.4";
|
|
165
165
|
|
|
166
166
|
// src/constants.ts
|
|
167
167
|
var VERSION = version;
|
|
@@ -469,6 +469,7 @@ var catalogToAstro = async (source, astroDir) => {
|
|
|
469
469
|
// src/resolve-catalog-dependencies.js
|
|
470
470
|
var import_node_path4 = __toESM(require("path"), 1);
|
|
471
471
|
var import_node_fs3 = __toESM(require("fs"), 1);
|
|
472
|
+
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
472
473
|
var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
473
474
|
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
474
475
|
const dependencies = catalogConfig?.dependencies ?? null;
|
|
@@ -483,25 +484,23 @@ var resolve_catalog_dependencies_default = async (catalogDir, core2) => {
|
|
|
483
484
|
const resourceTypes = Object.keys(dependencies);
|
|
484
485
|
for (const resourceType of resourceTypes) {
|
|
485
486
|
for (const dependency of dependencies[resourceType]) {
|
|
486
|
-
const
|
|
487
|
+
const frontmatter = {
|
|
487
488
|
id: dependency.id,
|
|
489
|
+
name: dependency.id,
|
|
488
490
|
version: dependency.version || "1.0.0"
|
|
489
491
|
};
|
|
490
|
-
const markdown =
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
:::
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
`;
|
|
504
|
-
const resourceFile = import_node_path4.default.join(dependenciesDir, resourceType, resource.id, `index.md`);
|
|
492
|
+
const markdown = import_gray_matter2.default.stringify(
|
|
493
|
+
{
|
|
494
|
+
content: [
|
|
495
|
+
":::warning",
|
|
496
|
+
"You are running EventCatalog with dependencies enabled.",
|
|
497
|
+
"This resource is mocked and is a dependency. This means that the resource is managed and owned by another catalog.",
|
|
498
|
+
":::"
|
|
499
|
+
].join("\n\n")
|
|
500
|
+
},
|
|
501
|
+
frontmatter
|
|
502
|
+
);
|
|
503
|
+
const resourceFile = import_node_path4.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
|
|
505
504
|
import_node_fs3.default.mkdirSync(import_node_path4.default.dirname(resourceFile), { recursive: true });
|
|
506
505
|
import_node_fs3.default.writeFileSync(resourceFile, markdown);
|
|
507
506
|
}
|
package/dist/eventcatalog.js
CHANGED
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "./chunk-SHCMAL37.js";
|
|
4
4
|
import {
|
|
5
5
|
log_build_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-FUEL2H2M.js";
|
|
7
|
+
import "./chunk-I6MZFFLJ.js";
|
|
8
8
|
import {
|
|
9
9
|
catalogToAstro
|
|
10
10
|
} from "./chunk-WF34R5UT.js";
|
|
11
11
|
import {
|
|
12
12
|
VERSION
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YCAXXE3T.js";
|
|
14
14
|
import {
|
|
15
15
|
generate
|
|
16
16
|
} from "./chunk-YEQVKHST.js";
|
|
17
17
|
import "./chunk-7JDTB3U5.js";
|
|
18
18
|
import {
|
|
19
19
|
resolve_catalog_dependencies_default
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-BLDONK5J.js";
|
|
21
21
|
import "./chunk-E7TXTI7G.js";
|
|
22
22
|
|
|
23
23
|
// src/eventcatalog.ts
|
|
@@ -71,6 +71,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
|
|
|
71
71
|
// src/resolve-catalog-dependencies.js
|
|
72
72
|
var import_node_path2 = __toESM(require("path"), 1);
|
|
73
73
|
var import_node_fs2 = __toESM(require("fs"), 1);
|
|
74
|
+
var import_gray_matter2 = __toESM(require("gray-matter"), 1);
|
|
74
75
|
var resolve_catalog_dependencies_default = async (catalogDir, core) => {
|
|
75
76
|
const catalogConfig = await getEventCatalogConfigFile(catalogDir);
|
|
76
77
|
const dependencies = catalogConfig?.dependencies ?? null;
|
|
@@ -85,25 +86,23 @@ var resolve_catalog_dependencies_default = async (catalogDir, core) => {
|
|
|
85
86
|
const resourceTypes = Object.keys(dependencies);
|
|
86
87
|
for (const resourceType of resourceTypes) {
|
|
87
88
|
for (const dependency of dependencies[resourceType]) {
|
|
88
|
-
const
|
|
89
|
+
const frontmatter = {
|
|
89
90
|
id: dependency.id,
|
|
91
|
+
name: dependency.id,
|
|
90
92
|
version: dependency.version || "1.0.0"
|
|
91
93
|
};
|
|
92
|
-
const markdown =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
:::
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
`;
|
|
106
|
-
const resourceFile = import_node_path2.default.join(dependenciesDir, resourceType, resource.id, `index.md`);
|
|
94
|
+
const markdown = import_gray_matter2.default.stringify(
|
|
95
|
+
{
|
|
96
|
+
content: [
|
|
97
|
+
":::warning",
|
|
98
|
+
"You are running EventCatalog with dependencies enabled.",
|
|
99
|
+
"This resource is mocked and is a dependency. This means that the resource is managed and owned by another catalog.",
|
|
100
|
+
":::"
|
|
101
|
+
].join("\n\n")
|
|
102
|
+
},
|
|
103
|
+
frontmatter
|
|
104
|
+
);
|
|
105
|
+
const resourceFile = import_node_path2.default.join(dependenciesDir, resourceType, dependency.id, `index.md`);
|
|
107
106
|
import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(resourceFile), { recursive: true });
|
|
108
107
|
import_node_fs2.default.writeFileSync(resourceFile, markdown);
|
|
109
108
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types';
|
|
3
|
+
|
|
4
|
+
export type Props = HTMLAttributes<'input'> & {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const { id, name, label, class: className, ...attrs } = Astro.props;
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<label for={id} class="relative block cursor-pointer select-none pl-5">
|
|
14
|
+
<input id={id} name={name} type="checkbox" class="h-0 w-0 cursor-pointer appearance-none group" {...attrs} />
|
|
15
|
+
<span class="text-md text-gray-700">{label}</span>
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
input::before {
|
|
20
|
+
@apply absolute left-0 top-1/2 block h-4 w-4 -translate-y-1/2 rounded-[4px] border border-gray-300;
|
|
21
|
+
content: '';
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
input:checked::before {
|
|
25
|
+
@apply bg-purple-600;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
input:focus::before {
|
|
29
|
+
@apply outline outline-purple-300;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
input:checked::after {
|
|
33
|
+
@apply absolute left-0 top-1/2 block h-4 w-4 -translate-y-1/2 bg-center bg-no-repeat;
|
|
34
|
+
content: '';
|
|
35
|
+
/** inline unicons checkmark SVG */
|
|
36
|
+
background-image: url("data:image/svg+xml;utf-8,<svg width='10' height='8' viewBox='0 0 10 8' fill='none' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M9.04731 1.01279C9.34958 1.296 9.36503 1.77062 9.08182 2.07289L4.19342 7.29032C3.77774 7.73398 3.07363 7.73398 2.65795 7.29032L1.01279 5.53443C0.729585 5.23216 0.745038 4.75754 1.04731 4.47433C1.34958 4.19112 1.8242 4.20658 2.1074 4.50884L3.42568 5.91586L7.98721 1.04731C8.27042 0.745037 8.74504 0.729585 9.04731 1.01279Z' fill='white'/></svg>");
|
|
37
|
+
}
|
|
38
|
+
</style>
|
|
@@ -15,8 +15,9 @@ import type { CollectionEntry } from 'astro:content';
|
|
|
15
15
|
import DebouncedInput from './DebouncedInput';
|
|
16
16
|
|
|
17
17
|
import { getColumnsByCollection } from './columns';
|
|
18
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
18
|
+
import { useEffect, useMemo, useState, type EventHandler } from 'react';
|
|
19
19
|
import type { CollectionTypes } from '@types';
|
|
20
|
+
import { isSameVersion } from '@utils/collections/util';
|
|
20
21
|
|
|
21
22
|
declare module '@tanstack/react-table' {
|
|
22
23
|
// @ts-ignore
|
|
@@ -32,10 +33,12 @@ export const Table = ({
|
|
|
32
33
|
data: initialData,
|
|
33
34
|
collection,
|
|
34
35
|
mode = 'simple',
|
|
36
|
+
checkboxLatestId,
|
|
35
37
|
}: {
|
|
36
38
|
data: CollectionEntry<'events'>[];
|
|
37
39
|
collection: string;
|
|
38
|
-
|
|
40
|
+
checkboxLatestId: string;
|
|
41
|
+
mode?: 'simple' | 'full';
|
|
39
42
|
}) => {
|
|
40
43
|
const [data, _setData] = useState(initialData);
|
|
41
44
|
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
|
|
@@ -48,6 +51,20 @@ export const Table = ({
|
|
|
48
51
|
}
|
|
49
52
|
}, []);
|
|
50
53
|
|
|
54
|
+
const [showOnlyLatest, setShowOnlyLatest] = useState(true);
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const checkbox = document.getElementById(checkboxLatestId);
|
|
58
|
+
|
|
59
|
+
function handleChange(evt: Event) {
|
|
60
|
+
setShowOnlyLatest((evt.target as HTMLInputElement).checked);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
checkbox?.addEventListener('change', handleChange);
|
|
64
|
+
|
|
65
|
+
return () => checkbox?.removeEventListener('change', handleChange);
|
|
66
|
+
}, [checkboxLatestId]);
|
|
67
|
+
|
|
51
68
|
const columns = useMemo(() => getColumnsByCollection(collection), [collection]);
|
|
52
69
|
|
|
53
70
|
const table = useReactTable({
|
|
@@ -63,6 +80,15 @@ export const Table = ({
|
|
|
63
80
|
getPaginationRowModel: getPaginationRowModel(),
|
|
64
81
|
state: {
|
|
65
82
|
columnFilters,
|
|
83
|
+
globalFilter: showOnlyLatest,
|
|
84
|
+
},
|
|
85
|
+
onGlobalFilterChange: setShowOnlyLatest,
|
|
86
|
+
globalFilterFn: (row, _columnId, showOnlyLatest: boolean) => {
|
|
87
|
+
if (showOnlyLatest) {
|
|
88
|
+
return isSameVersion(row.original.data.version, row.original.data.latestVersion);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return true;
|
|
66
92
|
},
|
|
67
93
|
});
|
|
68
94
|
|
|
@@ -11,6 +11,7 @@ import { buildUrl } from '@utils/url-builder';
|
|
|
11
11
|
import { getQueries } from '@utils/queries';
|
|
12
12
|
import { MagnifyingGlassIcon } from '@heroicons/react/20/solid';
|
|
13
13
|
import VerticalSideBarLayout from './VerticalSideBarLayout.astro';
|
|
14
|
+
import Checkbox from '@components/Checkbox.astro';
|
|
14
15
|
|
|
15
16
|
const events = await getEvents();
|
|
16
17
|
const queries = await getQueries();
|
|
@@ -22,6 +23,8 @@ const flows = await getFlows();
|
|
|
22
23
|
const { title, subtitle, data, type } = Astro.props;
|
|
23
24
|
const currentPath = Astro.url.pathname;
|
|
24
25
|
|
|
26
|
+
const checkboxLatestId = 'latest-only';
|
|
27
|
+
|
|
25
28
|
const tabs = [
|
|
26
29
|
{
|
|
27
30
|
label: `Events (${events.length})`,
|
|
@@ -102,17 +105,19 @@ const tabs = [
|
|
|
102
105
|
<!-- Table -->
|
|
103
106
|
<div class="pb-20 ml-6 md:pr-10">
|
|
104
107
|
<div>
|
|
105
|
-
<div class="sm:flex sm:items-
|
|
108
|
+
<div class="sm:flex sm:items-end py-4 pb-4" id="discover-title">
|
|
106
109
|
<div class="sm:flex-auto space-y-2">
|
|
107
110
|
<h1 class="text-4xl font-semibold text-gray-900 capitalize">{title}</h1>
|
|
108
111
|
<p class="text-md text-gray-700">{subtitle}</p>
|
|
109
112
|
</div>
|
|
113
|
+
<div class="p-4 border border-gray-200 rounded-md">
|
|
114
|
+
<Checkbox id={checkboxLatestId} name={checkboxLatestId} label="Show latest version only" checked />
|
|
115
|
+
</div>
|
|
110
116
|
</div>
|
|
111
117
|
<div class="mt-4 flow-root">
|
|
112
118
|
<div class="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
|
|
113
119
|
<div class="inline-block min-w-full align-middle sm:px-6 lg:px-8">
|
|
114
|
-
|
|
115
|
-
<Table data={data} collection={type} client:load />
|
|
120
|
+
<Table checkboxLatestId={checkboxLatestId} data={data} collection={type} client:load />
|
|
116
121
|
</div>
|
|
117
122
|
</div>
|
|
118
123
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readdir, readFile } from 'node:fs/promises';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { formatPatch, structuredPatch } from 'diff';
|
|
4
4
|
import { html, parse } from 'diff2html';
|
|
5
5
|
import { getItemsFromCollectionByIdAndSemverOrLatest } from './util';
|
|
6
6
|
import type { CollectionEntry } from 'astro:content';
|
|
@@ -16,29 +16,8 @@ const FILE_EXTENSIONS_TO_INCLUDE = ['.json', '.avro', '.yaml', '.yml', '.proto',
|
|
|
16
16
|
* @returns A string representing the diff in unified format
|
|
17
17
|
*/
|
|
18
18
|
function generateDiffString(fileName: string, oldStr: string, newStr: string): string {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
// Check if there are any changes
|
|
22
|
-
const hasChanges = diff.some((part) => part.added || part.removed);
|
|
23
|
-
|
|
24
|
-
if (!hasChanges) return '';
|
|
25
|
-
|
|
26
|
-
let diffString = `diff --git a/${fileName} b/${fileName}\n`;
|
|
27
|
-
diffString += `--- a/${fileName}\n`;
|
|
28
|
-
diffString += `+++ b/${fileName}\n`;
|
|
29
|
-
|
|
30
|
-
diff.forEach((part: Change) => {
|
|
31
|
-
const prefix = part.added ? '+' : part.removed ? '-' : ' ';
|
|
32
|
-
const lines = part.value.split('\n');
|
|
33
|
-
// Remove the last element if it's an empty string (which happens if the last line ends with a newline)
|
|
34
|
-
if (lines[lines.length - 1] === '') lines.pop();
|
|
35
|
-
|
|
36
|
-
lines.forEach((line: string) => {
|
|
37
|
-
diffString += `${prefix}${line}\n`;
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return diffString;
|
|
19
|
+
const jsonPatch = structuredPatch(fileName, fileName, oldStr, newStr);
|
|
20
|
+
return jsonPatch.hunks.length == 0 ? '' : formatPatch(jsonPatch);
|
|
42
21
|
}
|
|
43
22
|
|
|
44
23
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollectionTypes } from '@types';
|
|
2
2
|
import type { CollectionEntry } from 'astro:content';
|
|
3
|
-
import { coerce, compare, satisfies as satisfiesRange } from 'semver';
|
|
3
|
+
import { coerce, compare, eq, satisfies as satisfiesRange } from 'semver';
|
|
4
4
|
|
|
5
5
|
export const getPreviousVersion = (version: string, versions: string[]) => {
|
|
6
6
|
const index = versions.indexOf(version);
|
|
@@ -13,6 +13,17 @@ export const getVersions = (data: CollectionEntry<CollectionTypes>[]) => {
|
|
|
13
13
|
return sortStringVersions(versions);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
export function isSameVersion(v1: string | undefined, v2: string | undefined) {
|
|
17
|
+
const semverV1 = coerce(v1);
|
|
18
|
+
const semverV2 = coerce(v2);
|
|
19
|
+
|
|
20
|
+
if (semverV1 != null && semverV2 != null) {
|
|
21
|
+
return eq(semverV1, semverV2);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return v1 === v2;
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
/**
|
|
17
28
|
* Sorts versioned items. Latest version first.
|
|
18
29
|
*/
|
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.19.
|
|
9
|
+
"version": "2.19.4",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@tanstack/react-table": "^8.17.3",
|
|
39
39
|
"@xyflow/react": "^12.3.6",
|
|
40
40
|
"astro": "^5.1.5",
|
|
41
|
-
"astro-expressive-code": "^0.
|
|
41
|
+
"astro-expressive-code": "^0.40.1",
|
|
42
42
|
"astro-pagefind": "^1.6.0",
|
|
43
43
|
"astro-seo": "^0.8.4",
|
|
44
44
|
"axios": "^1.7.7",
|