lingo.dev 0.74.13 → 0.74.15
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 +18 -9
- package/build/cli.cjs.map +1 -1
- package/build/cli.mjs +18 -9
- package/build/cli.mjs.map +1 -1
- package/package.json +3 -3
package/build/cli.cjs
CHANGED
|
@@ -958,20 +958,24 @@ function createCsvLoader() {
|
|
|
958
958
|
return createLoader({
|
|
959
959
|
async pull(locale, _input) {
|
|
960
960
|
const input = _sync.parse.call(void 0, _input, {
|
|
961
|
-
columns: true
|
|
961
|
+
columns: true,
|
|
962
|
+
skip_empty_lines: true
|
|
962
963
|
});
|
|
963
964
|
const result = {};
|
|
964
965
|
_lodash2.default.forEach(input, (row) => {
|
|
965
966
|
const key = row.id;
|
|
966
|
-
if (key && row[locale]) {
|
|
967
|
+
if (key && row[locale] && row[locale].trim() !== "") {
|
|
967
968
|
result[key] = row[locale];
|
|
968
969
|
}
|
|
969
970
|
});
|
|
970
971
|
return result;
|
|
971
972
|
},
|
|
972
973
|
async push(locale, data, originalInput) {
|
|
973
|
-
const input = _sync.parse.call(void 0, originalInput || "", {
|
|
974
|
-
|
|
974
|
+
const input = _sync.parse.call(void 0, originalInput || "", {
|
|
975
|
+
columns: true,
|
|
976
|
+
skip_empty_lines: true
|
|
977
|
+
});
|
|
978
|
+
const columns = input.length > 0 ? Object.keys(input[0]) : ["id", locale];
|
|
975
979
|
const updatedRows = input.map((row) => ({
|
|
976
980
|
...row,
|
|
977
981
|
[locale]: data[row.id] || row[locale] || ""
|
|
@@ -979,13 +983,18 @@ function createCsvLoader() {
|
|
|
979
983
|
const existingKeys = new Set(input.map((row) => row.id));
|
|
980
984
|
Object.entries(data).forEach(([key, value]) => {
|
|
981
985
|
if (!existingKeys.has(key)) {
|
|
982
|
-
|
|
986
|
+
const newRow = {
|
|
983
987
|
id: key,
|
|
984
|
-
...Object.fromEntries(columns.map((column) => [column,
|
|
985
|
-
}
|
|
988
|
+
...Object.fromEntries(columns.map((column) => [column, ""]))
|
|
989
|
+
};
|
|
990
|
+
newRow[locale] = value;
|
|
991
|
+
updatedRows.push(newRow);
|
|
986
992
|
}
|
|
987
993
|
});
|
|
988
|
-
return _sync3.stringify.call(void 0, updatedRows, {
|
|
994
|
+
return _sync3.stringify.call(void 0, updatedRows, {
|
|
995
|
+
header: true,
|
|
996
|
+
columns
|
|
997
|
+
});
|
|
989
998
|
}
|
|
990
999
|
});
|
|
991
1000
|
}
|
|
@@ -3224,7 +3233,7 @@ function displaySummary(results) {
|
|
|
3224
3233
|
// package.json
|
|
3225
3234
|
var package_default = {
|
|
3226
3235
|
name: "lingo.dev",
|
|
3227
|
-
version: "0.74.
|
|
3236
|
+
version: "0.74.15",
|
|
3228
3237
|
description: "Lingo.dev CLI",
|
|
3229
3238
|
private: false,
|
|
3230
3239
|
publishConfig: {
|