lingo.dev 0.125.0 → 0.125.1
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/build/cli.cjs +40 -43
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +40 -43
- package/build/cli.mjs.map +1 -1
- package/package.json +2 -2
package/build/cli.mjs
CHANGED
|
@@ -10994,44 +10994,41 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
|
|
|
10994
10994
|
import pkg3 from "node-machine-id";
|
|
10995
10995
|
import https from "https";
|
|
10996
10996
|
|
|
10997
|
-
// src/cli/utils/
|
|
10997
|
+
// src/cli/utils/org-id.ts
|
|
10998
10998
|
import { execSync } from "child_process";
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
function hashProjectName(fullPath) {
|
|
10999
|
+
var cachedGitOrgId = void 0;
|
|
11000
|
+
function extractOrg(fullPath) {
|
|
11002
11001
|
const parts = fullPath.split("/");
|
|
11003
|
-
if (parts.length
|
|
11004
|
-
return
|
|
11005
|
-
}
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
const
|
|
11012
|
-
if (
|
|
11013
|
-
const gitRepoId = getGitRepositoryId();
|
|
11014
|
-
if (gitRepoId) return gitRepoId;
|
|
11002
|
+
if (parts.length < 1) {
|
|
11003
|
+
return null;
|
|
11004
|
+
}
|
|
11005
|
+
return parts[0];
|
|
11006
|
+
}
|
|
11007
|
+
function getOrgId() {
|
|
11008
|
+
const ciOrgId = getCIOrgId();
|
|
11009
|
+
if (ciOrgId) return ciOrgId;
|
|
11010
|
+
const gitOrgId = getGitOrgId();
|
|
11011
|
+
if (gitOrgId) return gitOrgId;
|
|
11015
11012
|
return null;
|
|
11016
11013
|
}
|
|
11017
|
-
function
|
|
11014
|
+
function getCIOrgId() {
|
|
11018
11015
|
if (process.env.GITHUB_REPOSITORY) {
|
|
11019
|
-
const
|
|
11020
|
-
return `github:${
|
|
11016
|
+
const org = extractOrg(process.env.GITHUB_REPOSITORY);
|
|
11017
|
+
if (org) return `github:${org}`;
|
|
11021
11018
|
}
|
|
11022
11019
|
if (process.env.CI_PROJECT_PATH) {
|
|
11023
|
-
const
|
|
11024
|
-
return `gitlab:${
|
|
11020
|
+
const org = extractOrg(process.env.CI_PROJECT_PATH);
|
|
11021
|
+
if (org) return `gitlab:${org}`;
|
|
11025
11022
|
}
|
|
11026
11023
|
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
11027
|
-
const
|
|
11028
|
-
return `bitbucket:${
|
|
11024
|
+
const org = extractOrg(process.env.BITBUCKET_REPO_FULL_NAME);
|
|
11025
|
+
if (org) return `bitbucket:${org}`;
|
|
11029
11026
|
}
|
|
11030
11027
|
return null;
|
|
11031
11028
|
}
|
|
11032
|
-
function
|
|
11033
|
-
if (
|
|
11034
|
-
return
|
|
11029
|
+
function getGitOrgId() {
|
|
11030
|
+
if (cachedGitOrgId !== void 0) {
|
|
11031
|
+
return cachedGitOrgId;
|
|
11035
11032
|
}
|
|
11036
11033
|
try {
|
|
11037
11034
|
const remoteUrl = execSync("git config --get remote.origin.url", {
|
|
@@ -11039,13 +11036,13 @@ function getGitRepositoryId() {
|
|
|
11039
11036
|
stdio: ["pipe", "pipe", "ignore"]
|
|
11040
11037
|
}).trim();
|
|
11041
11038
|
if (!remoteUrl) {
|
|
11042
|
-
|
|
11039
|
+
cachedGitOrgId = null;
|
|
11043
11040
|
return null;
|
|
11044
11041
|
}
|
|
11045
|
-
|
|
11046
|
-
return
|
|
11042
|
+
cachedGitOrgId = parseGitUrl(remoteUrl);
|
|
11043
|
+
return cachedGitOrgId;
|
|
11047
11044
|
} catch {
|
|
11048
|
-
|
|
11045
|
+
cachedGitOrgId = null;
|
|
11049
11046
|
return null;
|
|
11050
11047
|
}
|
|
11051
11048
|
}
|
|
@@ -11063,11 +11060,12 @@ function parseGitUrl(url) {
|
|
|
11063
11060
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
11064
11061
|
const repoPath = sshMatch?.[1] || httpsMatch?.[1];
|
|
11065
11062
|
if (!repoPath) return null;
|
|
11066
|
-
const
|
|
11063
|
+
const org = extractOrg(repoPath);
|
|
11064
|
+
if (!org) return null;
|
|
11067
11065
|
if (platform) {
|
|
11068
|
-
return `${platform}:${
|
|
11066
|
+
return `${platform}:${org}`;
|
|
11069
11067
|
}
|
|
11070
|
-
return `git:${
|
|
11068
|
+
return `git:${org}`;
|
|
11071
11069
|
}
|
|
11072
11070
|
|
|
11073
11071
|
// src/cli/utils/observability.ts
|
|
@@ -11078,20 +11076,19 @@ var POSTHOG_PATH = "/i/v0/e/";
|
|
|
11078
11076
|
var REQUEST_TIMEOUT_MS = 3e3;
|
|
11079
11077
|
var TRACKING_VERSION = "2.0";
|
|
11080
11078
|
function determineDistinctId(email) {
|
|
11079
|
+
const orgId = getOrgId();
|
|
11081
11080
|
if (email) {
|
|
11082
|
-
const projectId = getRepositoryId();
|
|
11083
11081
|
return {
|
|
11084
11082
|
distinct_id: email,
|
|
11085
11083
|
distinct_id_source: "email",
|
|
11086
|
-
|
|
11084
|
+
org_id: orgId
|
|
11087
11085
|
};
|
|
11088
11086
|
}
|
|
11089
|
-
|
|
11090
|
-
if (repoId) {
|
|
11087
|
+
if (orgId) {
|
|
11091
11088
|
return {
|
|
11092
|
-
distinct_id:
|
|
11093
|
-
distinct_id_source: "
|
|
11094
|
-
|
|
11089
|
+
distinct_id: orgId,
|
|
11090
|
+
distinct_id_source: "git_org",
|
|
11091
|
+
org_id: orgId
|
|
11095
11092
|
};
|
|
11096
11093
|
}
|
|
11097
11094
|
const deviceId = `device-${machineIdSync()}`;
|
|
@@ -11103,7 +11100,7 @@ function determineDistinctId(email) {
|
|
|
11103
11100
|
return {
|
|
11104
11101
|
distinct_id: deviceId,
|
|
11105
11102
|
distinct_id_source: "device",
|
|
11106
|
-
|
|
11103
|
+
org_id: null
|
|
11107
11104
|
};
|
|
11108
11105
|
}
|
|
11109
11106
|
function trackEvent(email, event, properties) {
|
|
@@ -11128,7 +11125,7 @@ function trackEvent(email, event, properties) {
|
|
|
11128
11125
|
$lib_version: process.env.npm_package_version || "unknown",
|
|
11129
11126
|
tracking_version: TRACKING_VERSION,
|
|
11130
11127
|
distinct_id_source: identityInfo.distinct_id_source,
|
|
11131
|
-
|
|
11128
|
+
org_id: identityInfo.org_id,
|
|
11132
11129
|
node_version: process.version,
|
|
11133
11130
|
is_ci: !!process.env.CI,
|
|
11134
11131
|
debug_enabled: process.env.DEBUG === "true"
|
|
@@ -15191,7 +15188,7 @@ async function renderHero2() {
|
|
|
15191
15188
|
// package.json
|
|
15192
15189
|
var package_default = {
|
|
15193
15190
|
name: "lingo.dev",
|
|
15194
|
-
version: "0.125.
|
|
15191
|
+
version: "0.125.1",
|
|
15195
15192
|
description: "Lingo.dev CLI",
|
|
15196
15193
|
private: false,
|
|
15197
15194
|
repository: {
|