@eventcatalog/core 2.8.8 → 2.8.10

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.8.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f4b7af: fix(core): fixed issue with using tmp directories
8
+
9
+ ## 2.8.9
10
+
11
+ ### Patch Changes
12
+
13
+ - 4e0823d: fix(core): fixed issue with importing users package json files
14
+
3
15
  ## 2.8.8
4
16
 
5
17
  ### Patch Changes
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.8.8",
9
+ "version": "2.8.10",
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
@@ -4,10 +4,9 @@ import { copyFile } from 'node:fs/promises';
4
4
  import path from 'node:path';
5
5
  import { v4 as uuidV4 } from 'uuid';
6
6
  import { pathToFileURL } from 'url';
7
- import { tmpdir } from 'node:os';
8
7
 
9
- export async function cleanup() {
10
- const filePath = path.join(tmpdir(), 'eventcatalog.config.mjs');
8
+ export async function cleanup(projectDirectory) {
9
+ const filePath = path.join(projectDirectory, 'eventcatalog.config.mjs');
11
10
  if (existsSync(filePath)) {
12
11
  await rm(filePath);
13
12
  }
@@ -17,10 +16,12 @@ export const getEventCatalogConfigFile = async (projectDirectory) => {
17
16
  try {
18
17
  let configFilePath = path.join(projectDirectory, 'eventcatalog.config.js');
19
18
 
20
- const packageJson = await import(/* @vite-ignore */ path.join(projectDirectory, 'package.json'));
21
- if (packageJson.default?.type !== 'module') {
22
- await copyFile(configFilePath, path.join(tmpdir(), 'eventcatalog.config.mjs'));
23
- configFilePath = path.join(tmpdir(), 'eventcatalog.config.mjs');
19
+ const filePath = path.join(projectDirectory, 'package.json');
20
+ const packageJson = JSON.parse(await readFile(filePath, 'utf-8'));
21
+
22
+ if (packageJson?.type !== 'module') {
23
+ await copyFile(configFilePath, path.join(projectDirectory, 'eventcatalog.config.mjs'));
24
+ configFilePath = path.join(projectDirectory, 'eventcatalog.config.mjs');
24
25
  }
25
26
 
26
27
  const configFileURL = pathToFileURL(configFilePath).href;
@@ -28,7 +29,7 @@ export const getEventCatalogConfigFile = async (projectDirectory) => {
28
29
 
29
30
  return config.default;
30
31
  } finally {
31
- await cleanup();
32
+ await cleanup(projectDirectory);
32
33
  }
33
34
  };
34
35
 
@@ -63,7 +64,7 @@ export const writeEventCatalogConfigFile = async (projectDirectory, newConfig) =
63
64
  // Write the updated content back to the file
64
65
  await writeFile(configFilePath, content);
65
66
  } finally {
66
- await cleanup();
67
+ await cleanup(projectDirectory);
67
68
  }
68
69
  };
69
70