@localess/cli 0.0.1-dev.20260221224153 → 0.0.1-dev.20260222174414
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 +1 -1
- package/dist/index.js +9 -4
- package/dist/index.mjs +9 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ localess translations push <locale> --path <file> [--format <flat|nested>] [--ty
|
|
|
58
58
|
- `<locale>`: Locale code (e.g., `en`)
|
|
59
59
|
- `--path`: Path to the translations file to push (required)
|
|
60
60
|
- `--format`: File format (`flat` or `nested`, default: `flat`). **Note:** Only `flat` format is currently supported for push.
|
|
61
|
-
- `--type`: Push type (`add-missing`, `
|
|
61
|
+
- `--type`: Push type (`add-missing`, `update-existing`, `delete-missing`. Default: `add-missing`)
|
|
62
62
|
|
|
63
63
|
### Pull Translations
|
|
64
64
|
Pull translations from Localess and save locally.
|
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, {
|
|
@@ -571,6 +572,7 @@ var import_commander5 = require("commander");
|
|
|
571
572
|
var TranslationUpdateType = /* @__PURE__ */ ((TranslationUpdateType2) => {
|
|
572
573
|
TranslationUpdateType2["ADD_MISSING"] = "add-missing";
|
|
573
574
|
TranslationUpdateType2["UPDATE_EXISTING"] = "update-existing";
|
|
575
|
+
TranslationUpdateType2["DELETE_MISSING"] = "delete-missing";
|
|
574
576
|
return TranslationUpdateType2;
|
|
575
577
|
})(TranslationUpdateType || {});
|
|
576
578
|
var TranslationFileFormat = /* @__PURE__ */ ((TranslationFileFormat2) => {
|
|
@@ -589,7 +591,7 @@ var zTranslationUpdateSchema = import_zod.z.object({
|
|
|
589
591
|
});
|
|
590
592
|
|
|
591
593
|
// src/commands/translations/push/index.ts
|
|
592
|
-
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) => {
|
|
593
595
|
console.log("Pushing translations with arguments:", locale);
|
|
594
596
|
console.log("Pushing translations with options:", options);
|
|
595
597
|
if (!zTranslationUpdateTypeSchema.safeParse(options.type).success) {
|
|
@@ -607,6 +609,9 @@ var translationsPushCommand = new import_commander5.Command("push").argument("<l
|
|
|
607
609
|
spaceId: session.space,
|
|
608
610
|
token: session.token
|
|
609
611
|
});
|
|
612
|
+
if (options.dryRun) {
|
|
613
|
+
console.warn("Dry run mode enabled: No changes will be made.");
|
|
614
|
+
}
|
|
610
615
|
if (options.format === "nested" /* NESTED */) {
|
|
611
616
|
console.error("Nested format is not implemented yet. Please use flat format for now.");
|
|
612
617
|
}
|
|
@@ -619,7 +624,7 @@ var translationsPushCommand = new import_commander5.Command("push").argument("<l
|
|
|
619
624
|
return;
|
|
620
625
|
}
|
|
621
626
|
console.log("Pushing translations to Localess with locale:", locale, "and type:", options.type);
|
|
622
|
-
const message = await client.updateTranslations(locale, options.type, translationValues);
|
|
627
|
+
const message = await client.updateTranslations(locale, options.type, translationValues, options.dryRun);
|
|
623
628
|
if (message) {
|
|
624
629
|
console.log("Successfully pushed translations to Localess");
|
|
625
630
|
console.log("Summary:", message.message);
|
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, {
|
|
@@ -548,6 +549,7 @@ import { Command as Command5 } from "commander";
|
|
|
548
549
|
var TranslationUpdateType = /* @__PURE__ */ ((TranslationUpdateType2) => {
|
|
549
550
|
TranslationUpdateType2["ADD_MISSING"] = "add-missing";
|
|
550
551
|
TranslationUpdateType2["UPDATE_EXISTING"] = "update-existing";
|
|
552
|
+
TranslationUpdateType2["DELETE_MISSING"] = "delete-missing";
|
|
551
553
|
return TranslationUpdateType2;
|
|
552
554
|
})(TranslationUpdateType || {});
|
|
553
555
|
var TranslationFileFormat = /* @__PURE__ */ ((TranslationFileFormat2) => {
|
|
@@ -566,7 +568,7 @@ var zTranslationUpdateSchema = z.object({
|
|
|
566
568
|
});
|
|
567
569
|
|
|
568
570
|
// src/commands/translations/push/index.ts
|
|
569
|
-
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) => {
|
|
570
572
|
console.log("Pushing translations with arguments:", locale);
|
|
571
573
|
console.log("Pushing translations with options:", options);
|
|
572
574
|
if (!zTranslationUpdateTypeSchema.safeParse(options.type).success) {
|
|
@@ -584,6 +586,9 @@ var translationsPushCommand = new Command5("push").argument("<locale>", "Locale
|
|
|
584
586
|
spaceId: session.space,
|
|
585
587
|
token: session.token
|
|
586
588
|
});
|
|
589
|
+
if (options.dryRun) {
|
|
590
|
+
console.warn("Dry run mode enabled: No changes will be made.");
|
|
591
|
+
}
|
|
587
592
|
if (options.format === "nested" /* NESTED */) {
|
|
588
593
|
console.error("Nested format is not implemented yet. Please use flat format for now.");
|
|
589
594
|
}
|
|
@@ -596,7 +601,7 @@ var translationsPushCommand = new Command5("push").argument("<locale>", "Locale
|
|
|
596
601
|
return;
|
|
597
602
|
}
|
|
598
603
|
console.log("Pushing translations to Localess with locale:", locale, "and type:", options.type);
|
|
599
|
-
const message = await client.updateTranslations(locale, options.type, translationValues);
|
|
604
|
+
const message = await client.updateTranslations(locale, options.type, translationValues, options.dryRun);
|
|
600
605
|
if (message) {
|
|
601
606
|
console.log("Successfully pushed translations to Localess");
|
|
602
607
|
console.log("Summary:", message.message);
|