@eventcatalog/sdk 2.2.10 → 2.3.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.
Files changed (45) hide show
  1. package/dist/channels.js +20 -4
  2. package/dist/channels.js.map +1 -1
  3. package/dist/channels.mjs +21 -5
  4. package/dist/channels.mjs.map +1 -1
  5. package/dist/commands.js +20 -4
  6. package/dist/commands.js.map +1 -1
  7. package/dist/commands.mjs +21 -5
  8. package/dist/commands.mjs.map +1 -1
  9. package/dist/custom-docs.js +20 -4
  10. package/dist/custom-docs.js.map +1 -1
  11. package/dist/custom-docs.mjs +21 -5
  12. package/dist/custom-docs.mjs.map +1 -1
  13. package/dist/domains.js +20 -4
  14. package/dist/domains.js.map +1 -1
  15. package/dist/domains.mjs +21 -5
  16. package/dist/domains.mjs.map +1 -1
  17. package/dist/eventcatalog.js +20 -4
  18. package/dist/eventcatalog.js.map +1 -1
  19. package/dist/eventcatalog.mjs +21 -5
  20. package/dist/eventcatalog.mjs.map +1 -1
  21. package/dist/events.js +20 -4
  22. package/dist/events.js.map +1 -1
  23. package/dist/events.mjs +21 -5
  24. package/dist/events.mjs.map +1 -1
  25. package/dist/index.js +20 -4
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +21 -5
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/queries.js +20 -4
  30. package/dist/queries.js.map +1 -1
  31. package/dist/queries.mjs +21 -5
  32. package/dist/queries.mjs.map +1 -1
  33. package/dist/services.js +20 -4
  34. package/dist/services.js.map +1 -1
  35. package/dist/services.mjs +21 -5
  36. package/dist/services.mjs.map +1 -1
  37. package/dist/teams.js +20 -4
  38. package/dist/teams.js.map +1 -1
  39. package/dist/teams.mjs +21 -5
  40. package/dist/teams.mjs.map +1 -1
  41. package/dist/users.js +20 -4
  42. package/dist/users.js.map +1 -1
  43. package/dist/users.mjs +21 -5
  44. package/dist/users.mjs.map +1 -1
  45. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -9,7 +9,7 @@ import { join as join3 } from "node:path";
9
9
  import { globSync } from "glob";
10
10
  import fsSync from "node:fs";
11
11
  import { copy } from "fs-extra";
12
- import { join, dirname } from "node:path";
12
+ import { join, dirname, normalize, resolve, relative } from "node:path";
13
13
  import matter from "gray-matter";
14
14
  import { satisfies, validRange, valid } from "semver";
15
15
  var versionExists = async (catalogDir, id, version) => {
@@ -43,12 +43,28 @@ var findFileById = async (catalogDir, id, version) => {
43
43
  };
44
44
  var getFiles = async (pattern, ignore = "") => {
45
45
  try {
46
+ const normalizedInputPattern = normalize(pattern);
47
+ const absoluteBaseDir = resolve(
48
+ normalizedInputPattern.includes("**") ? normalizedInputPattern.split("**")[0] : dirname(normalizedInputPattern)
49
+ );
50
+ let relativePattern = relative(absoluteBaseDir, normalizedInputPattern);
51
+ relativePattern = relativePattern.replace(/\\/g, "/");
46
52
  const ignoreList = Array.isArray(ignore) ? ignore : [ignore];
47
- const baseDir = pattern.includes("**") ? pattern.split("**")[0] : dirname(pattern);
48
- const files = globSync(pattern, { cwd: baseDir, ignore: ["node_modules/**", ...ignoreList] });
49
- return files;
53
+ const files = globSync(relativePattern, {
54
+ cwd: absoluteBaseDir,
55
+ ignore: ["node_modules/**", ...ignoreList],
56
+ absolute: true,
57
+ nodir: true
58
+ });
59
+ return files.map(normalize);
50
60
  } catch (error) {
51
- throw new Error(`Error finding files: ${error}`);
61
+ const absoluteBaseDirForError = resolve(
62
+ normalize(pattern).includes("**") ? normalize(pattern).split("**")[0] : dirname(normalize(pattern))
63
+ );
64
+ const relativePatternForError = relative(absoluteBaseDirForError, normalize(pattern)).replace(/\\/g, "/");
65
+ throw new Error(
66
+ `Error finding files for pattern "${pattern}" (using cwd: "${absoluteBaseDirForError}", globPattern: "${relativePatternForError}"): ${error.message}`
67
+ );
52
68
  }
53
69
  };
54
70
  var readMdxFile = async (path4) => {