canicode 0.6.2 → 0.6.4

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/cli/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
3
3
  import { writeFile, readFile, appendFile } from 'fs/promises';
4
4
  import { join, resolve, dirname, basename } from 'path';
5
+ import { createRequire } from 'module';
5
6
  import { config } from 'dotenv';
6
7
  import cac from 'cac';
7
8
  import { z } from 'zod';
@@ -2765,6 +2766,8 @@ var monitoringEnabled = false;
2765
2766
  var posthogApiKey;
2766
2767
  var sentryDsn;
2767
2768
  var distinctId = "anonymous";
2769
+ var environment = "unknown";
2770
+ var version = "unknown";
2768
2771
  var commonProps = {};
2769
2772
  function uuid4() {
2770
2773
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
@@ -2792,10 +2795,12 @@ function initCapture(config2) {
2792
2795
  posthogApiKey = config2.posthogApiKey;
2793
2796
  sentryDsn = config2.sentryDsn;
2794
2797
  distinctId = config2.distinctId ?? "anonymous";
2798
+ environment = config2.environment ?? "unknown";
2799
+ version = config2.version ?? "unknown";
2795
2800
  commonProps = {
2796
2801
  _sdk: "canicode",
2797
- _sdk_version: config2.version ?? "unknown",
2798
- _env: config2.environment ?? "unknown"
2802
+ _sdk_version: version,
2803
+ _env: environment
2799
2804
  };
2800
2805
  }
2801
2806
  function captureEvent(event, properties) {
@@ -2830,6 +2835,8 @@ function captureError(error, context) {
2830
2835
  event_id: eventId,
2831
2836
  exception: { values: [{ type: error.name, value: error.message }] },
2832
2837
  platform: "node",
2838
+ environment,
2839
+ release: `canicode@${version}`,
2833
2840
  timestamp: Date.now() / 1e3,
2834
2841
  extra: context
2835
2842
  })
@@ -2854,6 +2861,8 @@ function shutdownCapture() {
2854
2861
  posthogApiKey = void 0;
2855
2862
  sentryDsn = void 0;
2856
2863
  distinctId = "anonymous";
2864
+ environment = "unknown";
2865
+ version = "unknown";
2857
2866
  commonProps = {};
2858
2867
  }
2859
2868
 
@@ -4052,11 +4061,13 @@ defineRule({
4052
4061
 
4053
4062
  // src/cli/index.ts
4054
4063
  config();
4064
+ var require2 = createRequire(import.meta.url);
4065
+ var pkg = require2("../../package.json");
4055
4066
  var cli = cac("canicode");
4056
4067
  {
4057
4068
  const monitoringConfig = {
4058
4069
  environment: "cli",
4059
- version: "0.3.3",
4070
+ version: pkg.version,
4060
4071
  enabled: getTelemetryEnabled()
4061
4072
  };
4062
4073
  const phKey = getPosthogApiKey() || POSTHOG_API_KEY;