@eventcatalog/core 2.2.4 → 2.2.6

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.
@@ -11,7 +11,10 @@ jobs:
11
11
  build:
12
12
  name: Verify Build
13
13
  timeout-minutes: 30
14
- runs-on: ubuntu-latest
14
+ strategy:
15
+ matrix:
16
+ os: [ubuntu-latest, windows-latest]
17
+ runs-on: ${{ matrix.os }}
15
18
  steps:
16
19
  - uses: actions/checkout@v4
17
20
  - uses: actions/setup-node@v4
@@ -19,9 +22,5 @@ jobs:
19
22
  node-version: '20.x'
20
23
  - name: Installation
21
24
  run: npm i
22
- - name: Log
23
- run: ls
24
- - name: Log2
25
- run: pwd
26
25
  - name: Build
27
26
  run: npm run verify-build:catalog
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @eventcatalog/core
2
2
 
3
+ ## 2.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 50a43e0: core(fix): removed forward slash before # to prevent double trailing slash
8
+ - 8104078: chore(core): added windows tests and fixed watcher to work with changelogs files on windows
9
+
10
+ ## 2.2.5
11
+
12
+ ### Patch Changes
13
+
14
+ - edd58a6: fix(core): enforce the leading slash to the logo
15
+ - 269aef9: fix(core): fixed url paths for EC assets
16
+
3
17
  ## 2.2.4
4
18
 
5
19
  ### Patch Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eventcatalog/core",
3
3
  "type": "module",
4
- "version": "2.2.4",
4
+ "version": "2.2.6",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -16,7 +16,7 @@
16
16
  "test": "jest --config=$(pwd)/../../jest.config.js",
17
17
  "start": "astro dev",
18
18
  "build": "npm run scripts:hydrate-content && astro check --minimumSeverity error && astro build",
19
- "build:cd": "node scripts/build-ci.js && astro check --minimumSeverity error && astro build",
19
+ "build:cd": "node scripts/build-ci.js",
20
20
  "preview": "astro preview",
21
21
  "astro": "astro",
22
22
  "scripts:hydrate-content": "node scripts/catalog-to-astro-content-directory.js",
@@ -16,7 +16,7 @@ fs.copyFileSync(join(projectDIR, 'eventcatalog.config.js'), join(catalogDir, 'ev
16
16
 
17
17
  fs.copyFileSync(join(projectDIR, 'eventcatalog.styles.css'), join(catalogDir, 'eventcatalog.styles.css'));
18
18
 
19
- execSync(`cross-env NODE_ENV=CI PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run scripts:hydrate-content`, {
19
+ execSync(`cross-env NODE_ENV=CI PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run build`, {
20
20
  cwd: catalogDir,
21
21
  stdio: 'inherit',
22
22
  });
@@ -40,17 +40,19 @@ const copyFiles = async ({ source, target, catalogFilesDir, pathToMarkdownFiles,
40
40
 
41
41
  // Copy markdown files into the astro content (collection) folder
42
42
  for (const file of markdownFiles) {
43
- const targetPath = getTargetPath(source, target, type, file);
43
+ let fileTarget = target;
44
+
45
+ // If they are change logs they need to go into their own content folder
46
+ if (file.includes('changelog.md')) {
47
+ fileTarget = path.join(target, 'changelogs');
48
+ }
49
+
50
+ const targetPath = getTargetPath(source, fileTarget, type, file);
44
51
 
45
52
  //ensure the directory exists
46
53
  ensureDirSync(path.dirname(targetPath));
47
54
 
48
- if (file.includes('changelog.md')) {
49
- const target = targetPath.replace('/content', '/content/changelogs');
50
- fs.cpSync(file, target.replace('changelog.md', 'changelog.mdx'));
51
- } else {
52
- fs.cpSync(file, targetPath.replace('index.md', 'index.mdx').replace('changelog.md', 'changelog.mdx'));
53
- }
55
+ fs.cpSync(file, targetPath.replace('index.md', 'index.mdx').replace('changelog.md', 'changelog.mdx'));
54
56
  }
55
57
 
56
58
  // Copy all other files (non markdown) files into catalog-files directory (non collection)
@@ -35,6 +35,10 @@ for (let item of [...verifiedWatchList]) {
35
35
  // Check if changlogs, they need to go into their own content folder
36
36
  if (file.includes('changelog.md')) {
37
37
  newPath = newPath.replace('src/content', 'src/content/changelogs');
38
+
39
+ if (os.platform() == 'win32') {
40
+ newPath = newPath.replace('src\\content', 'src\\content\\changelogs');
41
+ }
38
42
  }
39
43
 
40
44
  // If config files have changes
@@ -95,7 +95,7 @@ const currentPath = Astro.url.pathname;
95
95
  {item.items.map((heading: any) => {
96
96
  return (
97
97
  <li class="text-xs">
98
- <a href={`${item.href}/#${heading.slug}`}>{heading.text}</a>
98
+ <a href={`${item.href}#${heading.slug}`}>{heading.text}</a>
99
99
  </li>
100
100
  );
101
101
  })}
@@ -21,7 +21,7 @@ const navItems = [
21
21
  ];
22
22
 
23
23
  const logo = {
24
- src: catalog?.logo?.src || '/logo.png',
24
+ src: ('/' + (catalog?.logo?.src || 'logo.png')).replace(/^\/+/, '/'), // replace the leading slashes with a single one
25
25
  alt: catalog?.logo?.alt || 'Event Catalog',
26
26
  text: catalog?.logo?.text || "EventCatalog"
27
27
  }
@@ -31,7 +31,7 @@ if (typeof _image === 'string') {
31
31
  <meta charset="UTF-8" />
32
32
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
33
33
  <meta name="viewport" content="width=device-width" />
34
- <link rel="icon" type="image/svg+xml" href={buildUrl('/favicon.ico')} />
34
+ <link rel="icon" type="image/svg+xml" href={buildUrl('/favicon.ico', true)} />
35
35
 
36
36
  <SEO
37
37
  title={title}
@@ -59,7 +59,7 @@ const schemaURL = path.join(publicPath, schemaFilePath || '')
59
59
  {
60
60
  message?.data?.schemaPath && (
61
61
  <a
62
- href={schemaURL}
62
+ href={buildUrl(schemaURL, true)}
63
63
  download={`${message.data.name}(${message.data.version})-${schemaFilePath}`}
64
64
  class="hidden w-full md:inline-flex h-10 justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-200 bg-gray-800 hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-900"
65
65
  >
@@ -60,7 +60,7 @@ const schemaURL = join(publicPath, schemaFilePath || '')
60
60
  {
61
61
  service?.data?.schemaPath && (
62
62
  <a
63
- href={schemaURL}
63
+ href={buildUrl(schemaURL, true)}
64
64
  download={`${service.data.name}(${service.data.version})-${schemaFilePath}`}
65
65
  class="hidden w-full md:inline-flex h-10 justify-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-200 bg-gray-800 hover:bg-gray-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-900"
66
66
  >
@@ -15,7 +15,7 @@ import { buildUrl } from '@utils/url-builder';
15
15
  <meta charset="UTF-8" />
16
16
  <meta name="description" content="Astro description" />
17
17
  <meta name="viewport" content="width=device-width" />
18
- <link rel="icon" type="image/svg+xml" href={buildUrl('/favicon.ico')} />
18
+ <link rel="icon" type="image/svg+xml" href={buildUrl('/favicon.ico', true)} />
19
19
  <meta name="generator" content={Astro.generator} />
20
20
  <title>EventCatalog</title>
21
21
  </head>
@@ -1,11 +1,13 @@
1
1
  ---
2
+ import { buildUrl } from "@utils/url-builder"
3
+
2
4
  ---
3
5
 
4
6
  <footer class="py-4 space-y-8 border-t border-gray-300">
5
7
  <div class="flex justify-between items-center py-8 text-gray-500 text-sm font-light">
6
8
  <div class="flex space-x-5">
7
- <a href="https://github.com/event-catalog/eventcatalog" target="_blank"><svg class="w-5 h-5 bg-gray-400 hover:bg-purple-500 dark:hover:bg-gray-400" style="mask-image: url(&quot;/icons/github.svg&quot;); mask-repeat: no-repeat; mask-position: center center;"></svg></a>
8
- <a href="https://x.com/event_catalog" target="_blank"><span class="sr-only">x</span><svg class="w-5 h-5 bg-gray-400 hover:bg-purple-500 dark:hover:bg-gray-400" style="mask-image: url(&quot;/icons/x-twitter.svg&quot;); mask-repeat: no-repeat; mask-position: center center;"></svg></a>
9
+ <a href="https://github.com/event-catalog/eventcatalog" target="_blank"><svg class="w-5 h-5 bg-gray-400 hover:bg-purple-500 dark:hover:bg-gray-400" style={`mask-image: url("${buildUrl('/icons/github.svg', true)}"); mask-repeat: no-repeat; mask-position: center center;`}></svg></a>
10
+ <a href="https://x.com/event_catalog" target="_blank"><span class="sr-only">x</span><svg class="w-5 h-5 bg-gray-400 hover:bg-purple-500 dark:hover:bg-gray-400" style={`mask-image: url("${buildUrl('/icons/x-twitter.svg', true)}"); mask-repeat: no-repeat; mask-position: center center;`}></svg></a>
9
11
  </div>
10
12
  <a target="_blank" class="hover:text-purple-500 hover:underline text-gray-400 font-light not-prose" href="https://eventcatalog.dev">Powered by EventCatalog</a>
11
13
  </div>
@@ -133,7 +133,7 @@ const badges = [
133
133
  <div>
134
134
  <!-- @ts-ignore -->
135
135
  <SchemaViewer id={props.data.id} catalog={props.catalog} />
136
- <NodeGraph id={props.data.id} collection={props.collection} version={props.data.version} mode="simple" href={{ label: 'Open in Visualiser', url: `/visualiser/${props.collection}/${props.data.id}/${props.data.version}`}} />
136
+ <NodeGraph id={props.data.id} collection={props.collection} version={props.data.version} mode="simple" href={{ label: 'Open in Visualiser', url: buildUrl(`/visualiser/${props.collection}/${props.data.id}/${props.data.version}`)}} />
137
137
  </div>
138
138
  <Footer />
139
139
  </main>
@@ -10,6 +10,7 @@ import { getDomains } from '@utils/domains/domains';
10
10
  import type { CollectionTypes } from '@types';
11
11
  import PlainPage from '@layouts/PlainPage.astro';
12
12
  import { DocumentMinusIcon } from '@heroicons/react/24/outline';
13
+ import { buildUrl } from '@utils/url-builder';
13
14
 
14
15
  export async function getStaticPaths() {
15
16
  const events = await getEvents();
@@ -42,22 +43,18 @@ const fileExists = fs.existsSync(pathOnDisk);
42
43
  ---
43
44
 
44
45
  <PlainPage title="OpenAPI Spec">
45
- <!-- {fileExists && <div>Here</div>} -->
46
46
  {
47
- !fileExists && (
47
+ !fileExists ? (
48
48
  <div class="text-center h-screen flex flex-col justify-center ">
49
- <DocumentMinusIcon className="mx-auto h-12 w-12 text-gray-400" />
49
+ <DocumentMinusIcon className="mx-auto h-12 w-12 text-gray-400" />
50
50
  <h3 class="mt-2 text-sm font-semibold text-gray-900">No OpenAPI spec file found</h3>
51
- <p class="mt-1 text-xs text-gray-400">Could not find OpenAPI file for {data.name} in {`/${catalog.path}`}</p>
52
-
51
+ <p class="mt-1 text-xs text-gray-400">
52
+ Could not find OpenAPI file for {data.name} in {`/${catalog.path}`}
53
+ </p>
53
54
  </div>
54
- )
55
- }
56
-
57
- {
58
- fileExists && (
55
+ ) : (
59
56
  <rapi-doc
60
- spec-url={pathToSpec}
57
+ spec-url={buildUrl(pathToSpec, true)}
61
58
  render-style="table"
62
59
  show-header="false"
63
60
  allow-authentication="false"