@localess/cli 0.0.1-dev.20260221221032 → 0.0.1-dev.20260222000532

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 CHANGED
@@ -13,8 +13,8 @@ A powerful CLI tool to interact with your Localess spaces.
13
13
  ## Features
14
14
 
15
15
  - 🔐 **Authentication** - Secure login system and CI environments.
16
- - 🛡️ **Type Safety** - Generate TypeScript type definitions for your Localess content schemas, ensuring type safety in your frontend applications.
17
16
  - 🌐 **Translations** - Sync and manage translations for your Localess space.
17
+ - 🛡️ **Type Safety** - Generate TypeScript type definitions for your Localess content schemas, ensuring type safety in your frontend applications.
18
18
 
19
19
  ## Setup
20
20
 
@@ -45,17 +45,43 @@ The CLI provides a `logout` command to clear your authentication token and log y
45
45
  localess logout
46
46
  ```
47
47
 
48
+ ## Translations Management
49
+
50
+ The CLI provides a `translations` command with `push` and `pull` subcommands to sync and manage translations for your Localess space.
51
+
52
+ ### Push Translations
53
+ Push local translation files to Localess.
54
+
55
+ ```bash
56
+ localess translations push <locale> --path <file> [--format <flat|nested>] [--type <add-missing|replace>]
57
+ ```
58
+ - `<locale>`: Locale code (e.g., `en`)
59
+ - `--path`: Path to the translations file to push (required)
60
+ - `--format`: File format (`flat` or `nested`, default: `flat`). **Note:** Only `flat` format is currently supported for push.
61
+ - `--type`: Push type (`add-missing`, `update-existing`, `delete-missing`. Default: `add-missing`)
62
+
63
+ ### Pull Translations
64
+ Pull translations from Localess and save locally.
65
+
66
+ ```bash
67
+ localess translations pull <locale> --path <file> [--format <flat|nested>]
68
+ ```
69
+ - `<locale>`: Locale code (e.g., `en`)
70
+ - `--path`: Path where the translations file will be saved (required)
71
+ - `--format`: File format (`flat` or `nested`, default: `flat`)
72
+
48
73
  ## Generate TypeScript Types
49
74
 
50
- The CLI provides a `types` command to generate TypeScript definitions for your Localess content schemas. This command fetches your space's OpenAPI schema and writes a `localess.d.ts` file to your project, allowing for strong typing in your codebase.
75
+ The CLI provides a `types generate` command to generate TypeScript definitions for your Localess content schemas. This command fetches your space's OpenAPI schema and writes a `localess.d.ts` file to your project, allowing for strong typing in your codebase.
51
76
 
52
77
  ### Usage
53
78
 
54
79
  ```bash
55
- localess types
80
+ localess types generate [--path <output_file>]
56
81
  ```
82
+ - `--path`: Path to the file where to save the generated types. Default is `.localess/localess.d.ts` in your current working directory.
57
83
 
58
84
  - You must be logged in (`localess login`) before running this command.
59
- - The generated types file will be saved as `./.localess/localess.d.ts` in your current working directory.
85
+ - The generated types file will be saved as `./.localess/localess.d.ts` by default.
60
86
 
61
87
  You can then import these types in your TypeScript project for improved type safety when working with Localess content.
package/dist/index.js CHANGED
@@ -527,7 +527,7 @@ var import_openapi_typescript = __toESM(require("openapi-typescript"));
527
527
  var import_node_path3 = require("path");
528
528
  var import_node_process = __toESM(require("process"));
529
529
  var TYPES_PATH = (0, import_node_path3.join)(import_node_process.default.cwd(), DEFAULT_CONFIG_DIR, "localess.d.ts");
530
- var typesGenerateCommand = new import_commander3.Command("generate").description("Generate types for your schemas").option("-f, --file <path>", "Path to the file where to save the generated types. Default is .localess/localess.d.ts", TYPES_PATH).action(async (options) => {
530
+ var typesGenerateCommand = new import_commander3.Command("generate").description("Generate types for your schemas").option("-p, --path <path>", "Path to the file where to save the generated types. Default is .localess/localess.d.ts", TYPES_PATH).action(async (options) => {
531
531
  console.log("Types in with options:", options);
532
532
  const session = await getSession();
533
533
  if (!session.isLoggedIn) {
@@ -551,8 +551,8 @@ var typesGenerateCommand = new import_commander3.Command("generate").description
551
551
  };
552
552
  const ast = await (0, import_openapi_typescript.default)(minimalSpec, { exportType: true, rootTypes: true, rootTypesNoSchemaPrefix: true });
553
553
  const contents = (0, import_openapi_typescript.astToString)(ast);
554
- await writeFile(options.file, contents);
555
- console.log(`Types generated successfully at ${options.file}`);
554
+ await writeFile(options.path, contents);
555
+ console.log(`Types generated successfully at ${options.path}`);
556
556
  } catch (e) {
557
557
  console.error(e);
558
558
  }
@@ -571,6 +571,7 @@ var import_commander5 = require("commander");
571
571
  var TranslationUpdateType = /* @__PURE__ */ ((TranslationUpdateType2) => {
572
572
  TranslationUpdateType2["ADD_MISSING"] = "add-missing";
573
573
  TranslationUpdateType2["UPDATE_EXISTING"] = "update-existing";
574
+ TranslationUpdateType2["DELETE_MISSING"] = "delete-missing";
574
575
  return TranslationUpdateType2;
575
576
  })(TranslationUpdateType || {});
576
577
  var TranslationFileFormat = /* @__PURE__ */ ((TranslationFileFormat2) => {
package/dist/index.mjs CHANGED
@@ -504,7 +504,7 @@ import openapiTS, { astToString } from "openapi-typescript";
504
504
  import { join as join2 } from "path";
505
505
  import process3 from "process";
506
506
  var TYPES_PATH = join2(process3.cwd(), DEFAULT_CONFIG_DIR, "localess.d.ts");
507
- var typesGenerateCommand = new Command3("generate").description("Generate types for your schemas").option("-f, --file <path>", "Path to the file where to save the generated types. Default is .localess/localess.d.ts", TYPES_PATH).action(async (options) => {
507
+ var typesGenerateCommand = new Command3("generate").description("Generate types for your schemas").option("-p, --path <path>", "Path to the file where to save the generated types. Default is .localess/localess.d.ts", TYPES_PATH).action(async (options) => {
508
508
  console.log("Types in with options:", options);
509
509
  const session = await getSession();
510
510
  if (!session.isLoggedIn) {
@@ -528,8 +528,8 @@ var typesGenerateCommand = new Command3("generate").description("Generate types
528
528
  };
529
529
  const ast = await openapiTS(minimalSpec, { exportType: true, rootTypes: true, rootTypesNoSchemaPrefix: true });
530
530
  const contents = astToString(ast);
531
- await writeFile(options.file, contents);
532
- console.log(`Types generated successfully at ${options.file}`);
531
+ await writeFile(options.path, contents);
532
+ console.log(`Types generated successfully at ${options.path}`);
533
533
  } catch (e) {
534
534
  console.error(e);
535
535
  }
@@ -548,6 +548,7 @@ import { Command as Command5 } from "commander";
548
548
  var TranslationUpdateType = /* @__PURE__ */ ((TranslationUpdateType2) => {
549
549
  TranslationUpdateType2["ADD_MISSING"] = "add-missing";
550
550
  TranslationUpdateType2["UPDATE_EXISTING"] = "update-existing";
551
+ TranslationUpdateType2["DELETE_MISSING"] = "delete-missing";
551
552
  return TranslationUpdateType2;
552
553
  })(TranslationUpdateType || {});
553
554
  var TranslationFileFormat = /* @__PURE__ */ ((TranslationFileFormat2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@localess/cli",
3
- "version": "0.0.1-dev.20260221221032",
3
+ "version": "0.0.1-dev.20260222000532",
4
4
  "description": "Localess Command Line.",
5
5
  "keywords": [
6
6
  "localess",