lingo.dev 0.111.2 → 0.111.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/assets/failure.mp3 +0 -0
- package/assets/success.mp3 +0 -0
- package/build/cli.cjs +150 -88
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +152 -90
- package/build/cli.mjs.map +1 -1
- package/package.json +5 -4
package/build/cli.mjs
CHANGED
|
@@ -926,9 +926,9 @@ function makeGitlabInitializer(spinner) {
|
|
|
926
926
|
|
|
927
927
|
// src/cli/cmd/init.ts
|
|
928
928
|
import open2 from "open";
|
|
929
|
-
var openUrl = (
|
|
929
|
+
var openUrl = (path18) => {
|
|
930
930
|
const settings = getSettings(void 0);
|
|
931
|
-
open2(`${settings.auth.webUrl}${
|
|
931
|
+
open2(`${settings.auth.webUrl}${path18}`, { wait: false });
|
|
932
932
|
};
|
|
933
933
|
var throwHelpError = (option, value) => {
|
|
934
934
|
if (value === "help") {
|
|
@@ -1348,8 +1348,8 @@ var files_default = new Command6().command("files").description("Print out the l
|
|
|
1348
1348
|
} else if (type.target) {
|
|
1349
1349
|
result.push(...targetPaths);
|
|
1350
1350
|
}
|
|
1351
|
-
result.forEach((
|
|
1352
|
-
console.log(
|
|
1351
|
+
result.forEach((path18) => {
|
|
1352
|
+
console.log(path18);
|
|
1353
1353
|
});
|
|
1354
1354
|
}
|
|
1355
1355
|
}
|
|
@@ -1667,8 +1667,8 @@ function extractCommentsFromJsonc(jsoncString) {
|
|
|
1667
1667
|
const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
|
|
1668
1668
|
if (keyMatch) {
|
|
1669
1669
|
const key = keyMatch[1];
|
|
1670
|
-
const
|
|
1671
|
-
keyInfo = { key, path:
|
|
1670
|
+
const path18 = contextStack.map((ctx) => ctx.key).filter(Boolean);
|
|
1671
|
+
keyInfo = { key, path: path18 };
|
|
1672
1672
|
}
|
|
1673
1673
|
} else {
|
|
1674
1674
|
keyInfo = findAssociatedKey(lines, commentData.lineIndex, contextStack);
|
|
@@ -1752,8 +1752,8 @@ function findAssociatedKey(lines, commentLineIndex, contextStack) {
|
|
|
1752
1752
|
const keyMatch = line.match(/^\s*["']?([^"':,\s]+)["']?\s*:/);
|
|
1753
1753
|
if (keyMatch) {
|
|
1754
1754
|
const key = keyMatch[1];
|
|
1755
|
-
const
|
|
1756
|
-
return { key, path:
|
|
1755
|
+
const path18 = contextStack.map((ctx) => ctx.key).filter(Boolean);
|
|
1756
|
+
return { key, path: path18 };
|
|
1757
1757
|
}
|
|
1758
1758
|
}
|
|
1759
1759
|
return { key: null, path: [] };
|
|
@@ -1772,9 +1772,9 @@ function updateContext(contextStack, line, parsedJson) {
|
|
|
1772
1772
|
}
|
|
1773
1773
|
}
|
|
1774
1774
|
}
|
|
1775
|
-
function setCommentAtPath(comments,
|
|
1775
|
+
function setCommentAtPath(comments, path18, key, hint) {
|
|
1776
1776
|
let current = comments;
|
|
1777
|
-
for (const pathKey of
|
|
1777
|
+
for (const pathKey of path18) {
|
|
1778
1778
|
if (!current[pathKey]) {
|
|
1779
1779
|
current[pathKey] = {};
|
|
1780
1780
|
}
|
|
@@ -2435,9 +2435,9 @@ function createHtmlLoader() {
|
|
|
2435
2435
|
const bDepth = b.split("/").length;
|
|
2436
2436
|
return aDepth - bDepth;
|
|
2437
2437
|
});
|
|
2438
|
-
paths.forEach((
|
|
2439
|
-
const value = data[
|
|
2440
|
-
const [nodePath, attribute] =
|
|
2438
|
+
paths.forEach((path18) => {
|
|
2439
|
+
const value = data[path18];
|
|
2440
|
+
const [nodePath, attribute] = path18.split("#");
|
|
2441
2441
|
const [rootTag, ...indices] = nodePath.split("/");
|
|
2442
2442
|
let parent = rootTag === "head" ? document.head : document.body;
|
|
2443
2443
|
let current = parent;
|
|
@@ -4080,24 +4080,24 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
|
|
|
4080
4080
|
}
|
|
4081
4081
|
function serializeStructuredText(rawStructuredText) {
|
|
4082
4082
|
return serializeStructuredTextNode(rawStructuredText);
|
|
4083
|
-
function serializeStructuredTextNode(node,
|
|
4083
|
+
function serializeStructuredTextNode(node, path18 = [], acc = {}) {
|
|
4084
4084
|
if ("document" in node) {
|
|
4085
4085
|
return serializeStructuredTextNode(
|
|
4086
4086
|
node.document,
|
|
4087
|
-
[...
|
|
4087
|
+
[...path18, "document"],
|
|
4088
4088
|
acc
|
|
4089
4089
|
);
|
|
4090
4090
|
}
|
|
4091
4091
|
if (!_18.isNil(node.value)) {
|
|
4092
|
-
acc[[...
|
|
4092
|
+
acc[[...path18, "value"].join(".")] = node.value;
|
|
4093
4093
|
} else if (_18.get(node, "type") === "block") {
|
|
4094
|
-
acc[[...
|
|
4094
|
+
acc[[...path18, "item"].join(".")] = serializeBlock(node.item);
|
|
4095
4095
|
}
|
|
4096
4096
|
if (node.children) {
|
|
4097
4097
|
for (let i = 0; i < node.children.length; i++) {
|
|
4098
4098
|
serializeStructuredTextNode(
|
|
4099
4099
|
node.children[i],
|
|
4100
|
-
[...
|
|
4100
|
+
[...path18, i.toString()],
|
|
4101
4101
|
acc
|
|
4102
4102
|
);
|
|
4103
4103
|
}
|
|
@@ -4164,8 +4164,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
|
|
|
4164
4164
|
}
|
|
4165
4165
|
function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
|
|
4166
4166
|
const result = _18.cloneDeep(originalRawStructuredText);
|
|
4167
|
-
for (const [
|
|
4168
|
-
const realPath = _18.chain(
|
|
4167
|
+
for (const [path18, value] of _18.entries(parsedStructuredText)) {
|
|
4168
|
+
const realPath = _18.chain(path18.split(".")).flatMap((s) => !_18.isNaN(_18.toNumber(s)) ? ["children", s] : s).value();
|
|
4169
4169
|
const deserializedValue = createRawDatoValue(
|
|
4170
4170
|
value,
|
|
4171
4171
|
_18.get(originalRawStructuredText, realPath),
|
|
@@ -4591,15 +4591,15 @@ function parseTypeScript(input2) {
|
|
|
4591
4591
|
function extractStringsFromDefaultExport(ast) {
|
|
4592
4592
|
let extracted = {};
|
|
4593
4593
|
traverse(ast, {
|
|
4594
|
-
ExportDefaultDeclaration(
|
|
4595
|
-
const { declaration } =
|
|
4594
|
+
ExportDefaultDeclaration(path18) {
|
|
4595
|
+
const { declaration } = path18.node;
|
|
4596
4596
|
const decl = unwrapTSAsExpression(declaration);
|
|
4597
4597
|
if (t.isObjectExpression(decl)) {
|
|
4598
4598
|
extracted = objectExpressionToObject(decl);
|
|
4599
4599
|
} else if (t.isArrayExpression(decl)) {
|
|
4600
4600
|
extracted = arrayExpressionToArray(decl);
|
|
4601
4601
|
} else if (t.isIdentifier(decl)) {
|
|
4602
|
-
const binding =
|
|
4602
|
+
const binding = path18.scope.bindings[decl.name];
|
|
4603
4603
|
if (binding && t.isVariableDeclarator(binding.path.node) && binding.path.node.init) {
|
|
4604
4604
|
const initRaw = binding.path.node.init;
|
|
4605
4605
|
const init = initRaw ? unwrapTSAsExpression(initRaw) : initRaw;
|
|
@@ -4664,8 +4664,8 @@ function arrayExpressionToArray(arrayExpression) {
|
|
|
4664
4664
|
function updateStringsInDefaultExport(ast, data) {
|
|
4665
4665
|
let modified = false;
|
|
4666
4666
|
traverse(ast, {
|
|
4667
|
-
ExportDefaultDeclaration(
|
|
4668
|
-
const { declaration } =
|
|
4667
|
+
ExportDefaultDeclaration(path18) {
|
|
4668
|
+
const { declaration } = path18.node;
|
|
4669
4669
|
const decl = unwrapTSAsExpression(declaration);
|
|
4670
4670
|
if (t.isObjectExpression(decl)) {
|
|
4671
4671
|
modified = updateStringsInObjectExpression(decl, data) || modified;
|
|
@@ -4674,7 +4674,7 @@ function updateStringsInDefaultExport(ast, data) {
|
|
|
4674
4674
|
modified = updateStringsInArrayExpression(decl, data) || modified;
|
|
4675
4675
|
}
|
|
4676
4676
|
} else if (t.isIdentifier(decl)) {
|
|
4677
|
-
modified = updateStringsInExportedIdentifier(
|
|
4677
|
+
modified = updateStringsInExportedIdentifier(path18, data) || modified;
|
|
4678
4678
|
}
|
|
4679
4679
|
}
|
|
4680
4680
|
});
|
|
@@ -4745,9 +4745,9 @@ function updateStringsInArrayExpression(arrayExpression, incoming) {
|
|
|
4745
4745
|
});
|
|
4746
4746
|
return modified;
|
|
4747
4747
|
}
|
|
4748
|
-
function updateStringsInExportedIdentifier(
|
|
4749
|
-
const exportName =
|
|
4750
|
-
const binding =
|
|
4748
|
+
function updateStringsInExportedIdentifier(path18, data) {
|
|
4749
|
+
const exportName = path18.node.declaration.name;
|
|
4750
|
+
const binding = path18.scope.bindings[exportName];
|
|
4751
4751
|
if (!binding || !binding.path.node) return false;
|
|
4752
4752
|
if (t.isVariableDeclarator(binding.path.node) && binding.path.node.init) {
|
|
4753
4753
|
const initRaw = binding.path.node.init;
|
|
@@ -6349,11 +6349,11 @@ function _getAllKeys(obj, prefix = "") {
|
|
|
6349
6349
|
let keys = [];
|
|
6350
6350
|
for (const key in obj) {
|
|
6351
6351
|
if (!Object.prototype.hasOwnProperty.call(obj, key)) continue;
|
|
6352
|
-
const
|
|
6352
|
+
const path18 = prefix ? `${prefix}.${key}` : key;
|
|
6353
6353
|
if (typeof obj[key] === "object" && obj[key] !== null && !Array.isArray(obj[key])) {
|
|
6354
|
-
keys = keys.concat(_getAllKeys(obj[key],
|
|
6354
|
+
keys = keys.concat(_getAllKeys(obj[key], path18));
|
|
6355
6355
|
} else {
|
|
6356
|
-
keys.push(
|
|
6356
|
+
keys.push(path18);
|
|
6357
6357
|
}
|
|
6358
6358
|
}
|
|
6359
6359
|
return keys;
|
|
@@ -6866,19 +6866,19 @@ function createJsonDictionaryLoader() {
|
|
|
6866
6866
|
);
|
|
6867
6867
|
return input2;
|
|
6868
6868
|
}
|
|
6869
|
-
function walk(obj, dataNode,
|
|
6869
|
+
function walk(obj, dataNode, path18 = []) {
|
|
6870
6870
|
if (Array.isArray(obj) && Array.isArray(dataNode)) {
|
|
6871
6871
|
obj.forEach(
|
|
6872
|
-
(item, idx) => walk(item, dataNode[idx], [...
|
|
6872
|
+
(item, idx) => walk(item, dataNode[idx], [...path18, String(idx)])
|
|
6873
6873
|
);
|
|
6874
6874
|
} else if (obj && typeof obj === "object" && dataNode && typeof dataNode === "object" && !Array.isArray(dataNode)) {
|
|
6875
6875
|
for (const key of Object.keys(obj)) {
|
|
6876
6876
|
if (dataNode.hasOwnProperty(key)) {
|
|
6877
|
-
walk(obj[key], dataNode[key], [...
|
|
6877
|
+
walk(obj[key], dataNode[key], [...path18, key]);
|
|
6878
6878
|
}
|
|
6879
6879
|
}
|
|
6880
6880
|
} else if (obj && typeof obj === "object" && !Array.isArray(obj) && typeof dataNode === "string") {
|
|
6881
|
-
setNestedLocale(input2,
|
|
6881
|
+
setNestedLocale(input2, path18, locale, dataNode, originalLocale);
|
|
6882
6882
|
}
|
|
6883
6883
|
}
|
|
6884
6884
|
walk(input2, data);
|
|
@@ -6906,14 +6906,14 @@ function extractTranslatables(obj, locale) {
|
|
|
6906
6906
|
function isTranslatableObject(obj, locale) {
|
|
6907
6907
|
return obj && typeof obj === "object" && !Array.isArray(obj) && Object.prototype.hasOwnProperty.call(obj, locale);
|
|
6908
6908
|
}
|
|
6909
|
-
function setNestedLocale(obj,
|
|
6909
|
+
function setNestedLocale(obj, path18, locale, value, originalLocale) {
|
|
6910
6910
|
let curr = obj;
|
|
6911
|
-
for (let i = 0; i <
|
|
6912
|
-
const key =
|
|
6911
|
+
for (let i = 0; i < path18.length - 1; i++) {
|
|
6912
|
+
const key = path18[i];
|
|
6913
6913
|
if (!(key in curr)) curr[key] = {};
|
|
6914
6914
|
curr = curr[key];
|
|
6915
6915
|
}
|
|
6916
|
-
const last =
|
|
6916
|
+
const last = path18[path18.length - 1];
|
|
6917
6917
|
if (curr[last] && typeof curr[last] === "object") {
|
|
6918
6918
|
curr[last][locale] = value;
|
|
6919
6919
|
if (originalLocale && curr[last][originalLocale]) {
|
|
@@ -7463,42 +7463,63 @@ function withExponentialBackoff(fn, maxAttempts = 3, baseDelay = 1e3) {
|
|
|
7463
7463
|
|
|
7464
7464
|
// src/cli/utils/observability.ts
|
|
7465
7465
|
import pkg from "node-machine-id";
|
|
7466
|
+
import https from "https";
|
|
7466
7467
|
var { machineIdSync } = pkg;
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
flushAt: 1,
|
|
7474
|
-
flushInterval: 0
|
|
7475
|
-
}
|
|
7476
|
-
);
|
|
7477
|
-
return posthog;
|
|
7478
|
-
}
|
|
7479
|
-
async function trackEvent(distinctId, event, properties) {
|
|
7480
|
-
if (process.env.DO_NOT_TRACK) {
|
|
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") {
|
|
7481
7474
|
return;
|
|
7482
7475
|
}
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
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 = https.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);
|
|
7494
7508
|
}
|
|
7509
|
+
});
|
|
7510
|
+
req.write(payload);
|
|
7511
|
+
req.end();
|
|
7512
|
+
setTimeout(() => {
|
|
7513
|
+
if (!req.destroyed) {
|
|
7514
|
+
req.destroy();
|
|
7515
|
+
}
|
|
7516
|
+
}, REQUEST_TIMEOUT_MS);
|
|
7517
|
+
} catch (error) {
|
|
7518
|
+
if (process.env.DEBUG === "true") {
|
|
7519
|
+
console.error("[Tracking] Failed to send event:", error);
|
|
7495
7520
|
}
|
|
7496
|
-
});
|
|
7497
|
-
} catch (error) {
|
|
7498
|
-
if (process.env.DEBUG) {
|
|
7499
|
-
console.error(error);
|
|
7500
7521
|
}
|
|
7501
|
-
}
|
|
7522
|
+
});
|
|
7502
7523
|
}
|
|
7503
7524
|
|
|
7504
7525
|
// src/cli/utils/delta.ts
|
|
@@ -7706,7 +7727,7 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7706
7727
|
if (flags.file?.length) {
|
|
7707
7728
|
buckets = buckets.map((bucket) => {
|
|
7708
7729
|
const paths = bucket.paths.filter(
|
|
7709
|
-
(
|
|
7730
|
+
(path18) => flags.file.find((file) => path18.pathPattern?.includes(file))
|
|
7710
7731
|
);
|
|
7711
7732
|
return { ...bucket, paths };
|
|
7712
7733
|
}).filter((bucket) => bucket.paths.length > 0);
|
|
@@ -7721,8 +7742,8 @@ var i18n_default = new Command12().command("i18n").description("Run Localization
|
|
|
7721
7742
|
ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
|
|
7722
7743
|
buckets.map((bucket) => {
|
|
7723
7744
|
ora.info(` ${bucket.type}:`);
|
|
7724
|
-
bucket.paths.forEach((
|
|
7725
|
-
ora.info(` - ${
|
|
7745
|
+
bucket.paths.forEach((path18) => {
|
|
7746
|
+
ora.info(` - ${path18.pathPattern}`);
|
|
7726
7747
|
});
|
|
7727
7748
|
});
|
|
7728
7749
|
}
|
|
@@ -8512,7 +8533,7 @@ import { execSync as execSync2 } from "child_process";
|
|
|
8512
8533
|
|
|
8513
8534
|
// src/cli/cmd/ci/flows/in-branch.ts
|
|
8514
8535
|
import { execSync } from "child_process";
|
|
8515
|
-
import
|
|
8536
|
+
import path17 from "path";
|
|
8516
8537
|
|
|
8517
8538
|
// src/cli/cmd/ci/flows/_base.ts
|
|
8518
8539
|
var IntegrationFlow = class {
|
|
@@ -8532,6 +8553,10 @@ function escapeShellArg(arg) {
|
|
|
8532
8553
|
|
|
8533
8554
|
// src/cli/cmd/run/index.ts
|
|
8534
8555
|
import { Command as Command16 } from "interactive-commander";
|
|
8556
|
+
import { exec } from "child_process";
|
|
8557
|
+
import path16 from "path";
|
|
8558
|
+
import { fileURLToPath } from "url";
|
|
8559
|
+
import os2 from "os";
|
|
8535
8560
|
|
|
8536
8561
|
// src/cli/cmd/run/setup.ts
|
|
8537
8562
|
import chalk10 from "chalk";
|
|
@@ -9275,14 +9300,14 @@ async function watch2(ctx) {
|
|
|
9275
9300
|
pollInterval: 100
|
|
9276
9301
|
}
|
|
9277
9302
|
});
|
|
9278
|
-
watcher.on("change", (
|
|
9279
|
-
handleFileChange(
|
|
9303
|
+
watcher.on("change", (path18) => {
|
|
9304
|
+
handleFileChange(path18, state, ctx);
|
|
9280
9305
|
});
|
|
9281
|
-
watcher.on("add", (
|
|
9282
|
-
handleFileChange(
|
|
9306
|
+
watcher.on("add", (path18) => {
|
|
9307
|
+
handleFileChange(path18, state, ctx);
|
|
9283
9308
|
});
|
|
9284
|
-
watcher.on("unlink", (
|
|
9285
|
-
handleFileChange(
|
|
9309
|
+
watcher.on("unlink", (path18) => {
|
|
9310
|
+
handleFileChange(path18, state, ctx);
|
|
9286
9311
|
});
|
|
9287
9312
|
watcher.on("error", (error) => {
|
|
9288
9313
|
console.error(
|
|
@@ -9393,8 +9418,9 @@ var flagsSchema2 = z2.object({
|
|
|
9393
9418
|
sourceLocale: z2.string().optional(),
|
|
9394
9419
|
targetLocale: z2.array(z2.string()).optional(),
|
|
9395
9420
|
watch: z2.boolean().default(false),
|
|
9396
|
-
debounce: z2.number().positive().default(5e3)
|
|
9421
|
+
debounce: z2.number().positive().default(5e3),
|
|
9397
9422
|
// 5 seconds default
|
|
9423
|
+
sound: z2.boolean().optional()
|
|
9398
9424
|
});
|
|
9399
9425
|
|
|
9400
9426
|
// src/cli/cmd/run/_utils.ts
|
|
@@ -9413,6 +9439,32 @@ async function determineAuthId(ctx) {
|
|
|
9413
9439
|
}
|
|
9414
9440
|
|
|
9415
9441
|
// src/cli/cmd/run/index.ts
|
|
9442
|
+
var __dirname = path16.dirname(fileURLToPath(import.meta.url));
|
|
9443
|
+
function playSound(type) {
|
|
9444
|
+
const platform = os2.platform();
|
|
9445
|
+
return new Promise((resolve) => {
|
|
9446
|
+
const assetDir = path16.join(__dirname, "../assets");
|
|
9447
|
+
const soundFiles = [path16.join(assetDir, `${type}.mp3`)];
|
|
9448
|
+
let command = "";
|
|
9449
|
+
if (platform === "linux") {
|
|
9450
|
+
command = soundFiles.map(
|
|
9451
|
+
(file) => `mpg123 -q "${file}" 2>/dev/null || aplay "${file}" 2>/dev/null`
|
|
9452
|
+
).join(" || ");
|
|
9453
|
+
} else if (platform === "darwin") {
|
|
9454
|
+
command = soundFiles.map((file) => `afplay "${file}"`).join(" || ");
|
|
9455
|
+
} else if (platform === "win32") {
|
|
9456
|
+
command = `powershell -c "try { (New-Object Media.SoundPlayer '${soundFiles[1]}').PlaySync() } catch { Start-Process -FilePath '${soundFiles[0]}' -WindowStyle Hidden -Wait }"`;
|
|
9457
|
+
} else {
|
|
9458
|
+
command = soundFiles.map(
|
|
9459
|
+
(file) => `aplay "${file}" 2>/dev/null || afplay "${file}" 2>/dev/null`
|
|
9460
|
+
).join(" || ");
|
|
9461
|
+
}
|
|
9462
|
+
exec(command, () => {
|
|
9463
|
+
resolve();
|
|
9464
|
+
});
|
|
9465
|
+
setTimeout(resolve, 3e3);
|
|
9466
|
+
});
|
|
9467
|
+
}
|
|
9416
9468
|
var run_default = new Command16().command("run").description("Run Lingo.dev localization engine").helpOption("-h, --help", "Show help").option(
|
|
9417
9469
|
"--source-locale <source-locale>",
|
|
9418
9470
|
"Locale to use as source locale. Defaults to i18n.json locale.source"
|
|
@@ -9452,6 +9504,9 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
9452
9504
|
"--debounce <milliseconds>",
|
|
9453
9505
|
"Debounce delay in milliseconds for watch mode (default: 5000ms)",
|
|
9454
9506
|
(val) => parseInt(val)
|
|
9507
|
+
).option(
|
|
9508
|
+
"--sound",
|
|
9509
|
+
"Play sound on completion, partially completion and failed of the task"
|
|
9455
9510
|
).action(async (args) => {
|
|
9456
9511
|
let authId = null;
|
|
9457
9512
|
try {
|
|
@@ -9481,6 +9536,9 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
9481
9536
|
await renderSpacer();
|
|
9482
9537
|
await renderSummary(ctx.results);
|
|
9483
9538
|
await renderSpacer();
|
|
9539
|
+
if (ctx.flags.sound) {
|
|
9540
|
+
await playSound("success");
|
|
9541
|
+
}
|
|
9484
9542
|
if (ctx.flags.watch) {
|
|
9485
9543
|
await watch2(ctx);
|
|
9486
9544
|
}
|
|
@@ -9490,6 +9548,9 @@ var run_default = new Command16().command("run").description("Run Lingo.dev loca
|
|
|
9490
9548
|
});
|
|
9491
9549
|
} catch (error) {
|
|
9492
9550
|
await trackEvent(authId || "unknown", "cmd.run.error", {});
|
|
9551
|
+
if (args.sound) {
|
|
9552
|
+
await playSound("failure");
|
|
9553
|
+
}
|
|
9493
9554
|
throw error;
|
|
9494
9555
|
}
|
|
9495
9556
|
});
|
|
@@ -9580,7 +9641,7 @@ var InBranchFlow = class extends IntegrationFlow {
|
|
|
9580
9641
|
return false;
|
|
9581
9642
|
}
|
|
9582
9643
|
}
|
|
9583
|
-
const workingDir =
|
|
9644
|
+
const workingDir = path17.resolve(
|
|
9584
9645
|
process.cwd(),
|
|
9585
9646
|
this.platformKit.config.workingDir
|
|
9586
9647
|
);
|
|
@@ -10319,8 +10380,8 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
10319
10380
|
if (flags.file?.length) {
|
|
10320
10381
|
buckets = buckets.map((bucket) => {
|
|
10321
10382
|
const paths = bucket.paths.filter(
|
|
10322
|
-
(
|
|
10323
|
-
(file) =>
|
|
10383
|
+
(path18) => flags.file.find(
|
|
10384
|
+
(file) => path18.pathPattern?.includes(file) || path18.pathPattern?.match(file) || minimatch(path18.pathPattern, file)
|
|
10324
10385
|
)
|
|
10325
10386
|
);
|
|
10326
10387
|
return { ...bucket, paths };
|
|
@@ -10334,8 +10395,8 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
10334
10395
|
ora.info(`\x1B[36mProcessing only filtered buckets:\x1B[0m`);
|
|
10335
10396
|
buckets.map((bucket) => {
|
|
10336
10397
|
ora.info(` ${bucket.type}:`);
|
|
10337
|
-
bucket.paths.forEach((
|
|
10338
|
-
ora.info(` - ${
|
|
10398
|
+
bucket.paths.forEach((path18) => {
|
|
10399
|
+
ora.info(` - ${path18.pathPattern}`);
|
|
10339
10400
|
});
|
|
10340
10401
|
});
|
|
10341
10402
|
}
|
|
@@ -10619,10 +10680,10 @@ var status_default = new Command18().command("status").description("Show the sta
|
|
|
10619
10680
|
if (flags.confirm && Object.keys(fileStats).length > 0) {
|
|
10620
10681
|
console.log(chalk14.bold(`
|
|
10621
10682
|
\u{1F4D1} BREAKDOWN BY FILE:`));
|
|
10622
|
-
Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([
|
|
10683
|
+
Object.entries(fileStats).sort((a, b) => b[1].wordCount - a[1].wordCount).forEach(([path18, stats]) => {
|
|
10623
10684
|
if (stats.sourceKeys === 0) return;
|
|
10624
10685
|
console.log(chalk14.bold(`
|
|
10625
|
-
\u2022 ${
|
|
10686
|
+
\u2022 ${path18}:`));
|
|
10626
10687
|
console.log(
|
|
10627
10688
|
` ${stats.sourceKeys} source keys, ~${stats.wordCount.toLocaleString()} source words`
|
|
10628
10689
|
);
|
|
@@ -10842,7 +10903,7 @@ async function renderHero2() {
|
|
|
10842
10903
|
// package.json
|
|
10843
10904
|
var package_default = {
|
|
10844
10905
|
name: "lingo.dev",
|
|
10845
|
-
version: "0.111.
|
|
10906
|
+
version: "0.111.4",
|
|
10846
10907
|
description: "Lingo.dev CLI",
|
|
10847
10908
|
private: false,
|
|
10848
10909
|
publishConfig: {
|
|
@@ -10940,7 +11001,8 @@ var package_default = {
|
|
|
10940
11001
|
},
|
|
10941
11002
|
files: [
|
|
10942
11003
|
"bin",
|
|
10943
|
-
"build"
|
|
11004
|
+
"build",
|
|
11005
|
+
"assets"
|
|
10944
11006
|
],
|
|
10945
11007
|
scripts: {
|
|
10946
11008
|
"lingo.dev": "node --inspect=9229 ./bin/cli.mjs",
|