lingo.dev 0.74.9 → 0.74.10
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 +27 -22
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +45 -40
- package/build/cli.mjs.map +1 -1
- package/package.json +2 -2
package/build/cli.cjs
CHANGED
|
@@ -265,12 +265,13 @@ function _getConfigFilePath() {
|
|
|
265
265
|
// src/cli/cmd/init.ts
|
|
266
266
|
|
|
267
267
|
|
|
268
|
+
|
|
268
269
|
var _child_process = require('child_process');
|
|
269
270
|
|
|
270
271
|
var _prompts = require('@inquirer/prompts');
|
|
271
|
-
var openUrl = (
|
|
272
|
+
var openUrl = (path9) => {
|
|
272
273
|
const settings = getSettings(void 0);
|
|
273
|
-
_child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${
|
|
274
|
+
_child_process.spawn.call(void 0, "open", [`${settings.auth.webUrl}${path9}`]);
|
|
274
275
|
};
|
|
275
276
|
var throwHelpError = (option, value) => {
|
|
276
277
|
if (value === "help") {
|
|
@@ -311,20 +312,22 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
311
312
|
return value;
|
|
312
313
|
}).default("json")
|
|
313
314
|
).addOption(
|
|
314
|
-
new (0, _interactivecommander.InteractiveOption)("-p, --paths
|
|
315
|
+
new (0, _interactivecommander.InteractiveOption)("-p, --paths [path...]", "List of paths for the bucket").argParser((value) => {
|
|
316
|
+
if (!value || value.length === 0) return [];
|
|
315
317
|
const values = value.includes(",") ? value.split(",") : value.split(" ");
|
|
316
|
-
for (const
|
|
318
|
+
for (const p of values) {
|
|
317
319
|
try {
|
|
318
|
-
const
|
|
320
|
+
const dirPath = _path2.default.dirname(p);
|
|
321
|
+
const stats = _fs2.default.statSync(dirPath);
|
|
319
322
|
if (!stats.isDirectory()) {
|
|
320
|
-
throw new Error(`${
|
|
323
|
+
throw new Error(`${dirPath} is not a directory`);
|
|
321
324
|
}
|
|
322
325
|
} catch (err) {
|
|
323
|
-
throw new Error(`Invalid
|
|
326
|
+
throw new Error(`Invalid path: ${p}`);
|
|
324
327
|
}
|
|
325
328
|
}
|
|
326
329
|
return values;
|
|
327
|
-
}).default(
|
|
330
|
+
}).default([])
|
|
328
331
|
).action(async (options) => {
|
|
329
332
|
const settings = getSettings(void 0);
|
|
330
333
|
const spinner = _ora2.default.call(void 0, ).start("Initializing Lingo.dev project");
|
|
@@ -337,7 +340,9 @@ var init_default = new (0, _interactivecommander.InteractiveCommand)().command("
|
|
|
337
340
|
newConfig.locale.source = options.source;
|
|
338
341
|
newConfig.locale.targets = options.targets;
|
|
339
342
|
newConfig.buckets = {
|
|
340
|
-
[options.bucket]:
|
|
343
|
+
[options.bucket]: {
|
|
344
|
+
include: options.paths || []
|
|
345
|
+
}
|
|
341
346
|
};
|
|
342
347
|
await saveConfig(newConfig);
|
|
343
348
|
spinner.succeed("Lingo.dev project initialized");
|
|
@@ -550,8 +555,8 @@ var files_default = new (0, _interactivecommander.Command)().command("files").de
|
|
|
550
555
|
} else if (type.target) {
|
|
551
556
|
result.push(...targetPaths);
|
|
552
557
|
}
|
|
553
|
-
result.forEach((
|
|
554
|
-
console.log(
|
|
558
|
+
result.forEach((path9) => {
|
|
559
|
+
console.log(path9);
|
|
555
560
|
});
|
|
556
561
|
}
|
|
557
562
|
}
|
|
@@ -1008,9 +1013,9 @@ function createHtmlLoader() {
|
|
|
1008
1013
|
const bDepth = b.split("/").length;
|
|
1009
1014
|
return aDepth - bDepth;
|
|
1010
1015
|
});
|
|
1011
|
-
paths.forEach((
|
|
1012
|
-
const value = data[
|
|
1013
|
-
const [nodePath, attribute] =
|
|
1016
|
+
paths.forEach((path9) => {
|
|
1017
|
+
const value = data[path9];
|
|
1018
|
+
const [nodePath, attribute] = path9.split("#");
|
|
1014
1019
|
const [rootTag, ...indices] = nodePath.split("/");
|
|
1015
1020
|
let parent = rootTag === "head" ? document.head : document.body;
|
|
1016
1021
|
let current = parent;
|
|
@@ -2014,18 +2019,18 @@ function createRawDatoValue(parsedDatoValue, originalRawDatoValue, isClean = fal
|
|
|
2014
2019
|
}
|
|
2015
2020
|
function serializeStructuredText(rawStructuredText) {
|
|
2016
2021
|
return serializeStructuredTextNode(rawStructuredText);
|
|
2017
|
-
function serializeStructuredTextNode(node,
|
|
2022
|
+
function serializeStructuredTextNode(node, path9 = [], acc = {}) {
|
|
2018
2023
|
if ("document" in node) {
|
|
2019
|
-
return serializeStructuredTextNode(node.document, [...
|
|
2024
|
+
return serializeStructuredTextNode(node.document, [...path9, "document"], acc);
|
|
2020
2025
|
}
|
|
2021
2026
|
if (!_lodash2.default.isNil(node.value)) {
|
|
2022
|
-
acc[[...
|
|
2027
|
+
acc[[...path9, "value"].join(".")] = node.value;
|
|
2023
2028
|
} else if (_lodash2.default.get(node, "type") === "block") {
|
|
2024
|
-
acc[[...
|
|
2029
|
+
acc[[...path9, "item"].join(".")] = serializeBlock(node.item);
|
|
2025
2030
|
}
|
|
2026
2031
|
if (node.children) {
|
|
2027
2032
|
for (let i = 0; i < node.children.length; i++) {
|
|
2028
|
-
serializeStructuredTextNode(node.children[i], [...
|
|
2033
|
+
serializeStructuredTextNode(node.children[i], [...path9, i.toString()], acc);
|
|
2029
2034
|
}
|
|
2030
2035
|
}
|
|
2031
2036
|
return acc;
|
|
@@ -2084,8 +2089,8 @@ function deserializeBlockList(parsedBlockList, originalRawBlockList, isClean = f
|
|
|
2084
2089
|
}
|
|
2085
2090
|
function deserializeStructuredText(parsedStructuredText, originalRawStructuredText) {
|
|
2086
2091
|
const result = _lodash2.default.cloneDeep(originalRawStructuredText);
|
|
2087
|
-
for (const [
|
|
2088
|
-
const realPath = _lodash2.default.chain(
|
|
2092
|
+
for (const [path9, value] of _lodash2.default.entries(parsedStructuredText)) {
|
|
2093
|
+
const realPath = _lodash2.default.chain(path9.split(".")).flatMap((s) => !_lodash2.default.isNaN(_lodash2.default.toNumber(s)) ? ["children", s] : s).value();
|
|
2089
2094
|
const deserializedValue = createRawDatoValue(value, _lodash2.default.get(originalRawStructuredText, realPath), true);
|
|
2090
2095
|
_lodash2.default.set(result, realPath, deserializedValue);
|
|
2091
2096
|
}
|
|
@@ -3158,7 +3163,7 @@ function displaySummary(results) {
|
|
|
3158
3163
|
// package.json
|
|
3159
3164
|
var package_default = {
|
|
3160
3165
|
name: "lingo.dev",
|
|
3161
|
-
version: "0.74.
|
|
3166
|
+
version: "0.74.10",
|
|
3162
3167
|
description: "Lingo.dev CLI",
|
|
3163
3168
|
private: false,
|
|
3164
3169
|
publishConfig: {
|