@eventcatalog/core 2.13.4 → 2.14.0
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/test-e2e.yml +19 -21
- package/CHANGELOG.md +6 -0
- package/bin/dist/eventcatalog.cjs +478 -26
- package/bin/dist/eventcatalog.js +478 -26
- package/package.json +4 -6
- package/scripts/analytics/analytics.js +2 -16
- package/scripts/analytics/log-build.js +8 -4
- package/scripts/build-ci.js +14 -7
- package/scripts/catalog-to-astro-content-directory.js +13 -10
- package/scripts/constants.ts +3 -0
- package/scripts/generate.js +1 -4
- package/scripts/start-catalog-locally.js +19 -11
- package/scripts/watcher.js +0 -17
- /package/{scripts/default-files-for-collections → default-files-for-collections}/changelogs.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/channels.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/commands.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/domains.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/events.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/flows.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/pages.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/queries.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/services.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/teams.md +0 -0
- /package/{scripts/default-files-for-collections → default-files-for-collections}/users.md +0 -0
|
@@ -7,7 +7,18 @@ import { verifyRequiredFieldsAreInCatalogConfigFile, addPropertyToFrontMatter }
|
|
|
7
7
|
import { mapCatalogToAstro } from './map-catalog-to-astro.js';
|
|
8
8
|
|
|
9
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const
|
|
10
|
+
const rootPkg = path.resolve(
|
|
11
|
+
path.dirname(__filename),
|
|
12
|
+
/**
|
|
13
|
+
* TODO: fix me =0
|
|
14
|
+
*
|
|
15
|
+
* The following is a workaround until organize the structure to have the correct path
|
|
16
|
+
* for any value of NODE_ENV
|
|
17
|
+
*
|
|
18
|
+
* @author carlosallexandre
|
|
19
|
+
*/
|
|
20
|
+
process.env.NODE_ENV === 'test' ? '../' : '../../'
|
|
21
|
+
);
|
|
11
22
|
|
|
12
23
|
const copyFiles = async (source, target) => {
|
|
13
24
|
const files = await glob(path.join(source, '**'), {
|
|
@@ -67,7 +78,7 @@ const ensureAstroCollectionNotEmpty = async (astroDir) => {
|
|
|
67
78
|
}
|
|
68
79
|
|
|
69
80
|
// Hydrate empty collections
|
|
70
|
-
const defaultCollectionFilesDir = path.join(
|
|
81
|
+
const defaultCollectionFilesDir = path.join(rootPkg, 'default-files-for-collections');
|
|
71
82
|
for (const collection of emptyCollections) {
|
|
72
83
|
const defaultFile = path.join(defaultCollectionFilesDir, `${collection}.md`);
|
|
73
84
|
const targetDir = path.join(astroDir, 'src/content/', collection);
|
|
@@ -102,11 +113,3 @@ export const catalogToAstro = async (source, astroDir) => {
|
|
|
102
113
|
// insert empty one that is filtered out
|
|
103
114
|
await ensureAstroCollectionNotEmpty(astroDir);
|
|
104
115
|
};
|
|
105
|
-
|
|
106
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
107
|
-
// // Get the project directory of the source
|
|
108
|
-
const source = process.env.PROJECT_DIR;
|
|
109
|
-
const astroDir = process.env.CATALOG_DIR;
|
|
110
|
-
|
|
111
|
-
catalogToAstro(source, astroDir);
|
|
112
|
-
}
|
package/scripts/generate.js
CHANGED
|
@@ -17,8 +17,7 @@ function getDefaultExport(importedModule) {
|
|
|
17
17
|
return importedModule;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
const generate = async () => {
|
|
21
|
-
const PROJECT_DIRECTORY = process.env.PROJECT_DIR;
|
|
20
|
+
export const generate = async (PROJECT_DIRECTORY) => {
|
|
22
21
|
try {
|
|
23
22
|
const config = await getEventCatalogConfigFile(PROJECT_DIRECTORY);
|
|
24
23
|
|
|
@@ -64,5 +63,3 @@ const generate = async () => {
|
|
|
64
63
|
await cleanup(PROJECT_DIRECTORY);
|
|
65
64
|
}
|
|
66
65
|
};
|
|
67
|
-
|
|
68
|
-
generate();
|
|
@@ -1,18 +1,26 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { execSync } from 'node:child_process';
|
|
4
|
-
const __dirname = import.meta.dirname;
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
const
|
|
5
|
+
async function main() {
|
|
6
|
+
const __dirname = import.meta.dirname;
|
|
8
7
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const catalog = args[0] || 'default';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const catalogDir = join(__dirname, '../');
|
|
12
|
+
const projectDIR = join(__dirname, `../examples/${catalog}`);
|
|
13
|
+
|
|
14
|
+
execSync('npm run build:bin', { stdio: 'inherit' });
|
|
15
|
+
|
|
16
|
+
execSync(`cross-env NODE_ENV=development PROJECT_DIR=${projectDIR} CATALOG_DIR=${catalogDir} npx . dev`, {
|
|
16
17
|
stdio: 'inherit',
|
|
17
|
-
}
|
|
18
|
-
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
main()
|
|
22
|
+
.then(() => process.exit(0))
|
|
23
|
+
.catch((err) => {
|
|
24
|
+
console.error(err);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
package/scripts/watcher.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import watcher from '@parcel/watcher';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
|
-
import path from 'node:path';
|
|
4
3
|
import { mapCatalogToAstro } from './map-catalog-to-astro.js';
|
|
5
4
|
import { rimrafSync } from 'rimraf';
|
|
6
5
|
import { addPropertyToFrontMatter } from './eventcatalog-config-file-utils.js';
|
|
@@ -116,19 +115,3 @@ function retryEPERM(fn) {
|
|
|
116
115
|
}
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* TODO: call `watch` from the dev command.
|
|
122
|
-
* Calling `watch` there will avoid these if statement.
|
|
123
|
-
* The same could be done to `catalog-to-astro-content-directory`
|
|
124
|
-
*/
|
|
125
|
-
if (process.env.NODE_ENV !== 'test') {
|
|
126
|
-
// Where the users project is located
|
|
127
|
-
const projectDirectory = process.env.PROJECT_DIR || process.cwd();
|
|
128
|
-
// Where the catalog code is located.
|
|
129
|
-
const catalogDirectory = process.env.CATALOG_DIR || path.join(projectDirectory, '.eventcatalog-core');
|
|
130
|
-
|
|
131
|
-
const unsub = await watch(projectDirectory, catalogDirectory);
|
|
132
|
-
|
|
133
|
-
process.on('exit', () => unsub());
|
|
134
|
-
}
|
/package/{scripts/default-files-for-collections → default-files-for-collections}/changelogs.md
RENAMED
|
File without changes
|
/package/{scripts/default-files-for-collections → default-files-for-collections}/channels.md
RENAMED
|
File without changes
|
/package/{scripts/default-files-for-collections → default-files-for-collections}/commands.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{scripts/default-files-for-collections → default-files-for-collections}/services.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|