lingo.dev 0.111.1 → 0.111.2
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 +92 -86
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +64 -58
- package/build/cli.mjs.map +1 -1
- package/package.json +4 -4
package/build/cli.mjs
CHANGED
|
@@ -7464,21 +7464,25 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
|
|
|
7464
7464
|
// src/cli/utils/observability.ts
|
|
7465
7465
|
import pkg from "node-machine-id";
|
|
7466
7466
|
var { machineIdSync } = pkg;
|
|
7467
|
+
async function createPosthogClient() {
|
|
7468
|
+
const { PostHog } = await import("posthog-node");
|
|
7469
|
+
const posthog = new PostHog(
|
|
7470
|
+
"phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk",
|
|
7471
|
+
{
|
|
7472
|
+
host: "https://eu.i.posthog.com",
|
|
7473
|
+
flushAt: 1,
|
|
7474
|
+
flushInterval: 0
|
|
7475
|
+
}
|
|
7476
|
+
);
|
|
7477
|
+
return posthog;
|
|
7478
|
+
}
|
|
7467
7479
|
async function trackEvent(distinctId, event, properties) {
|
|
7468
7480
|
if (process.env.DO_NOT_TRACK) {
|
|
7469
7481
|
return;
|
|
7470
7482
|
}
|
|
7471
7483
|
try {
|
|
7472
7484
|
const actualId = distinctId || `device-${machineIdSync()}`;
|
|
7473
|
-
const
|
|
7474
|
-
const posthog = new PostHog(
|
|
7475
|
-
"phc_eR0iSoQufBxNY36k0f0T15UvHJdTfHlh8rJcxsfhfXk",
|
|
7476
|
-
{
|
|
7477
|
-
host: "https://eu.i.posthog.com",
|
|
7478
|
-
flushAt: 1,
|
|
7479
|
-
flushInterval: 0
|
|
7480
|
-
}
|
|
7481
|
-
);
|
|
7485
|
+
const posthog = await createPosthogClient();
|
|
7482
7486
|
await posthog.capture({
|
|
7483
7487
|
distinctId: actualId,
|
|
7484
7488
|
event,
|
|
@@ -7490,7 +7494,6 @@ async function trackEvent(distinctId, event, properties) {
|
|
|
7490
7494
|
}
|
|
7491
7495
|
}
|
|
7492
7496
|
});
|
|
7493
|
-
await posthog.shutdown();
|
|
7494
7497
|
} catch (error) {
|
|
7495
7498
|
if (process.env.DEBUG) {
|
|
7496
7499
|
console.error(error);
|
|
@@ -7620,39 +7623,6 @@ function createDeltaProcessor(fileKey) {
|
|
|
7620
7623
|
};
|
|
7621
7624
|
}
|
|
7622
7625
|
|
|
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 = process._getActiveHandles?.() || [];
|
|
7639
|
-
const activeRequests = process._getActiveRequests?.() || [];
|
|
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
7626
|
// src/cli/cmd/i18n.ts
|
|
7657
7627
|
var i18n_default = new Command12().command("i18n").description("Run Localization engine").helpOption("-h, --help", "Show help").option(
|
|
7658
7628
|
"--locale <locale>",
|
|
@@ -7722,7 +7692,7 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7722
7692
|
authId = auth.id;
|
|
7723
7693
|
ora.succeed(`Authenticated as ${auth.email}`);
|
|
7724
7694
|
}
|
|
7725
|
-
trackEvent(authId, "cmd.i18n.start", {
|
|
7695
|
+
await trackEvent(authId, "cmd.i18n.start", {
|
|
7726
7696
|
i18nConfig,
|
|
7727
7697
|
flags
|
|
7728
7698
|
});
|
|
@@ -7744,7 +7714,9 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7744
7714
|
ora.fail(
|
|
7745
7715
|
"No buckets found. All buckets were filtered out by --file option."
|
|
7746
7716
|
);
|
|
7747
|
-
|
|
7717
|
+
throw new Error(
|
|
7718
|
+
"No buckets found. All buckets were filtered out by --file option."
|
|
7719
|
+
);
|
|
7748
7720
|
} else {
|
|
7749
7721
|
ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
|
|
7750
7722
|
buckets.map((bucket) => {
|
|
@@ -7869,7 +7841,9 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7869
7841
|
`Localization data has changed; please update i18n.lock or run without --frozen.`
|
|
7870
7842
|
);
|
|
7871
7843
|
ora.fail(` Details: ${message}`);
|
|
7872
|
-
|
|
7844
|
+
throw new Error(
|
|
7845
|
+
`Localization data has changed; please update i18n.lock or run without --frozen. Details: ${message}`
|
|
7846
|
+
);
|
|
7873
7847
|
} else {
|
|
7874
7848
|
ora.succeed("No lockfile updates required.");
|
|
7875
7849
|
}
|
|
@@ -8033,24 +8007,22 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
8033
8007
|
console.log();
|
|
8034
8008
|
if (!hasErrors) {
|
|
8035
8009
|
ora.succeed("Localization completed.");
|
|
8036
|
-
trackEvent(authId, "cmd.i18n.success", {
|
|
8010
|
+
await trackEvent(authId, "cmd.i18n.success", {
|
|
8037
8011
|
i18nConfig,
|
|
8038
8012
|
flags
|
|
8039
8013
|
});
|
|
8040
8014
|
} else {
|
|
8041
8015
|
ora.warn("Localization completed with errors.");
|
|
8042
|
-
trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8016
|
+
await trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8043
8017
|
flags
|
|
8044
8018
|
});
|
|
8045
8019
|
}
|
|
8046
|
-
exitGracefully();
|
|
8047
8020
|
} catch (error) {
|
|
8048
8021
|
ora.fail(error.message);
|
|
8049
|
-
trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8022
|
+
await trackEvent(authId || "unknown", "cmd.i18n.error", {
|
|
8050
8023
|
flags,
|
|
8051
8024
|
error
|
|
8052
8025
|
});
|
|
8053
|
-
process.exit(1);
|
|
8054
8026
|
}
|
|
8055
8027
|
});
|
|
8056
8028
|
function parseFlags(options) {
|
|
@@ -9498,7 +9470,7 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
9498
9470
|
await renderSpacer();
|
|
9499
9471
|
await setup(ctx);
|
|
9500
9472
|
authId = await determineAuthId(ctx);
|
|
9501
|
-
trackEvent(authId, "cmd.run.start", {
|
|
9473
|
+
await trackEvent(authId, "cmd.run.start", {
|
|
9502
9474
|
config: ctx.config,
|
|
9503
9475
|
flags: ctx.flags
|
|
9504
9476
|
});
|
|
@@ -9512,14 +9484,13 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
9512
9484
|
if (ctx.flags.watch) {
|
|
9513
9485
|
await watch2(ctx);
|
|
9514
9486
|
}
|
|
9515
|
-
trackEvent(authId, "cmd.run.success", {
|
|
9487
|
+
await trackEvent(authId, "cmd.run.success", {
|
|
9516
9488
|
config: ctx.config,
|
|
9517
9489
|
flags: ctx.flags
|
|
9518
9490
|
});
|
|
9519
|
-
exitGracefully();
|
|
9520
9491
|
} catch (error) {
|
|
9521
|
-
trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
9522
|
-
|
|
9492
|
+
await trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
9493
|
+
throw error;
|
|
9523
9494
|
}
|
|
9524
9495
|
});
|
|
9525
9496
|
|
|
@@ -10256,6 +10227,41 @@ import Z11 from "zod";
|
|
|
10256
10227
|
import Ora10 from "ora";
|
|
10257
10228
|
import chalk14 from "chalk";
|
|
10258
10229
|
import Table from "cli-table3";
|
|
10230
|
+
|
|
10231
|
+
// src/cli/utils/exit-gracefully.ts
|
|
10232
|
+
var STEP_WAIT_INTERVAL = 250;
|
|
10233
|
+
var MAX_WAIT_INTERVAL = 2e3;
|
|
10234
|
+
function exitGracefully(elapsedMs = 0) {
|
|
10235
|
+
const hasPendingOperations = checkForPendingOperations();
|
|
10236
|
+
if (hasPendingOperations && elapsedMs < MAX_WAIT_INTERVAL) {
|
|
10237
|
+
setTimeout(
|
|
10238
|
+
() => exitGracefully(elapsedMs + STEP_WAIT_INTERVAL),
|
|
10239
|
+
STEP_WAIT_INTERVAL
|
|
10240
|
+
);
|
|
10241
|
+
} else {
|
|
10242
|
+
process.exit(0);
|
|
10243
|
+
}
|
|
10244
|
+
}
|
|
10245
|
+
function checkForPendingOperations() {
|
|
10246
|
+
const activeHandles = process._getActiveHandles?.() || [];
|
|
10247
|
+
const activeRequests = process._getActiveRequests?.() || [];
|
|
10248
|
+
const nonStandardHandles = activeHandles.filter((handle) => {
|
|
10249
|
+
if (handle === process.stdin || handle === process.stdout || handle === process.stderr) {
|
|
10250
|
+
return false;
|
|
10251
|
+
}
|
|
10252
|
+
if (handle && typeof handle === "object" && "hasRef" in handle && !handle.hasRef()) {
|
|
10253
|
+
return false;
|
|
10254
|
+
}
|
|
10255
|
+
return true;
|
|
10256
|
+
});
|
|
10257
|
+
const hasFileWatchers = nonStandardHandles.some(
|
|
10258
|
+
(handle) => handle && typeof handle === "object" && "close" in handle
|
|
10259
|
+
);
|
|
10260
|
+
const hasPendingPromises = activeRequests.length > 0;
|
|
10261
|
+
return nonStandardHandles.length > 0 || hasFileWatchers || hasPendingPromises;
|
|
10262
|
+
}
|
|
10263
|
+
|
|
10264
|
+
// src/cli/cmd/status.ts
|
|
10259
10265
|
var status_default = new Command18().command("status").description("Show the status of the localization process").helpOption("-h, --help", "Show help").option(
|
|
10260
10266
|
"--locale <locale>",
|
|
10261
10267
|
"Locale to process",
|
|
@@ -10836,7 +10842,7 @@ async function renderHero2() {
|
|
|
10836
10842
|
// package.json
|
|
10837
10843
|
var package_default = {
|
|
10838
10844
|
name: "lingo.dev",
|
|
10839
|
-
version: "0.111.
|
|
10845
|
+
version: "0.111.2",
|
|
10840
10846
|
description: "Lingo.dev CLI",
|
|
10841
10847
|
private: false,
|
|
10842
10848
|
publishConfig: {
|
|
@@ -11018,7 +11024,7 @@ var package_default = {
|
|
|
11018
11024
|
"p-limit": "^6.2.0",
|
|
11019
11025
|
"php-array-reader": "^2.1.2",
|
|
11020
11026
|
plist: "^3.1.0",
|
|
11021
|
-
"posthog-node": "^5.
|
|
11027
|
+
"posthog-node": "^5.8.1",
|
|
11022
11028
|
prettier: "^3.4.2",
|
|
11023
11029
|
react: "^18.3.1",
|
|
11024
11030
|
"rehype-stringify": "^10.0.1",
|