@eventcatalog/create-eventcatalog 2.0.14 → 2.0.16

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/dist/index.js CHANGED
@@ -1203,7 +1203,7 @@ var require_has_flag = __commonJS({
1203
1203
  var require_supports_color = __commonJS({
1204
1204
  "node_modules/supports-color/index.js"(exports2, module2) {
1205
1205
  "use strict";
1206
- var os2 = require("os");
1206
+ var os3 = require("os");
1207
1207
  var hasFlag = require_has_flag();
1208
1208
  var env = process.env;
1209
1209
  var forceColor;
@@ -1241,7 +1241,7 @@ var require_supports_color = __commonJS({
1241
1241
  }
1242
1242
  const min = forceColor ? 1 : 0;
1243
1243
  if (process.platform === "win32") {
1244
- const osRelease = os2.release().split(".");
1244
+ const osRelease = os3.release().split(".");
1245
1245
  if (Number(process.versions.node.split(".")[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
1246
1246
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
1247
1247
  }
@@ -7884,9 +7884,9 @@ var require_path = __commonJS({
7884
7884
  "use strict";
7885
7885
  Object.defineProperty(exports2, "__esModule", { value: true });
7886
7886
  exports2.convertPosixPathToPattern = exports2.convertWindowsPathToPattern = exports2.convertPathToPattern = exports2.escapePosixPath = exports2.escapeWindowsPath = exports2.escape = exports2.removeLeadingDotSegment = exports2.makeAbsolute = exports2.unixify = void 0;
7887
- var os2 = require("os");
7887
+ var os3 = require("os");
7888
7888
  var path8 = require("path");
7889
- var IS_WINDOWS_PLATFORM = os2.platform() === "win32";
7889
+ var IS_WINDOWS_PLATFORM = os3.platform() === "win32";
7890
7890
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
7891
7891
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
7892
7892
  var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
@@ -13106,8 +13106,8 @@ var require_settings4 = __commonJS({
13106
13106
  Object.defineProperty(exports2, "__esModule", { value: true });
13107
13107
  exports2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
13108
13108
  var fs7 = require("fs");
13109
- var os2 = require("os");
13110
- var CPU_COUNT = Math.max(os2.cpus().length, 1);
13109
+ var os3 = require("os");
13110
+ var CPU_COUNT = Math.max(os3.cpus().length, 1);
13111
13111
  exports2.DEFAULT_FILE_SYSTEM_ADAPTER = {
13112
13112
  lstat: fs7.lstat,
13113
13113
  lstatSync: fs7.lstatSync,
@@ -22452,7 +22452,7 @@ function install(root, dependencies, { packageManager: packageManager2, isOnline
22452
22452
  }
22453
22453
 
22454
22454
  // templates/index.ts
22455
- var import_os2 = __toESM(require("os"));
22455
+ var import_os3 = __toESM(require("os"));
22456
22456
  var import_fs16 = __toESM(require("fs"));
22457
22457
  var import_path9 = __toESM(require("path"));
22458
22458
  var import_chalk3 = __toESM(require_chalk());
@@ -22460,8 +22460,69 @@ var import_uuid = require("uuid");
22460
22460
 
22461
22461
  // templates/analytics.ts
22462
22462
  var import_axios = __toESM(require("axios"));
22463
+ var import_os2 = __toESM(require("os"));
22464
+
22465
+ // package.json
22466
+ var package_default = {
22467
+ name: "@eventcatalog/create-eventcatalog",
22468
+ description: "Create EventCatalog with one command",
22469
+ version: "2.0.16",
22470
+ bin: {
22471
+ "create-catalog": "./dist/index.js"
22472
+ },
22473
+ files: [
22474
+ "dist",
22475
+ "templates"
22476
+ ],
22477
+ publishConfig: {
22478
+ access: "public"
22479
+ },
22480
+ scripts: {
22481
+ prepublishOnly: "npm run build",
22482
+ build: "tsup index.ts --format cjs --dts",
22483
+ run: "node dist/index.js",
22484
+ dev: "npm run build --watch",
22485
+ changeset: "changeset",
22486
+ release: "changeset publish"
22487
+ },
22488
+ devDependencies: {
22489
+ "@types/async-retry": "1.4.2",
22490
+ "@types/ci-info": "2.0.0",
22491
+ "@types/cross-spawn": "6.0.0",
22492
+ "@types/node": "^12.6.8",
22493
+ "@types/prompts": "2.0.1",
22494
+ "@types/rimraf": "3.0.0",
22495
+ "@types/tar": "4.0.3",
22496
+ "@types/uuid": "^10.0.0",
22497
+ "@types/validate-npm-package-name": "3.0.0",
22498
+ "@vercel/ncc": "0.34.0",
22499
+ "async-retry": "1.3.1",
22500
+ chalk: "2.4.2",
22501
+ "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
22502
+ commander: "2.20.0",
22503
+ cpy: "^11.0.0",
22504
+ "cross-spawn": "6.0.5",
22505
+ "fast-glob": "^3.3.2",
22506
+ got: "^14.0.0",
22507
+ prompts: "2.1.0",
22508
+ rimraf: "^5.0.7",
22509
+ tar: "^4.4.19",
22510
+ tsup: "^8.1.0",
22511
+ typescript: "^5.4.5",
22512
+ "update-check": "1.5.4",
22513
+ "validate-npm-package-name": "3.0.0"
22514
+ },
22515
+ dependencies: {
22516
+ "@changesets/cli": "^2.27.6",
22517
+ axios: "^1.7.7",
22518
+ uuid: "^10.0.0"
22519
+ }
22520
+ };
22521
+
22522
+ // templates/analytics.ts
22463
22523
  async function raiseEvent(eventData) {
22464
22524
  const url2 = "https://queue.simpleanalyticscdn.com/events";
22525
+ const userAgent = `@eventcatalog/create-eventcatalog/${package_default.version} (${import_os2.default.platform()}; ${import_os2.default.arch()}; Node/${process.version})`;
22465
22526
  const headers = {
22466
22527
  "Content-Type": "application/json"
22467
22528
  };
@@ -22469,14 +22530,15 @@ async function raiseEvent(eventData) {
22469
22530
  type: "event",
22470
22531
  hostname: "eventcatalog.dev",
22471
22532
  event: "@eventcatalog/create-eventcatalog",
22472
- metadata: eventData,
22473
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
22533
+ metadata: {
22534
+ ...eventData,
22535
+ ua: userAgent
22536
+ },
22537
+ ua: userAgent
22474
22538
  };
22475
22539
  try {
22476
22540
  await import_axios.default.post(url2, payload, { headers });
22477
- console.log("Event successfully sent");
22478
22541
  } catch (error) {
22479
- console.log("Error sending event:", error);
22480
22542
  }
22481
22543
  }
22482
22544
 
@@ -22510,7 +22572,7 @@ var installTemplate = async ({
22510
22572
  };
22511
22573
  import_fs16.default.writeFileSync(
22512
22574
  import_path9.default.join(root, "package.json"),
22513
- JSON.stringify(packageJson, null, 2) + import_os2.default.EOL
22575
+ JSON.stringify(packageJson, null, 2) + import_os3.default.EOL
22514
22576
  );
22515
22577
  const installFlags = { packageManager: packageManager2, isOnline };
22516
22578
  const dependencies = [];
@@ -22518,7 +22580,8 @@ var installTemplate = async ({
22518
22580
  "@parcel/watcher",
22519
22581
  "concurrently",
22520
22582
  "cross-env",
22521
- "@types/lodash.merge"
22583
+ "@types/lodash.merge",
22584
+ "@types/diff"
22522
22585
  ];
22523
22586
  if (dependencies.length) {
22524
22587
  console.log();
@@ -22559,12 +22622,13 @@ var installTemplate = async ({
22559
22622
  }
22560
22623
  }
22561
22624
  });
22625
+ const cId = (0, import_uuid.v4)();
22562
22626
  const eventCatalogConfigPath = import_path9.default.join(root, "eventcatalog.config.js");
22563
22627
  let eventCatalogConfig = import_fs16.default.readFileSync(eventCatalogConfigPath, "utf8");
22564
22628
  eventCatalogConfig = eventCatalogConfig.replace(/<organizationName>/g, organizationName2);
22565
- eventCatalogConfig = eventCatalogConfig.replace(/<cId>/g, (0, import_uuid.v4)());
22629
+ eventCatalogConfig = eventCatalogConfig.replace(/<cId>/g, cId);
22566
22630
  import_fs16.default.writeFileSync(eventCatalogConfigPath, eventCatalogConfig);
22567
- await raiseEvent({ command: "create", org: organizationName2, id: (0, import_uuid.v4)() });
22631
+ await raiseEvent({ command: "create", org: organizationName2, cId });
22568
22632
  if (!eslint) {
22569
22633
  await import_fs16.default.promises.unlink(import_path9.default.join(root, ".eslintrc.json"));
22570
22634
  }
@@ -22685,63 +22749,6 @@ function validateNpmName(name) {
22685
22749
  };
22686
22750
  }
22687
22751
 
22688
- // package.json
22689
- var package_default = {
22690
- name: "@eventcatalog/create-eventcatalog",
22691
- description: "Create EventCatalog with one command",
22692
- version: "2.0.14",
22693
- bin: {
22694
- "create-catalog": "./dist/index.js"
22695
- },
22696
- files: [
22697
- "dist",
22698
- "templates"
22699
- ],
22700
- publishConfig: {
22701
- access: "public"
22702
- },
22703
- scripts: {
22704
- prepublishOnly: "npm run build",
22705
- build: "tsup index.ts --format cjs --dts",
22706
- run: "node dist/index.js",
22707
- dev: "npm run build --watch",
22708
- changeset: "changeset",
22709
- release: "changeset publish"
22710
- },
22711
- devDependencies: {
22712
- "@types/async-retry": "1.4.2",
22713
- "@types/ci-info": "2.0.0",
22714
- "@types/cross-spawn": "6.0.0",
22715
- "@types/node": "^12.6.8",
22716
- "@types/prompts": "2.0.1",
22717
- "@types/rimraf": "3.0.0",
22718
- "@types/tar": "4.0.3",
22719
- "@types/uuid": "^10.0.0",
22720
- "@types/validate-npm-package-name": "3.0.0",
22721
- "@vercel/ncc": "0.34.0",
22722
- "async-retry": "1.3.1",
22723
- chalk: "2.4.2",
22724
- "ci-info": "watson/ci-info#f43f6a1cefff47fb361c88cf4b943fdbcaafe540",
22725
- commander: "2.20.0",
22726
- cpy: "^11.0.0",
22727
- "cross-spawn": "6.0.5",
22728
- "fast-glob": "^3.3.2",
22729
- got: "^14.0.0",
22730
- prompts: "2.1.0",
22731
- rimraf: "^5.0.7",
22732
- tar: "^4.4.19",
22733
- tsup: "^8.1.0",
22734
- typescript: "^5.4.5",
22735
- "update-check": "1.5.4",
22736
- "validate-npm-package-name": "3.0.0"
22737
- },
22738
- dependencies: {
22739
- "@changesets/cli": "^2.27.6",
22740
- axios: "^1.7.7",
22741
- uuid: "^10.0.0"
22742
- }
22743
- };
22744
-
22745
22752
  // index.ts
22746
22753
  var projectPath = "";
22747
22754
  var organizationName = "";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eventcatalog/create-eventcatalog",
3
3
  "description": "Create EventCatalog with one command",
4
- "version": "2.0.14",
4
+ "version": "2.0.16",
5
5
  "bin": {
6
6
  "create-catalog": "./dist/index.js"
7
7
  },
@@ -1,13 +1,16 @@
1
1
  import axios from 'axios';
2
+ import os from 'os';
3
+ import pkg from '../package.json';
2
4
 
3
5
  interface EventMetadata {
4
6
  command: string;
5
7
  org: string;
6
- id: string;
8
+ cId: string;
7
9
  }
8
10
 
9
11
  async function raiseEvent(eventData: EventMetadata): Promise<void> {
10
12
  const url = "https://queue.simpleanalyticscdn.com/events";
13
+ const userAgent = `@eventcatalog/create-eventcatalog/${pkg.version} (${os.platform()}; ${os.arch()}; Node/${process.version})`;
11
14
  const headers = {
12
15
  "Content-Type": "application/json",
13
16
  };
@@ -16,15 +19,17 @@ async function raiseEvent(eventData: EventMetadata): Promise<void> {
16
19
  type: "event",
17
20
  hostname: "eventcatalog.dev",
18
21
  event: "@eventcatalog/create-eventcatalog",
19
- metadata: eventData,
20
- timestamp: new Date().toISOString(),
22
+ metadata: {
23
+ ...eventData,
24
+ ua: userAgent
25
+ },
26
+ ua: userAgent
21
27
  };
22
28
 
23
29
  try {
24
30
  await axios.post(url, payload, { headers });
25
- console.log("Event successfully sent");
26
31
  } catch (error) {
27
- console.log("Error sending event:", error);
32
+ // swallow the error
28
33
  }
29
34
  }
30
35
 
@@ -79,6 +79,7 @@ export const installTemplate = async ({
79
79
  "concurrently",
80
80
  "cross-env",
81
81
  "@types/lodash.merge",
82
+ "@types/diff",
82
83
  ] as any;
83
84
 
84
85
  /**
@@ -134,14 +135,16 @@ export const installTemplate = async ({
134
135
  },
135
136
  });
136
137
 
138
+ const cId = v4();
139
+
137
140
  // update the properties in the eventcatalog.config.js
138
141
  const eventCatalogConfigPath = path.join(root, "eventcatalog.config.js");
139
142
  let eventCatalogConfig = fs.readFileSync(eventCatalogConfigPath, "utf8");
140
143
  eventCatalogConfig = eventCatalogConfig.replace( /<organizationName>/g, organizationName );
141
- eventCatalogConfig = eventCatalogConfig.replace( /<cId>/g, v4() );
144
+ eventCatalogConfig = eventCatalogConfig.replace( /<cId>/g, cId );
142
145
  fs.writeFileSync(eventCatalogConfigPath, eventCatalogConfig);
143
146
 
144
- await raiseEvent({ command: 'create', org: organizationName, id: v4() });
147
+ await raiseEvent({ command: 'create', org: organizationName, cId });
145
148
 
146
149
  if (!eslint) {
147
150
  // remove un-necessary template file if eslint is not desired