@localess/cli 0.0.1-dev.20260222000532 → 0.0.1-dev.20260222174722
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/dist/index.js +15 -8
- package/dist/index.mjs +15 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -310,7 +310,7 @@ function localessClient(options) {
|
|
|
310
310
|
return {};
|
|
311
311
|
}
|
|
312
312
|
},
|
|
313
|
-
async updateTranslations(locale, type, values) {
|
|
313
|
+
async updateTranslations(locale, type, values, dryRun) {
|
|
314
314
|
if (options.debug) {
|
|
315
315
|
console.log(LOG_GROUP, "updateTranslations() locale : ", locale);
|
|
316
316
|
console.log(LOG_GROUP, "updateTranslations() type : ", type);
|
|
@@ -322,7 +322,8 @@ function localessClient(options) {
|
|
|
322
322
|
}
|
|
323
323
|
const body = {
|
|
324
324
|
type,
|
|
325
|
-
values
|
|
325
|
+
values,
|
|
326
|
+
dryRun
|
|
326
327
|
};
|
|
327
328
|
try {
|
|
328
329
|
const response = await fetchWithRetry(url, {
|
|
@@ -590,7 +591,7 @@ var zTranslationUpdateSchema = import_zod.z.object({
|
|
|
590
591
|
});
|
|
591
592
|
|
|
592
593
|
// src/commands/translations/push/index.ts
|
|
593
|
-
var translationsPushCommand = new import_commander5.Command("push").argument("<locale>", "Locale to push").description("Push locale translations to Localess").requiredOption("-p, --path <path>", "Path to the translations file to push").option("-f, --format <format>", `File format. Possible values are : ${Object.values(TranslationFileFormat)}`, "flat" /* FLAT */).option("-t, --type <type>", `Push type. Possible values are : ${Object.values(TranslationUpdateType)}`, "add-missing" /* ADD_MISSING */).action(async (locale, options) => {
|
|
594
|
+
var translationsPushCommand = new import_commander5.Command("push").argument("<locale>", "Locale to push").description("Push locale translations to Localess").requiredOption("-p, --path <path>", "Path to the translations file to push").option("-f, --format <format>", `File format. Possible values are : ${Object.values(TranslationFileFormat)}`, "flat" /* FLAT */).option("-t, --type <type>", `Push type. Possible values are : ${Object.values(TranslationUpdateType)}`, "add-missing" /* ADD_MISSING */).option("-dr, --dry-run", "Preview changes without applying them to Localess").action(async (locale, options) => {
|
|
594
595
|
console.log("Pushing translations with arguments:", locale);
|
|
595
596
|
console.log("Pushing translations with options:", options);
|
|
596
597
|
if (!zTranslationUpdateTypeSchema.safeParse(options.type).success) {
|
|
@@ -608,6 +609,9 @@ var translationsPushCommand = new import_commander5.Command("push").argument("<l
|
|
|
608
609
|
spaceId: session.space,
|
|
609
610
|
token: session.token
|
|
610
611
|
});
|
|
612
|
+
if (options.dryRun) {
|
|
613
|
+
console.warn("Dry run mode enabled: No changes will be made.");
|
|
614
|
+
}
|
|
611
615
|
if (options.format === "nested" /* NESTED */) {
|
|
612
616
|
console.error("Nested format is not implemented yet. Please use flat format for now.");
|
|
613
617
|
}
|
|
@@ -620,12 +624,15 @@ var translationsPushCommand = new import_commander5.Command("push").argument("<l
|
|
|
620
624
|
return;
|
|
621
625
|
}
|
|
622
626
|
console.log("Pushing translations to Localess with locale:", locale, "and type:", options.type);
|
|
623
|
-
const
|
|
624
|
-
if (
|
|
627
|
+
const response = await client.updateTranslations(locale, options.type, translationValues, options.dryRun);
|
|
628
|
+
if (response) {
|
|
629
|
+
if (response.dryRun) {
|
|
630
|
+
console.log("Dry run results:");
|
|
631
|
+
}
|
|
625
632
|
console.log("Successfully pushed translations to Localess");
|
|
626
|
-
console.log("Summary:",
|
|
627
|
-
if (
|
|
628
|
-
console.log("Updated translation IDs:",
|
|
633
|
+
console.log("Summary:", response.message);
|
|
634
|
+
if (response.ids) {
|
|
635
|
+
console.log("Updated translation IDs:", response.ids);
|
|
629
636
|
}
|
|
630
637
|
} else {
|
|
631
638
|
console.log("Something went wrong while pushing translations to Localess");
|
package/dist/index.mjs
CHANGED
|
@@ -287,7 +287,7 @@ function localessClient(options) {
|
|
|
287
287
|
return {};
|
|
288
288
|
}
|
|
289
289
|
},
|
|
290
|
-
async updateTranslations(locale, type, values) {
|
|
290
|
+
async updateTranslations(locale, type, values, dryRun) {
|
|
291
291
|
if (options.debug) {
|
|
292
292
|
console.log(LOG_GROUP, "updateTranslations() locale : ", locale);
|
|
293
293
|
console.log(LOG_GROUP, "updateTranslations() type : ", type);
|
|
@@ -299,7 +299,8 @@ function localessClient(options) {
|
|
|
299
299
|
}
|
|
300
300
|
const body = {
|
|
301
301
|
type,
|
|
302
|
-
values
|
|
302
|
+
values,
|
|
303
|
+
dryRun
|
|
303
304
|
};
|
|
304
305
|
try {
|
|
305
306
|
const response = await fetchWithRetry(url, {
|
|
@@ -567,7 +568,7 @@ var zTranslationUpdateSchema = z.object({
|
|
|
567
568
|
});
|
|
568
569
|
|
|
569
570
|
// src/commands/translations/push/index.ts
|
|
570
|
-
var translationsPushCommand = new Command5("push").argument("<locale>", "Locale to push").description("Push locale translations to Localess").requiredOption("-p, --path <path>", "Path to the translations file to push").option("-f, --format <format>", `File format. Possible values are : ${Object.values(TranslationFileFormat)}`, "flat" /* FLAT */).option("-t, --type <type>", `Push type. Possible values are : ${Object.values(TranslationUpdateType)}`, "add-missing" /* ADD_MISSING */).action(async (locale, options) => {
|
|
571
|
+
var translationsPushCommand = new Command5("push").argument("<locale>", "Locale to push").description("Push locale translations to Localess").requiredOption("-p, --path <path>", "Path to the translations file to push").option("-f, --format <format>", `File format. Possible values are : ${Object.values(TranslationFileFormat)}`, "flat" /* FLAT */).option("-t, --type <type>", `Push type. Possible values are : ${Object.values(TranslationUpdateType)}`, "add-missing" /* ADD_MISSING */).option("-dr, --dry-run", "Preview changes without applying them to Localess").action(async (locale, options) => {
|
|
571
572
|
console.log("Pushing translations with arguments:", locale);
|
|
572
573
|
console.log("Pushing translations with options:", options);
|
|
573
574
|
if (!zTranslationUpdateTypeSchema.safeParse(options.type).success) {
|
|
@@ -585,6 +586,9 @@ var translationsPushCommand = new Command5("push").argument("<locale>", "Locale
|
|
|
585
586
|
spaceId: session.space,
|
|
586
587
|
token: session.token
|
|
587
588
|
});
|
|
589
|
+
if (options.dryRun) {
|
|
590
|
+
console.warn("Dry run mode enabled: No changes will be made.");
|
|
591
|
+
}
|
|
588
592
|
if (options.format === "nested" /* NESTED */) {
|
|
589
593
|
console.error("Nested format is not implemented yet. Please use flat format for now.");
|
|
590
594
|
}
|
|
@@ -597,12 +601,15 @@ var translationsPushCommand = new Command5("push").argument("<locale>", "Locale
|
|
|
597
601
|
return;
|
|
598
602
|
}
|
|
599
603
|
console.log("Pushing translations to Localess with locale:", locale, "and type:", options.type);
|
|
600
|
-
const
|
|
601
|
-
if (
|
|
604
|
+
const response = await client.updateTranslations(locale, options.type, translationValues, options.dryRun);
|
|
605
|
+
if (response) {
|
|
606
|
+
if (response.dryRun) {
|
|
607
|
+
console.log("Dry run results:");
|
|
608
|
+
}
|
|
602
609
|
console.log("Successfully pushed translations to Localess");
|
|
603
|
-
console.log("Summary:",
|
|
604
|
-
if (
|
|
605
|
-
console.log("Updated translation IDs:",
|
|
610
|
+
console.log("Summary:", response.message);
|
|
611
|
+
if (response.ids) {
|
|
612
|
+
console.log("Updated translation IDs:", response.ids);
|
|
606
613
|
}
|
|
607
614
|
} else {
|
|
608
615
|
console.log("Something went wrong while pushing translations to Localess");
|