lingo.dev 0.111.1 → 0.111.3
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/README.md +6 -0
- package/build/cli.cjs +130 -103
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +102 -75
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -27,6 +27,12 @@
|
|
|
27
27
|
<a href="https://github.com/lingodotdev/lingo.dev/commits/main">
|
|
28
28
|
<img src="https://img.shields.io/github/last-commit/lingodotdev/lingo.dev" alt="Last Commit" />
|
|
29
29
|
</a>
|
|
30
|
+
<a href="https://lingo.dev/en">
|
|
31
|
+
<img src="https://img.shields.io/badge/Product%20Hunt-%231%20Product%20of%20the%20Day-orange?logo=producthunt&style=flat-square" alt="Product Hunt #1 Product of the Day" />
|
|
32
|
+
</a>
|
|
33
|
+
<a href="https://lingo.dev/en">
|
|
34
|
+
<img src="https://img.shields.io/badge/GitHub-Trending-blue?logo=github&style=flat-square" alt="Github trending" />
|
|
35
|
+
</a>
|
|
30
36
|
</p>
|
|
31
37
|
|
|
32
38
|
---
|
package/build/cli.cjs
CHANGED
|
@@ -7463,39 +7463,63 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
|
|
|
7463
7463
|
|
|
7464
7464
|
// src/cli/utils/observability.ts
|
|
7465
7465
|
var _nodemachineid = require('node-machine-id'); var _nodemachineid2 = _interopRequireDefault(_nodemachineid);
|
|
7466
|
+
var _https = require('https'); var _https2 = _interopRequireDefault(_https);
|
|
7466
7467
|
var { machineIdSync } = _nodemachineid2.default;
|
|
7467
|
-
|
|
7468
|
-
|
|
7468
|
+
var POSTHOG_API_KEY = "phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk";
|
|
7469
|
+
var POSTHOG_HOST = "eu.i.posthog.com";
|
|
7470
|
+
var POSTHOG_PATH = "/i/v0/e/";
|
|
7471
|
+
var REQUEST_TIMEOUT_MS = 1e3;
|
|
7472
|
+
function trackEvent(distinctId, event, properties) {
|
|
7473
|
+
if (process.env.DO_NOT_TRACK === "1") {
|
|
7469
7474
|
return;
|
|
7470
7475
|
}
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7476
|
+
setImmediate(() => {
|
|
7477
|
+
try {
|
|
7478
|
+
const actualId = distinctId || `device-${machineIdSync()}`;
|
|
7479
|
+
const eventData = {
|
|
7480
|
+
api_key: POSTHOG_API_KEY,
|
|
7481
|
+
event,
|
|
7482
|
+
distinct_id: actualId,
|
|
7483
|
+
properties: {
|
|
7484
|
+
...properties,
|
|
7485
|
+
$lib: "lingo.dev-cli",
|
|
7486
|
+
$lib_version: process.env.npm_package_version || "unknown"
|
|
7487
|
+
},
|
|
7488
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
7489
|
+
};
|
|
7490
|
+
const payload = JSON.stringify(eventData);
|
|
7491
|
+
const options = {
|
|
7492
|
+
hostname: POSTHOG_HOST,
|
|
7493
|
+
path: POSTHOG_PATH,
|
|
7494
|
+
method: "POST",
|
|
7495
|
+
headers: {
|
|
7496
|
+
"Content-Type": "application/json",
|
|
7497
|
+
"Content-Length": Buffer.byteLength(payload).toString()
|
|
7498
|
+
},
|
|
7499
|
+
timeout: REQUEST_TIMEOUT_MS
|
|
7500
|
+
};
|
|
7501
|
+
const req = _https2.default.request(options);
|
|
7502
|
+
req.on("timeout", () => {
|
|
7503
|
+
req.destroy();
|
|
7504
|
+
});
|
|
7505
|
+
req.on("error", (error) => {
|
|
7506
|
+
if (process.env.DEBUG === "true") {
|
|
7507
|
+
console.error("[Tracking] Error ignored:", error.message);
|
|
7508
|
+
}
|
|
7509
|
+
});
|
|
7510
|
+
req.write(payload);
|
|
7511
|
+
req.end();
|
|
7512
|
+
setTimeout(() => {
|
|
7513
|
+
if (!req.destroyed) {
|
|
7514
|
+
req.destroy();
|
|
7490
7515
|
}
|
|
7516
|
+
}, REQUEST_TIMEOUT_MS);
|
|
7517
|
+
} catch (error) {
|
|
7518
|
+
if (process.env.DEBUG === "true") {
|
|
7519
|
+
console.error("[Tracking] Failed to send event:", error);
|
|
7491
7520
|
}
|
|
7492
|
-
});
|
|
7493
|
-
await posthog.shutdown();
|
|
7494
|
-
} catch (error) {
|
|
7495
|
-
if (process.env.DEBUG) {
|
|
7496
|
-
console.error(error);
|
|
7497
7521
|
}
|
|
7498
|
-
}
|
|
7522
|
+
});
|
|
7499
7523
|
}
|
|
7500
7524
|
|
|
7501
7525
|
// src/cli/utils/delta.ts
|
|
@@ -7620,39 +7644,6 @@ function createDeltaProcessor(fileKey) {
|
|
|
7620
7644
|
};
|
|
7621
7645
|
}
|
|
7622
7646
|
|
|
7623
|
-
// src/cli/utils/exit-gracefully.ts
|
|
7624
|
-
var STEP_WAIT_INTERVAL = 250;
|
|
7625
|
-
var MAX_WAIT_INTERVAL = 2e3;
|
|
7626
|
-
function exitGracefully(elapsedMs = 0) {
|
|
7627
|
-
const hasPendingOperations = checkForPendingOperations();
|
|
7628
|
-
if (hasPendingOperations && elapsedMs < MAX_WAIT_INTERVAL) {
|
|
7629
|
-
setTimeout(
|
|
7630
|
-
() => exitGracefully(elapsedMs + STEP_WAIT_INTERVAL),
|
|
7631
|
-
STEP_WAIT_INTERVAL
|
|
7632
|
-
);
|
|
7633
|
-
} else {
|
|
7634
|
-
process.exit(0);
|
|
7635
|
-
}
|
|
7636
|
-
}
|
|
7637
|
-
function checkForPendingOperations() {
|
|
7638
|
-
const activeHandles = _optionalChain([process, 'access', _251 => _251._getActiveHandles, 'optionalCall', _252 => _252()]) || [];
|
|
7639
|
-
const activeRequests = _optionalChain([process, 'access', _253 => _253._getActiveRequests, 'optionalCall', _254 => _254()]) || [];
|
|
7640
|
-
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
7641
|
-
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
7642
|
-
return false;
|
|
7643
|
-
}
|
|
7644
|
-
if (handle && typeof handle === "object" && "hasRef" in handle && !handle.hasRef()) {
|
|
7645
|
-
return false;
|
|
7646
|
-
}
|
|
7647
|
-
return true;
|
|
7648
|
-
});
|
|
7649
|
-
const hasFileWatchers = nonStandardHandles.some(
|
|
7650
|
-
(handle) => handle && typeof handle === "object" && "close" in handle
|
|
7651
|
-
);
|
|
7652
|
-
const hasPendingPromises = activeRequests.length > 0;
|
|
7653
|
-
return nonStandardHandles.length > 0 || hasFileWatchers || hasPendingPromises;
|
|
7654
|
-
}
|
|
7655
|
-
|
|
7656
7647
|
// src/cli/cmd/i18n.ts
|
|
7657
7648
|
var i18n_default = new (0, _interactivecommander.Command)().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option(
|
|
7658
7649
|
"--locale <locale>",
|
|
@@ -7713,7 +7704,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7713
7704
|
validateParams(i18nConfig, flags);
|
|
7714
7705
|
ora.succeed("Localization configuration is valid");
|
|
7715
7706
|
ora.start("Connecting to Lingo.dev Localization Engine...");
|
|
7716
|
-
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess',
|
|
7707
|
+
const isByokMode = !!_optionalChain([i18nConfig, 'optionalAccess', _251 => _251.provider]);
|
|
7717
7708
|
if (isByokMode) {
|
|
7718
7709
|
authId = null;
|
|
7719
7710
|
ora.succeed("Using external provider (BYOK mode)");
|
|
@@ -7722,21 +7713,21 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7722
7713
|
authId = auth.id;
|
|
7723
7714
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
7724
7715
|
}
|
|
7725
|
-
trackEvent(authId, "cmd.i18n.start", {
|
|
7716
|
+
await trackEvent(authId, "cmd.i18n.start", {
|
|
7726
7717
|
i18nConfig,
|
|
7727
7718
|
flags
|
|
7728
7719
|
});
|
|
7729
7720
|
let buckets = getBuckets(i18nConfig);
|
|
7730
|
-
if (_optionalChain([flags, 'access',
|
|
7721
|
+
if (_optionalChain([flags, 'access', _252 => _252.bucket, 'optionalAccess', _253 => _253.length])) {
|
|
7731
7722
|
buckets = buckets.filter(
|
|
7732
7723
|
(bucket) => flags.bucket.includes(bucket.type)
|
|
7733
7724
|
);
|
|
7734
7725
|
}
|
|
7735
7726
|
ora.succeed("Buckets retrieved");
|
|
7736
|
-
if (_optionalChain([flags, 'access',
|
|
7727
|
+
if (_optionalChain([flags, 'access', _254 => _254.file, 'optionalAccess', _255 => _255.length])) {
|
|
7737
7728
|
buckets = buckets.map((bucket) => {
|
|
7738
7729
|
const paths = bucket.paths.filter(
|
|
7739
|
-
(path17) => flags.file.find((file) => _optionalChain([path17, 'access',
|
|
7730
|
+
(path17) => flags.file.find((file) => _optionalChain([path17, 'access', _256 => _256.pathPattern, 'optionalAccess', _257 => _257.includes, 'call', _258 => _258(file)]))
|
|
7740
7731
|
);
|
|
7741
7732
|
return { ...bucket, paths };
|
|
7742
7733
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -7744,7 +7735,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7744
7735
|
ora.fail(
|
|
7745
7736
|
"No buckets found. All buckets were filtered out by --file option."
|
|
7746
7737
|
);
|
|
7747
|
-
|
|
7738
|
+
throw new Error(
|
|
7739
|
+
"No buckets found. All buckets were filtered out by --file option."
|
|
7740
|
+
);
|
|
7748
7741
|
} else {
|
|
7749
7742
|
ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
|
|
7750
7743
|
buckets.map((bucket) => {
|
|
@@ -7755,7 +7748,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7755
7748
|
});
|
|
7756
7749
|
}
|
|
7757
7750
|
}
|
|
7758
|
-
const targetLocales = _optionalChain([flags, 'access',
|
|
7751
|
+
const targetLocales = _optionalChain([flags, 'access', _259 => _259.locale, 'optionalAccess', _260 => _260.length]) ? flags.locale : i18nConfig.locale.targets;
|
|
7759
7752
|
ora.start("Setting up localization cache...");
|
|
7760
7753
|
const checkLockfileProcessor = createDeltaProcessor("");
|
|
7761
7754
|
const lockfileExists = await checkLockfileProcessor.checkIfLockExists();
|
|
@@ -7869,7 +7862,9 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
7869
7862
|
`Localization data has changed; please update i18n.lock or run without --frozen.`
|
|
7870
7863
|
);
|
|
7871
7864
|
ora.fail(` Details: ${message}`);
|
|
7872
|
-
|
|
7865
|
+
throw new Error(
|
|
7866
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: ${message}`
|
|
7867
|
+
);
|
|
7873
7868
|
} else {
|
|
7874
7869
|
ora.succeed("No lockfile updates required.");
|
|
7875
7870
|
}
|
|
@@ -8014,7 +8009,7 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8014
8009
|
}
|
|
8015
8010
|
const deltaProcessor = createDeltaProcessor(bucketPath.pathPattern);
|
|
8016
8011
|
const checksums = await deltaProcessor.createChecksums(sourceData);
|
|
8017
|
-
if (!_optionalChain([flags, 'access',
|
|
8012
|
+
if (!_optionalChain([flags, 'access', _261 => _261.locale, 'optionalAccess', _262 => _262.length])) {
|
|
8018
8013
|
await deltaProcessor.saveChecksums(checksums);
|
|
8019
8014
|
}
|
|
8020
8015
|
}
|
|
@@ -8033,24 +8028,22 @@ var i18n_default = new (0, _interactivecommander.Command)().command("i18n").desc
|
|
|
8033
8028
|
console.log();
|
|
8034
8029
|
if (!hasErrors) {
|
|
8035
8030
|
ora.succeed("Localization completed.");
|
|
8036
|
-
trackEvent(authId, "cmd.i18n.success", {
|
|
8031
|
+
await trackEvent(authId, "cmd.i18n.success", {
|
|
8037
8032
|
i18nConfig,
|
|
8038
8033
|
flags
|
|
8039
8034
|
});
|
|
8040
8035
|
} else {
|
|
8041
8036
|
ora.warn("Localization completed with errors.");
|
|
8042
|
-
trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8037
|
+
await trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8043
8038
|
flags
|
|
8044
8039
|
});
|
|
8045
8040
|
}
|
|
8046
|
-
exitGracefully();
|
|
8047
8041
|
} catch (error) {
|
|
8048
8042
|
ora.fail(error.message);
|
|
8049
|
-
trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8043
|
+
await trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8050
8044
|
flags,
|
|
8051
8045
|
error
|
|
8052
8046
|
});
|
|
8053
|
-
process.exit(1);
|
|
8054
8047
|
}
|
|
8055
8048
|
});
|
|
8056
8049
|
function parseFlags(options) {
|
|
@@ -8099,12 +8092,12 @@ function validateParams(i18nConfig, flags) {
|
|
|
8099
8092
|
message: "No buckets found in i18n.json. Please add at least one bucket containing i18n content.",
|
|
8100
8093
|
docUrl: "bucketNotFound"
|
|
8101
8094
|
});
|
|
8102
|
-
} else if (_optionalChain([flags, 'access',
|
|
8095
|
+
} else if (_optionalChain([flags, 'access', _263 => _263.locale, 'optionalAccess', _264 => _264.some, 'call', _265 => _265((locale) => !i18nConfig.locale.targets.includes(locale))])) {
|
|
8103
8096
|
throw new CLIError({
|
|
8104
8097
|
message: `One or more specified locales do not exist in i18n.json locale.targets. Please add them to the list and try again.`,
|
|
8105
8098
|
docUrl: "localeTargetNotFound"
|
|
8106
8099
|
});
|
|
8107
|
-
} else if (_optionalChain([flags, 'access',
|
|
8100
|
+
} else if (_optionalChain([flags, 'access', _266 => _266.bucket, 'optionalAccess', _267 => _267.some, 'call', _268 => _268(
|
|
8108
8101
|
(bucket) => !i18nConfig.buckets[bucket]
|
|
8109
8102
|
)])) {
|
|
8110
8103
|
throw new CLIError({
|
|
@@ -8608,7 +8601,7 @@ function createLingoDotDevLocalizer(explicitApiKey) {
|
|
|
8608
8601
|
const response = await engine.whoami();
|
|
8609
8602
|
return {
|
|
8610
8603
|
authenticated: !!response,
|
|
8611
|
-
username: _optionalChain([response, 'optionalAccess',
|
|
8604
|
+
username: _optionalChain([response, 'optionalAccess', _269 => _269.email])
|
|
8612
8605
|
};
|
|
8613
8606
|
} catch (e2) {
|
|
8614
8607
|
return { authenticated: false };
|
|
@@ -8716,7 +8709,7 @@ function createExplicitLocalizer(provider) {
|
|
|
8716
8709
|
}
|
|
8717
8710
|
function createAiSdkLocalizer(params) {
|
|
8718
8711
|
const skipAuth = params.skipAuth === true;
|
|
8719
|
-
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess',
|
|
8712
|
+
const apiKey = process.env[_nullishCoalesce(_optionalChain([params, 'optionalAccess', _270 => _270.apiKeyName]), () => ( ""))];
|
|
8720
8713
|
if (!skipAuth && !apiKey || !params.apiKeyName) {
|
|
8721
8714
|
throw new Error(
|
|
8722
8715
|
_dedent2.default`
|
|
@@ -8841,8 +8834,8 @@ async function setup(input2) {
|
|
|
8841
8834
|
throw new Error(
|
|
8842
8835
|
"No buckets found in i18n.json. Please add at least one bucket containing i18n content."
|
|
8843
8836
|
);
|
|
8844
|
-
} else if (_optionalChain([ctx, 'access',
|
|
8845
|
-
(bucket) => !_optionalChain([ctx, 'access',
|
|
8837
|
+
} else if (_optionalChain([ctx, 'access', _271 => _271.flags, 'access', _272 => _272.bucket, 'optionalAccess', _273 => _273.some, 'call', _274 => _274(
|
|
8838
|
+
(bucket) => !_optionalChain([ctx, 'access', _275 => _275.config, 'optionalAccess', _276 => _276.buckets, 'access', _277 => _277[bucket]])
|
|
8846
8839
|
)])) {
|
|
8847
8840
|
throw new Error(
|
|
8848
8841
|
`One or more specified buckets do not exist in i18n.json. Please add them to the list first and try again.`
|
|
@@ -8855,7 +8848,7 @@ async function setup(input2) {
|
|
|
8855
8848
|
title: "Selecting localization provider",
|
|
8856
8849
|
task: async (ctx, task) => {
|
|
8857
8850
|
ctx.localizer = createLocalizer(
|
|
8858
|
-
_optionalChain([ctx, 'access',
|
|
8851
|
+
_optionalChain([ctx, 'access', _278 => _278.config, 'optionalAccess', _279 => _279.provider]),
|
|
8859
8852
|
ctx.flags.apiKey
|
|
8860
8853
|
);
|
|
8861
8854
|
if (!ctx.localizer) {
|
|
@@ -9174,7 +9167,7 @@ function createWorkerTask(args) {
|
|
|
9174
9167
|
const processableData = _lodash2.default.chain(sourceData).entries().filter(
|
|
9175
9168
|
([key, value]) => delta.added.includes(key) || delta.updated.includes(key) || !!args.ctx.flags.force
|
|
9176
9169
|
).filter(
|
|
9177
|
-
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access',
|
|
9170
|
+
([key]) => !assignedTask.onlyKeys.length || _optionalChain([assignedTask, 'access', _280 => _280.onlyKeys, 'optionalAccess', _281 => _281.some, 'call', _282 => _282(
|
|
9178
9171
|
(pattern) => minimatch(key, pattern)
|
|
9179
9172
|
)])
|
|
9180
9173
|
).fromPairs().value();
|
|
@@ -9237,7 +9230,7 @@ function createWorkerTask(args) {
|
|
|
9237
9230
|
finalRenamedTargetData
|
|
9238
9231
|
);
|
|
9239
9232
|
const checksums2 = await deltaProcessor.createChecksums(sourceData);
|
|
9240
|
-
if (!_optionalChain([args, 'access',
|
|
9233
|
+
if (!_optionalChain([args, 'access', _283 => _283.ctx, 'access', _284 => _284.flags, 'access', _285 => _285.targetLocale, 'optionalAccess', _286 => _286.length])) {
|
|
9241
9234
|
await deltaProcessor.saveChecksums(checksums2);
|
|
9242
9235
|
}
|
|
9243
9236
|
});
|
|
@@ -9427,13 +9420,13 @@ var flagsSchema2 = _zod.z.object({
|
|
|
9427
9420
|
|
|
9428
9421
|
// src/cli/cmd/run/_utils.ts
|
|
9429
9422
|
async function determineAuthId(ctx) {
|
|
9430
|
-
const isByokMode = !!_optionalChain([ctx, 'access',
|
|
9423
|
+
const isByokMode = !!_optionalChain([ctx, 'access', _287 => _287.config, 'optionalAccess', _288 => _288.provider]);
|
|
9431
9424
|
if (isByokMode) {
|
|
9432
9425
|
return null;
|
|
9433
9426
|
} else {
|
|
9434
9427
|
try {
|
|
9435
|
-
const authStatus = await _optionalChain([ctx, 'access',
|
|
9436
|
-
return _optionalChain([authStatus, 'optionalAccess',
|
|
9428
|
+
const authStatus = await _optionalChain([ctx, 'access', _289 => _289.localizer, 'optionalAccess', _290 => _290.checkAuth, 'call', _291 => _291()]);
|
|
9429
|
+
return _optionalChain([authStatus, 'optionalAccess', _292 => _292.username]) || null;
|
|
9437
9430
|
} catch (e3) {
|
|
9438
9431
|
return null;
|
|
9439
9432
|
}
|
|
@@ -9498,7 +9491,7 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
9498
9491
|
await renderSpacer();
|
|
9499
9492
|
await setup(ctx);
|
|
9500
9493
|
authId = await determineAuthId(ctx);
|
|
9501
|
-
trackEvent(authId, "cmd.run.start", {
|
|
9494
|
+
await trackEvent(authId, "cmd.run.start", {
|
|
9502
9495
|
config: ctx.config,
|
|
9503
9496
|
flags: ctx.flags
|
|
9504
9497
|
});
|
|
@@ -9512,14 +9505,13 @@ var run_default = new (0, _interactivecommander.Command)().command("run").descri
|
|
|
9512
9505
|
if (ctx.flags.watch) {
|
|
9513
9506
|
await watch2(ctx);
|
|
9514
9507
|
}
|
|
9515
|
-
trackEvent(authId, "cmd.run.success", {
|
|
9508
|
+
await trackEvent(authId, "cmd.run.success", {
|
|
9516
9509
|
config: ctx.config,
|
|
9517
9510
|
flags: ctx.flags
|
|
9518
9511
|
});
|
|
9519
|
-
exitGracefully();
|
|
9520
9512
|
} catch (error) {
|
|
9521
|
-
trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
9522
|
-
|
|
9513
|
+
await trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
9514
|
+
throw error;
|
|
9523
9515
|
}
|
|
9524
9516
|
});
|
|
9525
9517
|
|
|
@@ -9594,7 +9586,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9594
9586
|
_child_process.execSync.call(void 0, `git config --global safe.directory ${process.cwd()}`);
|
|
9595
9587
|
_child_process.execSync.call(void 0, `git config user.name "${gitConfig.userName}"`);
|
|
9596
9588
|
_child_process.execSync.call(void 0, `git config user.email "${gitConfig.userEmail}"`);
|
|
9597
|
-
_optionalChain([this, 'access',
|
|
9589
|
+
_optionalChain([this, 'access', _293 => _293.platformKit, 'optionalAccess', _294 => _294.gitConfig, 'call', _295 => _295()]);
|
|
9598
9590
|
_child_process.execSync.call(void 0, `git fetch origin ${baseBranchName}`, { stdio: "inherit" });
|
|
9599
9591
|
_child_process.execSync.call(void 0, `git checkout ${baseBranchName} --`, { stdio: "inherit" });
|
|
9600
9592
|
if (!processOwnCommits) {
|
|
@@ -9626,7 +9618,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9626
9618
|
// src/cli/cmd/ci/flows/pull-request.ts
|
|
9627
9619
|
var PullRequestFlow = class extends InBranchFlow {
|
|
9628
9620
|
async preRun() {
|
|
9629
|
-
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall',
|
|
9621
|
+
const canContinue = await _optionalChain([super.preRun.bind(this), 'optionalCall', _296 => _296()]);
|
|
9630
9622
|
if (!canContinue) {
|
|
9631
9623
|
return false;
|
|
9632
9624
|
}
|
|
@@ -9889,10 +9881,10 @@ var BitbucketPlatformKit = class extends PlatformKit {
|
|
|
9889
9881
|
repo_slug: this.platformConfig.repositoryName,
|
|
9890
9882
|
state: "OPEN"
|
|
9891
9883
|
}).then(({ data: { values } }) => {
|
|
9892
|
-
return _optionalChain([values, 'optionalAccess',
|
|
9893
|
-
({ source, destination }) => _optionalChain([source, 'optionalAccess',
|
|
9884
|
+
return _optionalChain([values, 'optionalAccess', _297 => _297.find, 'call', _298 => _298(
|
|
9885
|
+
({ source, destination }) => _optionalChain([source, 'optionalAccess', _299 => _299.branch, 'optionalAccess', _300 => _300.name]) === branch && _optionalChain([destination, 'optionalAccess', _301 => _301.branch, 'optionalAccess', _302 => _302.name]) === this.platformConfig.baseBranchName
|
|
9894
9886
|
)]);
|
|
9895
|
-
}).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9887
|
+
}).then((pr) => _optionalChain([pr, 'optionalAccess', _303 => _303.id]));
|
|
9896
9888
|
}
|
|
9897
9889
|
async closePullRequest({ pullRequestNumber }) {
|
|
9898
9890
|
await this.bb.repositories.declinePullRequest({
|
|
@@ -9988,7 +9980,7 @@ var GitHubPlatformKit = class extends PlatformKit {
|
|
|
9988
9980
|
repo: this.platformConfig.repositoryName,
|
|
9989
9981
|
base: this.platformConfig.baseBranchName,
|
|
9990
9982
|
state: "open"
|
|
9991
|
-
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess',
|
|
9983
|
+
}).then(({ data }) => data[0]).then((pr) => _optionalChain([pr, 'optionalAccess', _304 => _304.number]));
|
|
9992
9984
|
}
|
|
9993
9985
|
async closePullRequest({ pullRequestNumber }) {
|
|
9994
9986
|
await this.octokit.rest.pulls.update({
|
|
@@ -10115,7 +10107,7 @@ var GitlabPlatformKit = class extends PlatformKit {
|
|
|
10115
10107
|
sourceBranch: branch,
|
|
10116
10108
|
state: "opened"
|
|
10117
10109
|
});
|
|
10118
|
-
return _optionalChain([mergeRequests, 'access',
|
|
10110
|
+
return _optionalChain([mergeRequests, 'access', _305 => _305[0], 'optionalAccess', _306 => _306.iid]);
|
|
10119
10111
|
}
|
|
10120
10112
|
async closePullRequest({
|
|
10121
10113
|
pullRequestNumber
|
|
@@ -10205,7 +10197,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10205
10197
|
}
|
|
10206
10198
|
const env = {
|
|
10207
10199
|
LINGODOTDEV_API_KEY: settings.auth.apiKey,
|
|
10208
|
-
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access',
|
|
10200
|
+
LINGODOTDEV_PULL_REQUEST: _optionalChain([options, 'access', _307 => _307.pullRequest, 'optionalAccess', _308 => _308.toString, 'call', _309 => _309()]) || "false",
|
|
10209
10201
|
...options.commitMessage && {
|
|
10210
10202
|
LINGODOTDEV_COMMIT_MESSAGE: options.commitMessage
|
|
10211
10203
|
},
|
|
@@ -10225,7 +10217,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10225
10217
|
const { isPullRequestMode } = platformKit.config;
|
|
10226
10218
|
ora.info(`Pull request mode: ${isPullRequestMode ? "on" : "off"}`);
|
|
10227
10219
|
const flow = isPullRequestMode ? new PullRequestFlow(ora, platformKit) : new InBranchFlow(ora, platformKit);
|
|
10228
|
-
const canRun = await _optionalChain([flow, 'access',
|
|
10220
|
+
const canRun = await _optionalChain([flow, 'access', _310 => _310.preRun, 'optionalCall', _311 => _311()]);
|
|
10229
10221
|
if (canRun === false) {
|
|
10230
10222
|
return;
|
|
10231
10223
|
}
|
|
@@ -10235,7 +10227,7 @@ var ci_default = new (0, _interactivecommander.Command)().command("ci").descript
|
|
|
10235
10227
|
if (!hasChanges) {
|
|
10236
10228
|
return;
|
|
10237
10229
|
}
|
|
10238
|
-
await _optionalChain([flow, 'access',
|
|
10230
|
+
await _optionalChain([flow, 'access', _312 => _312.postRun, 'optionalCall', _313 => _313()]);
|
|
10239
10231
|
});
|
|
10240
10232
|
function parseBooleanArg(val) {
|
|
10241
10233
|
if (val === true) return true;
|
|
@@ -10256,6 +10248,41 @@ function parseBooleanArg(val) {
|
|
|
10256
10248
|
|
|
10257
10249
|
|
|
10258
10250
|
var _clitable3 = require('cli-table3'); var _clitable32 = _interopRequireDefault(_clitable3);
|
|
10251
|
+
|
|
10252
|
+
// src/cli/utils/exit-gracefully.ts
|
|
10253
|
+
var STEP_WAIT_INTERVAL = 250;
|
|
10254
|
+
var MAX_WAIT_INTERVAL = 2e3;
|
|
10255
|
+
function exitGracefully(elapsedMs = 0) {
|
|
10256
|
+
const hasPendingOperations = checkForPendingOperations();
|
|
10257
|
+
if (hasPendingOperations && elapsedMs < MAX_WAIT_INTERVAL) {
|
|
10258
|
+
setTimeout(
|
|
10259
|
+
() => exitGracefully(elapsedMs + STEP_WAIT_INTERVAL),
|
|
10260
|
+
STEP_WAIT_INTERVAL
|
|
10261
|
+
);
|
|
10262
|
+
} else {
|
|
10263
|
+
process.exit(0);
|
|
10264
|
+
}
|
|
10265
|
+
}
|
|
10266
|
+
function checkForPendingOperations() {
|
|
10267
|
+
const activeHandles = _optionalChain([process, 'access', _314 => _314._getActiveHandles, 'optionalCall', _315 => _315()]) || [];
|
|
10268
|
+
const activeRequests = _optionalChain([process, 'access', _316 => _316._getActiveRequests, 'optionalCall', _317 => _317()]) || [];
|
|
10269
|
+
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
10270
|
+
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
10271
|
+
return false;
|
|
10272
|
+
}
|
|
10273
|
+
if (handle && typeof handle === "object" && "hasRef" in handle && !handle.hasRef()) {
|
|
10274
|
+
return false;
|
|
10275
|
+
}
|
|
10276
|
+
return true;
|
|
10277
|
+
});
|
|
10278
|
+
const hasFileWatchers = nonStandardHandles.some(
|
|
10279
|
+
(handle) => handle && typeof handle === "object" && "close" in handle
|
|
10280
|
+
);
|
|
10281
|
+
const hasPendingPromises = activeRequests.length > 0;
|
|
10282
|
+
return nonStandardHandles.length > 0 || hasFileWatchers || hasPendingPromises;
|
|
10283
|
+
}
|
|
10284
|
+
|
|
10285
|
+
// src/cli/cmd/status.ts
|
|
10259
10286
|
var status_default = new (0, _interactivecommander.Command)().command("status").description("Show the status of the localization process").helpOption("-h, --help", "Show help").option(
|
|
10260
10287
|
"--locale <locale>",
|
|
10261
10288
|
"Locale to process",
|
|
@@ -10836,7 +10863,7 @@ async function renderHero2() {
|
|
|
10836
10863
|
// package.json
|
|
10837
10864
|
var package_default = {
|
|
10838
10865
|
name: "lingo.dev",
|
|
10839
|
-
version: "0.111.
|
|
10866
|
+
version: "0.111.3",
|
|
10840
10867
|
description: "Lingo.dev CLI",
|
|
10841
10868
|
private: false,
|
|
10842
10869
|
publishConfig: {
|
|
@@ -11018,7 +11045,7 @@ var package_default = {
|
|
|
11018
11045
|
"p-limit": "^6.2.0",
|
|
11019
11046
|
"php-array-reader": "^2.1.2",
|
|
11020
11047
|
plist: "^3.1.0",
|
|
11021
|
-
"posthog-node": "^5.
|
|
11048
|
+
"posthog-node": "^5.8.1",
|
|
11022
11049
|
prettier: "^3.4.2",
|
|
11023
11050
|
react: "^18.3.1",
|
|
11024
11051
|
"rehype-stringify": "^10.0.1",
|