@eventcatalog/core 2.21.0 → 2.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-7R3BVREH.js → chunk-4CHHTLUN.js} +1 -1
- package/dist/{chunk-5S57Z3LK.js → chunk-6UDSGYH7.js} +1 -1
- package/dist/{chunk-BPHBVY4J.js → chunk-KC3LZQXV.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +3 -3
- package/eventcatalog/public/rss.xsl +5 -2
- package/eventcatalog/src/pages/rss/[resource]/rss.xml.js +23 -6
- package/eventcatalog/src/utils/git.ts +58 -0
- package/package.json +3 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-4CHHTLUN.js";
|
|
4
|
+
import "../chunk-6UDSGYH7.js";
|
|
5
|
+
import "../chunk-KC3LZQXV.js";
|
|
6
6
|
import "../chunk-E7TXTI7G.js";
|
|
7
7
|
export {
|
|
8
8
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
package/dist/eventcatalog.js
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-FSKZU5FH.js";
|
|
4
4
|
import {
|
|
5
5
|
log_build_default
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-4CHHTLUN.js";
|
|
7
|
+
import "./chunk-6UDSGYH7.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-KC3LZQXV.js";
|
|
14
14
|
import {
|
|
15
15
|
generate
|
|
16
16
|
} from "./chunk-YEQVKHST.js";
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<strong>This is a web feed,</strong> also known as an RSS feed. <strong>Subscribe</strong> by copying the URL from the address bar into your newsreader.
|
|
18
18
|
</p>
|
|
19
19
|
<!-- <p class="text-gray">
|
|
20
|
-
Visit <a href="https://aboutfeeds.com">About Feeds</a> to get started with newsreaders and subscribing. It
|
|
20
|
+
Visit <a href="https://aboutfeeds.com">About Feeds</a> to get started with newsreaders and subscribing. It's free.
|
|
21
21
|
</p> -->
|
|
22
22
|
</nav>
|
|
23
23
|
<div class="container-md px-3 py-3 markdown-body">
|
|
@@ -50,7 +50,10 @@
|
|
|
50
50
|
<xsl:value-of select="description"/>
|
|
51
51
|
</p>
|
|
52
52
|
<small class="text-gray">
|
|
53
|
-
|
|
53
|
+
Last updated on: <xsl:value-of select="pubDate" />
|
|
54
|
+
<xsl:if test="author">
|
|
55
|
+
by <xsl:value-of select="author" />
|
|
56
|
+
</xsl:if>
|
|
54
57
|
</small>
|
|
55
58
|
</div>
|
|
56
59
|
</xsl:for-each>
|
|
@@ -3,11 +3,12 @@ import { getCollection } from 'astro:content';
|
|
|
3
3
|
import { statSync } from 'fs';
|
|
4
4
|
import { buildUrl } from '@utils/url-builder';
|
|
5
5
|
import config from '@config';
|
|
6
|
+
import { getGitHistory } from '@utils/git';
|
|
6
7
|
|
|
7
8
|
const isRSSEnabled = config.rss?.enabled;
|
|
8
9
|
const rssLimit = config.rss?.limit || 15;
|
|
9
10
|
|
|
10
|
-
const collections = ['events', 'services', 'domains', 'commands', 'flows', 'all'];
|
|
11
|
+
const collections = ['events', 'services', 'domains', 'commands', 'queries', 'flows', 'all'];
|
|
11
12
|
|
|
12
13
|
export function getStaticPaths() {
|
|
13
14
|
return collections.map((collection) => ({
|
|
@@ -34,17 +35,32 @@ export async function GET(context) {
|
|
|
34
35
|
items = await getCollection(collection);
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
// console.log(events);
|
|
38
|
-
|
|
39
38
|
const rssItems = items
|
|
40
39
|
.map((event) => {
|
|
41
40
|
const pathToFile = event.data.pathToFile;
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
let modifiedDate;
|
|
43
|
+
let modifiedAuthor;
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const gitHistory = getGitHistory(pathToFile, {
|
|
47
|
+
includeAuthor: true,
|
|
48
|
+
age: 'newest',
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
modifiedDate = gitHistory.date;
|
|
52
|
+
modifiedAuthor = gitHistory.author;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
// Failed to get git history, use the file stats
|
|
55
|
+
const stats = statSync(pathToFile);
|
|
56
|
+
modifiedDate = stats.mtime;
|
|
57
|
+
modifiedAuthor = undefined;
|
|
58
|
+
}
|
|
59
|
+
|
|
45
60
|
return {
|
|
46
61
|
...event,
|
|
47
|
-
modifiedDate:
|
|
62
|
+
modifiedDate: modifiedDate,
|
|
63
|
+
modifiedAuthor: modifiedAuthor,
|
|
48
64
|
};
|
|
49
65
|
})
|
|
50
66
|
.sort((a, b) => b.modifiedDate - a.modifiedDate) // Sort in descending order (newest first)
|
|
@@ -71,6 +87,7 @@ export async function GET(context) {
|
|
|
71
87
|
description: event.data.summary,
|
|
72
88
|
// Optional: Include modified date in the RSS feed
|
|
73
89
|
lastBuildDate: items.find((item) => item.id === event.id)?.modifiedDate,
|
|
90
|
+
author: event.modifiedAuthor,
|
|
74
91
|
// categories: event.data.badges,
|
|
75
92
|
})),
|
|
76
93
|
// (optional) inject custom xml
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import shell from 'shelljs';
|
|
2
|
+
|
|
3
|
+
export function hasGit() {
|
|
4
|
+
return !!shell.which('git');
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export function getGitHistory(
|
|
8
|
+
filePath: string,
|
|
9
|
+
{
|
|
10
|
+
includeAuthor = true,
|
|
11
|
+
age = 'newest',
|
|
12
|
+
}: {
|
|
13
|
+
includeAuthor?: boolean;
|
|
14
|
+
age?: 'newest' | 'oldest';
|
|
15
|
+
maxCount?: number;
|
|
16
|
+
}
|
|
17
|
+
): {
|
|
18
|
+
timestamp: number;
|
|
19
|
+
date: Date;
|
|
20
|
+
author: string | undefined;
|
|
21
|
+
} {
|
|
22
|
+
if (!hasGit()) {
|
|
23
|
+
throw new Error('Git is not installed');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const resultFormat = includeAuthor ? 'RESULT:%ct,%an' : 'RESULT:%ct';
|
|
27
|
+
|
|
28
|
+
const args = [`--format=${resultFormat}`, '--max-count=1', age === 'oldest' ? '--follow --diff-filter=A' : undefined]
|
|
29
|
+
.filter(Boolean)
|
|
30
|
+
.join(' ');
|
|
31
|
+
|
|
32
|
+
const command = `git -c log.showSignature=false log ${args} -- "${filePath}"`;
|
|
33
|
+
|
|
34
|
+
const result = shell.exec(command, { silent: true });
|
|
35
|
+
|
|
36
|
+
const regex = includeAuthor
|
|
37
|
+
? /(?:^|\n)RESULT:(?<timestamp>\d+),(?<author>.+)(?:$|\n)/
|
|
38
|
+
: /(?:^|\n)RESULT:(?<timestamp>\d+)(?:$|\n)/;
|
|
39
|
+
|
|
40
|
+
const output = result.stdout.trim();
|
|
41
|
+
|
|
42
|
+
const match = output.match(regex);
|
|
43
|
+
|
|
44
|
+
if (!match) {
|
|
45
|
+
throw new Error(`Failed to retrieve the git history for file "${filePath}" with unexpected output: ${output}`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const timestampInSeconds = Number(match.groups?.timestamp);
|
|
49
|
+
const timestamp = timestampInSeconds * 1_000;
|
|
50
|
+
const date = new Date(timestamp);
|
|
51
|
+
const author = match.groups?.author;
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
timestamp,
|
|
55
|
+
date,
|
|
56
|
+
author,
|
|
57
|
+
};
|
|
58
|
+
}
|
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.21.
|
|
9
|
+
"version": "2.21.1",
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"remark-gfm": "^3.0.1",
|
|
68
68
|
"rimraf": "^5.0.7",
|
|
69
69
|
"semver": "7.6.3",
|
|
70
|
+
"shelljs": "^0.8.5",
|
|
70
71
|
"tailwindcss": "^3.4.3",
|
|
71
72
|
"typescript": "^5.4.5",
|
|
72
73
|
"unist-util-visit": "^5.0.0",
|
|
@@ -85,6 +86,7 @@
|
|
|
85
86
|
"@types/react": "^18.3.3",
|
|
86
87
|
"@types/react-dom": "^18.3.0",
|
|
87
88
|
"@types/semver": "^7.5.8",
|
|
89
|
+
"@types/shelljs": "^0.8.15",
|
|
88
90
|
"prettier": "^3.3.3",
|
|
89
91
|
"prettier-plugin-astro": "^0.14.1",
|
|
90
92
|
"tsup": "^8.1.0",
|