@eventcatalog/core 2.3.0 → 2.3.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @eventcatalog/core
2
2
 
3
+ ## 2.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 90c9219: feat(core): added page redirect to latest version when going to /{resource/{id}
8
+
9
+ ## 2.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 0de35d9: fix(core): vitest no longer added to the npm package
14
+
3
15
  ## 2.3.0
4
16
 
5
17
  ### Minor Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eventcatalog/core",
3
3
  "type": "module",
4
- "version": "2.3.0",
4
+ "version": "2.3.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -0,0 +1,46 @@
1
+ ---
2
+ import Seo from '@components/Seo.astro';
3
+ import { buildUrl } from '@utils/url-builder';
4
+ import { getEvents } from '@utils/events';
5
+ import { getCommands } from '@utils/commands';
6
+ import { getServices } from '@utils/services/services';
7
+ import { getDomains } from '@utils/domains/domains';
8
+ import type { CollectionEntry } from 'astro:content';
9
+ import type { CollectionTypes } from '@types';
10
+
11
+ export async function getStaticPaths() {
12
+ const [events, commands, services, domains] = await Promise.all([getEvents(), getCommands(), getServices(), getDomains()]);
13
+
14
+ const buildPages = (collection: CollectionEntry<CollectionTypes>[]) => {
15
+ return collection.map((item) => ({
16
+ params: {
17
+ type: item.collection,
18
+ id: item.data.id,
19
+ },
20
+ props: {
21
+ type: item.collection,
22
+ ...item,
23
+ },
24
+ }));
25
+ };
26
+
27
+ return [...buildPages(domains), ...buildPages(events), ...buildPages(services), ...buildPages(commands)];
28
+ }
29
+
30
+ const props = Astro.props;
31
+ const pageTitle = `${props.collection} | ${props.data.name}`.replace(/^\w/, (c) => c.toUpperCase());
32
+
33
+ const { pathname } = Astro.url;
34
+ const redirectUrl = buildUrl(pathname + '/' + props.data.latestVersion);
35
+ ---
36
+
37
+ <!doctype html>
38
+ <html lang="en">
39
+ <head>
40
+ <meta http-equiv="refresh" content={`0; url=${redirectUrl}`} />
41
+ <Seo title={`EventCatalog | ${pageTitle}`} ogTitle={pageTitle} />
42
+ </head>
43
+ <body>
44
+ <p>You are being redirected to <a href={redirectUrl}>{redirectUrl}</a></p>
45
+ </body>
46
+ </html>
package/vitest.config.ts DELETED
@@ -1,10 +0,0 @@
1
- /// <reference types="vitest" />
2
- import { getViteConfig } from 'astro/config';
3
- import tsConfigPaths from 'vite-tsconfig-paths';
4
-
5
- export default getViteConfig({
6
- plugins: [tsConfigPaths()],
7
- test: {
8
- globals: true,
9
- },
10
- });