@eventcatalog/core 2.2.7 → 2.3.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/.github/workflows/verify-build.yml +2 -0
- package/CHANGELOG.md +12 -0
- package/README.md +11 -7
- package/package.json +6 -5
- package/scripts/catalog-to-astro-content-directory.js +20 -0
- package/scripts/ci/test.js +24 -0
- package/scripts/watcher.js +12 -4
- package/tsconfig.json +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @eventcatalog/core
|
|
2
2
|
|
|
3
|
+
## 2.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0de35d9: fix(core): vitest no longer added to the npm package
|
|
8
|
+
|
|
9
|
+
## 2.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- d662cb1: feat(core): added custom component support for eventcatalog
|
|
14
|
+
|
|
3
15
|
## 2.2.7
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
<h1>📖 EventCatalog</h1>
|
|
4
4
|
|
|
5
|
+
[![MIT License][license-badge]][license]
|
|
6
|
+
[![PRs Welcome][prs-badge]][prs]
|
|
7
|
+
<img src="https://img.shields.io/github/actions/workflow/status/event-catalog/eventcatalog/verify-build.yml"/>
|
|
8
|
+
[![Star on GitHub][github-star-badge]][github-star]
|
|
9
|
+
|
|
10
|
+
|
|
5
11
|
|
|
6
12
|
<!-- [![Star on GitHub][github-star-badge]][github-star] -->
|
|
7
13
|
<!-- <h3>Bring discoverability to your -->
|
|
@@ -10,9 +16,7 @@
|
|
|
10
16
|
|
|
11
17
|
<!-- [![MIT License][license-badge]][license] -->
|
|
12
18
|
<!-- [![PRs Welcome][prs-badge]][prs] -->
|
|
13
|
-
|
|
14
|
-
[](#contributors-)
|
|
15
|
-
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
19
|
+
|
|
16
20
|
|
|
17
21
|
<!-- [![Watch on GitHub][github-watch-badge]][github-watch] -->
|
|
18
22
|
<!-- [![Star on GitHub][github-star-badge]][github-star] -->
|
|
@@ -23,9 +27,9 @@
|
|
|
23
27
|
|
|
24
28
|
<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>
|
|
25
29
|
|
|
26
|
-
|
|
27
|
-
[](#contributors-)
|
|
32
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
29
33
|
|
|
30
34
|
[Read the Docs](https://eventcatalog.dev/) | [Edit the Docs](https://github.com/event-catalog/docs) | [View Demo](https://demo.eventcatalog.dev/docs)
|
|
31
35
|
|
|
@@ -216,4 +220,4 @@ You can find more [details on our website](https://eventcatalog.dev/support).
|
|
|
216
220
|
|
|
217
221
|
# License
|
|
218
222
|
|
|
219
|
-
MIT.
|
|
223
|
+
MIT.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eventcatalog/core",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.3.1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"dev:local": "concurrently \"node scripts/watcher.js\" \"astro dev\"",
|
|
14
14
|
"build:bin": "tsup",
|
|
15
15
|
"prepublishOnly": "npm run build:bin",
|
|
16
|
-
"test": "
|
|
16
|
+
"test": "vitest --config vitest.config.ts",
|
|
17
|
+
"test:ci": "node scripts/ci/test.js",
|
|
17
18
|
"start": "astro dev",
|
|
18
19
|
"build": "npm run scripts:hydrate-content && astro check --minimumSeverity error && astro build",
|
|
19
20
|
"build:cd": "node scripts/build-ci.js",
|
|
@@ -63,16 +64,16 @@
|
|
|
63
64
|
},
|
|
64
65
|
"devDependencies": {
|
|
65
66
|
"@parcel/watcher": "^2.4.1",
|
|
66
|
-
"@types/jest": "^29.5.12",
|
|
67
67
|
"@types/react": "^18.3.3",
|
|
68
68
|
"@types/react-dom": "^18.3.0",
|
|
69
69
|
"commander": "^12.1.0",
|
|
70
70
|
"concurrently": "^8.2.2",
|
|
71
71
|
"cross-env": "^7.0.3",
|
|
72
|
-
"jest": "^29.7.0",
|
|
73
72
|
"prettier": "^3.3.3",
|
|
74
73
|
"prettier-plugin-astro": "^0.14.1",
|
|
75
74
|
"rimraf": "^5.0.7",
|
|
76
|
-
"tsup": "^8.1.0"
|
|
75
|
+
"tsup": "^8.1.0",
|
|
76
|
+
"vite-tsconfig-paths": "^4.3.2",
|
|
77
|
+
"vitest": "^2.0.5"
|
|
77
78
|
}
|
|
78
79
|
}
|
|
@@ -97,6 +97,23 @@ const copyFiles = async ({ source, target, catalogFilesDir, pathToMarkdownFiles,
|
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
+
const copyComponents = async ({ source, target }) => {
|
|
101
|
+
const componentsDir = path.join(source, 'components');
|
|
102
|
+
const componentsTarget = path.join(target, '../custom-defined-components');
|
|
103
|
+
|
|
104
|
+
// Clear the component directory before we copy files over
|
|
105
|
+
if (fs.existsSync(componentsTarget)) {
|
|
106
|
+
await fs.rmSync(componentsTarget, { recursive: true });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!fs.existsSync(componentsDir) || !fs.statSync(componentsDir).isDirectory()) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Copy files
|
|
114
|
+
await fs.cpSync(componentsDir, componentsTarget, { recursive: true });
|
|
115
|
+
};
|
|
116
|
+
|
|
100
117
|
export const catalogToAstro = async (source, astroContentDir, catalogFilesDir) => {
|
|
101
118
|
// Config file
|
|
102
119
|
const astroConfigFile = fs.readFileSync(path.join(astroContentDir, 'config.ts'));
|
|
@@ -211,6 +228,9 @@ export const catalogToAstro = async (source, astroContentDir, catalogFilesDir) =
|
|
|
211
228
|
pathToAllFiles: [],
|
|
212
229
|
type: 'pages',
|
|
213
230
|
});
|
|
231
|
+
|
|
232
|
+
// Copy the components if they are defined
|
|
233
|
+
await copyComponents({ source, target: astroContentDir, catalogFilesDir });
|
|
214
234
|
};
|
|
215
235
|
|
|
216
236
|
if (process.env.NODE_ENV !== 'test') {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Script for GitHub Actions
|
|
5
|
+
* Sets up the project with required files
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import { execSync } from 'node:child_process';
|
|
11
|
+
|
|
12
|
+
const args = process.argv.slice(2);
|
|
13
|
+
const catalog = args[0] || 'default';
|
|
14
|
+
|
|
15
|
+
const catalogDir = join(process.cwd());
|
|
16
|
+
const projectDIR = join(process.cwd(), `/examples/${catalog}`);
|
|
17
|
+
|
|
18
|
+
fs.copyFileSync(join(projectDIR, 'eventcatalog.config.js'), join(catalogDir, 'eventcatalog.config.js'));
|
|
19
|
+
fs.copyFileSync(join(projectDIR, 'eventcatalog.styles.css'), join(catalogDir, 'eventcatalog.styles.css'));
|
|
20
|
+
|
|
21
|
+
execSync(`cross-env NODE_ENV=test PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npm run test`, {
|
|
22
|
+
cwd: catalogDir,
|
|
23
|
+
stdio: 'inherit',
|
|
24
|
+
});
|
package/scripts/watcher.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import watcher from '@parcel/watcher';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
+
import os from 'os';
|
|
5
6
|
|
|
6
7
|
// Where the users project is located
|
|
7
8
|
const projectDirectory = process.env.PROJECT_DIR || process.cwd();
|
|
@@ -10,7 +11,7 @@ const catalogDirectory = process.env.CATALOG_DIR;
|
|
|
10
11
|
|
|
11
12
|
const contentPath = path.join(catalogDirectory, 'src', 'content');
|
|
12
13
|
|
|
13
|
-
const watchList = ['domains', 'commands', 'events', 'services', 'teams', 'users', 'pages'];
|
|
14
|
+
const watchList = ['domains', 'commands', 'events', 'services', 'teams', 'users', 'pages', 'components'];
|
|
14
15
|
// const absoluteWatchList = watchList.map((item) => path.join(projectDirectory, item));
|
|
15
16
|
|
|
16
17
|
// confirm folders exist before watching them
|
|
@@ -35,20 +36,27 @@ for (let item of [...verifiedWatchList]) {
|
|
|
35
36
|
// Check if changlogs, they need to go into their own content folder
|
|
36
37
|
if (file.includes('changelog.md')) {
|
|
37
38
|
newPath = newPath.replace('src/content', 'src/content/changelogs');
|
|
38
|
-
|
|
39
39
|
if (os.platform() == 'win32') {
|
|
40
40
|
newPath = newPath.replace('src\\content', 'src\\content\\changelogs');
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
// Check if its a component, need to move to the correct location
|
|
45
|
+
if (newPath.includes('components')) {
|
|
46
|
+
newPath = newPath.replace('src/content/components', 'src/custom-defined-components');
|
|
47
|
+
if (os.platform() == 'win32') {
|
|
48
|
+
newPath = newPath.replace('src\\content\\components', 'src\\custom-defined-components');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
44
52
|
// If config files have changes
|
|
45
53
|
if (eventPath.includes('eventcatalog.config.js') || eventPath.includes('eventcatalog.styles.css')) {
|
|
46
54
|
fs.cpSync(eventPath, path.join(catalogDirectory, file));
|
|
47
55
|
return;
|
|
48
56
|
}
|
|
49
57
|
|
|
50
|
-
// If markdown files copy file over to the required location
|
|
51
|
-
if (eventPath.endsWith('.md') && type === 'update') {
|
|
58
|
+
// If markdown files or astro files copy file over to the required location
|
|
59
|
+
if ((eventPath.endsWith('.md') || eventPath.endsWith('.astro')) && type === 'update') {
|
|
52
60
|
fs.cpSync(eventPath, newPath);
|
|
53
61
|
}
|
|
54
62
|
|
package/tsconfig.json
CHANGED
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
"@config": ["./eventcatalog.config.js"],
|
|
8
8
|
"@eventcatalog": ["src/utils/config/catalog.ts"],
|
|
9
9
|
"@components/*": ["src/components/*"],
|
|
10
|
+
"@catalog/components/*": ["src/custom-defined-components/*"],
|
|
10
11
|
"@types": ["src/types/index.ts"],
|
|
11
12
|
"@utils/*": ["src/utils/*"],
|
|
12
13
|
"@layouts/*": ["src/layouts/*"]
|
|
13
14
|
},
|
|
14
15
|
"jsx": "react-jsx",
|
|
15
|
-
"jsxImportSource": "react"
|
|
16
|
+
"jsxImportSource": "react",
|
|
17
|
+
"types": ["vitest/globals"]
|
|
16
18
|
}
|
|
17
19
|
}
|