lingo.dev 0.124.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 +41 -44
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +41 -44
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -10998,44 +10998,41 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
|
|
|
10998
10998
|
var _nodemachineid = require('node-machine-id'); var _nodemachineid2 = _interopRequireDefault(_nodemachineid);
|
|
10999
10999
|
var _https = require('https'); var _https2 = _interopRequireDefault(_https);
|
|
11000
11000
|
|
|
11001
|
-
// src/cli/utils/
|
|
11001
|
+
// src/cli/utils/org-id.ts
|
|
11002
11002
|
var _child_process = require('child_process'); var cp = _interopRequireWildcard(_child_process);
|
|
11003
|
-
var
|
|
11004
|
-
|
|
11005
|
-
function hashProjectName(fullPath) {
|
|
11003
|
+
var cachedGitOrgId = void 0;
|
|
11004
|
+
function extractOrg(fullPath) {
|
|
11006
11005
|
const parts = fullPath.split("/");
|
|
11007
|
-
if (parts.length
|
|
11008
|
-
return
|
|
11009
|
-
}
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
const
|
|
11016
|
-
if (
|
|
11017
|
-
const gitRepoId = getGitRepositoryId();
|
|
11018
|
-
if (gitRepoId) return gitRepoId;
|
|
11006
|
+
if (parts.length < 1) {
|
|
11007
|
+
return null;
|
|
11008
|
+
}
|
|
11009
|
+
return parts[0];
|
|
11010
|
+
}
|
|
11011
|
+
function getOrgId() {
|
|
11012
|
+
const ciOrgId = getCIOrgId();
|
|
11013
|
+
if (ciOrgId) return ciOrgId;
|
|
11014
|
+
const gitOrgId = getGitOrgId();
|
|
11015
|
+
if (gitOrgId) return gitOrgId;
|
|
11019
11016
|
return null;
|
|
11020
11017
|
}
|
|
11021
|
-
function
|
|
11018
|
+
function getCIOrgId() {
|
|
11022
11019
|
if (process.env.GITHUB_REPOSITORY) {
|
|
11023
|
-
const
|
|
11024
|
-
return `github:${
|
|
11020
|
+
const org = extractOrg(process.env.GITHUB_REPOSITORY);
|
|
11021
|
+
if (org) return `github:${org}`;
|
|
11025
11022
|
}
|
|
11026
11023
|
if (process.env.CI_PROJECT_PATH) {
|
|
11027
|
-
const
|
|
11028
|
-
return `gitlab:${
|
|
11024
|
+
const org = extractOrg(process.env.CI_PROJECT_PATH);
|
|
11025
|
+
if (org) return `gitlab:${org}`;
|
|
11029
11026
|
}
|
|
11030
11027
|
if (process.env.BITBUCKET_REPO_FULL_NAME) {
|
|
11031
|
-
const
|
|
11032
|
-
return `bitbucket:${
|
|
11028
|
+
const org = extractOrg(process.env.BITBUCKET_REPO_FULL_NAME);
|
|
11029
|
+
if (org) return `bitbucket:${org}`;
|
|
11033
11030
|
}
|
|
11034
11031
|
return null;
|
|
11035
11032
|
}
|
|
11036
|
-
function
|
|
11037
|
-
if (
|
|
11038
|
-
return
|
|
11033
|
+
function getGitOrgId() {
|
|
11034
|
+
if (cachedGitOrgId !== void 0) {
|
|
11035
|
+
return cachedGitOrgId;
|
|
11039
11036
|
}
|
|
11040
11037
|
try {
|
|
11041
11038
|
const remoteUrl = _child_process.execSync.call(void 0, "git config --get remote.origin.url", {
|
|
@@ -11043,13 +11040,13 @@ function getGitRepositoryId() {
|
|
|
11043
11040
|
stdio: ["pipe", "pipe", "ignore"]
|
|
11044
11041
|
}).trim();
|
|
11045
11042
|
if (!remoteUrl) {
|
|
11046
|
-
|
|
11043
|
+
cachedGitOrgId = null;
|
|
11047
11044
|
return null;
|
|
11048
11045
|
}
|
|
11049
|
-
|
|
11050
|
-
return
|
|
11046
|
+
cachedGitOrgId = parseGitUrl(remoteUrl);
|
|
11047
|
+
return cachedGitOrgId;
|
|
11051
11048
|
} catch (e3) {
|
|
11052
|
-
|
|
11049
|
+
cachedGitOrgId = null;
|
|
11053
11050
|
return null;
|
|
11054
11051
|
}
|
|
11055
11052
|
}
|
|
@@ -11067,11 +11064,12 @@ function parseGitUrl(url) {
|
|
|
11067
11064
|
const httpsMatch = cleanUrl.match(/\/([^/]+\/[^/]+)$/);
|
|
11068
11065
|
const repoPath = _optionalChain([sshMatch, 'optionalAccess', _349 => _349[1]]) || _optionalChain([httpsMatch, 'optionalAccess', _350 => _350[1]]);
|
|
11069
11066
|
if (!repoPath) return null;
|
|
11070
|
-
const
|
|
11067
|
+
const org = extractOrg(repoPath);
|
|
11068
|
+
if (!org) return null;
|
|
11071
11069
|
if (platform) {
|
|
11072
|
-
return `${platform}:${
|
|
11070
|
+
return `${platform}:${org}`;
|
|
11073
11071
|
}
|
|
11074
|
-
return `git:${
|
|
11072
|
+
return `git:${org}`;
|
|
11075
11073
|
}
|
|
11076
11074
|
|
|
11077
11075
|
// src/cli/utils/observability.ts
|
|
@@ -11082,20 +11080,19 @@ var POSTHOG_PATH = "/i/v0/e/";
|
|
|
11082
11080
|
var REQUEST_TIMEOUT_MS = 3e3;
|
|
11083
11081
|
var TRACKING_VERSION = "2.0";
|
|
11084
11082
|
function determineDistinctId(email) {
|
|
11083
|
+
const orgId = getOrgId();
|
|
11085
11084
|
if (email) {
|
|
11086
|
-
const projectId = getRepositoryId();
|
|
11087
11085
|
return {
|
|
11088
11086
|
distinct_id: email,
|
|
11089
11087
|
distinct_id_source: "email",
|
|
11090
|
-
|
|
11088
|
+
org_id: orgId
|
|
11091
11089
|
};
|
|
11092
11090
|
}
|
|
11093
|
-
|
|
11094
|
-
if (repoId) {
|
|
11091
|
+
if (orgId) {
|
|
11095
11092
|
return {
|
|
11096
|
-
distinct_id:
|
|
11097
|
-
distinct_id_source: "
|
|
11098
|
-
|
|
11093
|
+
distinct_id: orgId,
|
|
11094
|
+
distinct_id_source: "git_org",
|
|
11095
|
+
org_id: orgId
|
|
11099
11096
|
};
|
|
11100
11097
|
}
|
|
11101
11098
|
const deviceId = `device-${machineIdSync()}`;
|
|
@@ -11107,7 +11104,7 @@ function determineDistinctId(email) {
|
|
|
11107
11104
|
return {
|
|
11108
11105
|
distinct_id: deviceId,
|
|
11109
11106
|
distinct_id_source: "device",
|
|
11110
|
-
|
|
11107
|
+
org_id: null
|
|
11111
11108
|
};
|
|
11112
11109
|
}
|
|
11113
11110
|
function trackEvent(email, event, properties) {
|
|
@@ -11132,7 +11129,7 @@ function trackEvent(email, event, properties) {
|
|
|
11132
11129
|
$lib_version: process.env.npm_package_version || "unknown",
|
|
11133
11130
|
tracking_version: TRACKING_VERSION,
|
|
11134
11131
|
distinct_id_source: identityInfo.distinct_id_source,
|
|
11135
|
-
|
|
11132
|
+
org_id: identityInfo.org_id,
|
|
11136
11133
|
node_version: process.version,
|
|
11137
11134
|
is_ci: !!process.env.CI,
|
|
11138
11135
|
debug_enabled: process.env.DEBUG === "true"
|
|
@@ -15195,7 +15192,7 @@ async function renderHero2() {
|
|
|
15195
15192
|
// package.json
|
|
15196
15193
|
var package_default = {
|
|
15197
15194
|
name: "lingo.dev",
|
|
15198
|
-
version: "0.
|
|
15195
|
+
version: "0.125.1",
|
|
15199
15196
|
description: "Lingo.dev CLI",
|
|
15200
15197
|
private: false,
|
|
15201
15198
|
repository: {
|
|
@@ -15303,7 +15300,7 @@ var package_default = {
|
|
|
15303
15300
|
}
|
|
15304
15301
|
},
|
|
15305
15302
|
bin: {
|
|
15306
|
-
lingo: "./bin/cli.mjs"
|
|
15303
|
+
"lingo.dev": "./bin/cli.mjs"
|
|
15307
15304
|
},
|
|
15308
15305
|
files: [
|
|
15309
15306
|
"bin",
|