lezu 0.0.40 → 0.0.42

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/bin/lezu.js CHANGED
@@ -1,6 +1,2 @@
1
1
  #!/usr/bin/env node
2
-
3
- // Use dynamic import to load ES modules from CommonJS
4
- void (async () => {
5
- await import('../dist/index.js');
6
- })();
2
+ await import("lezu-cli/bin/lezu.js");
package/package.json CHANGED
@@ -1,51 +1,43 @@
1
1
  {
2
2
  "name": "lezu",
3
- "version": "0.0.40",
4
- "description": "CLI tool for pulling translations from Lezu",
3
+ "version": "0.0.42",
4
+ "description": "Translation management platform CLI, SDK, and i18n utilities",
5
5
  "bin": {
6
6
  "lezu": "bin/lezu.js"
7
7
  },
8
8
  "type": "module",
9
- "dependencies": {
10
- "@clack/prompts": "^0.8.2",
11
- "chalk": "^5.3.0",
12
- "commander": "^12.0.0",
13
- "dotenv": "^16.4.5",
14
- "node-fetch": "^3.3.2",
15
- "ora": "^8.0.1",
16
- "zod": "^3.22.4"
9
+ "main": "./index.js",
10
+ "types": "./index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./index.js",
14
+ "types": "./index.d.ts"
15
+ }
16
+ },
17
+ "scripts": {
18
+ "build": "echo 'Umbrella package — no build needed'",
19
+ "test": "echo 'Umbrella package — tests run in individual packages'",
20
+ "prepublishOnly": "echo 'Build already done in CI'"
17
21
  },
18
- "devDependencies": {
19
- "@types/node": "^22.0.0",
20
- "@vitest/coverage-v8": "^1.6.0",
21
- "tsup": "^8.0.2",
22
- "typescript": "^5.4.5",
23
- "vitest": "^1.6.0"
22
+ "dependencies": {
23
+ "lezu-cli": "0.0.41"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=18"
27
27
  },
28
28
  "files": [
29
- "dist",
30
- "bin"
29
+ "bin",
30
+ "index.js",
31
+ "index.d.ts"
31
32
  ],
32
- "publishConfig": {
33
- "access": "public"
34
- },
35
33
  "keywords": [
36
34
  "lezu",
37
35
  "i18n",
38
36
  "translations",
39
37
  "localization",
40
- "cli"
38
+ "cli",
39
+ "sdk"
41
40
  ],
42
41
  "author": "Lezu",
43
- "license": "MIT",
44
- "main": "index.js",
45
- "scripts": {
46
- "build": "tsup",
47
- "dev": "tsup --watch",
48
- "test": "vitest",
49
- "test:coverage": "vitest run --coverage"
50
- }
51
- }
42
+ "license": "MIT"
43
+ }
package/README.md DELETED
@@ -1,458 +0,0 @@
1
- # Lezu CLI
2
-
3
- The official command-line interface for Lezu translation management platform.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- # Use directly with npx (recommended)
9
- npx lezu
10
-
11
- # Or install globally
12
- npm install -g lezu
13
- ```
14
-
15
- ## Quick Start
16
-
17
- 1. **Interactive Mode** (recommended for first-time users):
18
- ```bash
19
- npx lezu
20
- ```
21
-
22
- 2. **Direct Commands**:
23
- ```bash
24
- # Download translations
25
- npx lezu load --project=YOUR_PROJECT_ID --api-key=YOUR_API_KEY
26
-
27
- # Add a new translation key
28
- npx lezu add --key=common.save --en="Save" --es="Guardar"
29
-
30
- # Get project information
31
- npx lezu get project
32
-
33
- # Create a release
34
- npx lezu release create --version=1.0.0
35
- ```
36
-
37
- ## Configuration
38
-
39
- ### Environment Variables
40
- ```bash
41
- LEZU_PROJECT_ID=your_project_id
42
- LEZU_API_KEY=your_api_key
43
- LEZU_API_URL=https://api.lezu.app # Optional, defaults to production
44
-
45
- # For local development:
46
- # LEZU_API_URL=http://localhost:8787
47
- ```
48
-
49
- ### Configuration File
50
- Create a `.lezurc` or `.lezurc.json` file in your project root:
51
-
52
- ```json
53
- {
54
- "projectId": "your_project_id",
55
- "apiKey": "your_api_key",
56
- "apiUrl": "https://api.lezu.app", // Optional, for custom API endpoints
57
- "dest": "./src/i18n",
58
- "format": "json",
59
- "environment": "production"
60
- }
61
- ```
62
-
63
- ### Configuration Priority
64
- 1. Command-line arguments (highest priority)
65
- 2. Environment variables
66
- 3. Configuration file
67
- 4. Defaults (lowest priority)
68
-
69
- ## Commands
70
-
71
- ### `lezu load`
72
- Download translation files from Lezu.
73
-
74
- **Usage:**
75
- ```bash
76
- lezu load [options]
77
- ```
78
-
79
- **Options:**
80
- - `-p, --project <id>` - Project ID
81
- - `-k, --api-key <key>` - API key
82
- - `-d, --dest <path>` - Destination folder (default: `./src/i18n`)
83
- - `-f, --format <format>` - Output format: `json`, `js`, `ts`, `yaml`, `po` (default: `json`)
84
- - `-l, --languages <languages>` - Comma-separated list of languages to download
85
- - `-r, --release <id>` - Specific release ID to download
86
- - `-e, --environment <env>` - Environment (default: `production`)
87
- - `--flatten` - Flatten nested keys (e.g., `common.save` instead of `{ common: { save: "..." } }`)
88
- - `--namespace` - Use namespace folder structure (`locales/en.json`)
89
- - `--include-empty` - Include empty translations
90
- - `-w, --watch` - Watch for changes and auto-update
91
- - `--watch-interval <ms>` - Watch interval in milliseconds (default: `5000`)
92
- - `--api-url <url>` - API URL (default: `https://api.lezu.app`)
93
-
94
- **Examples:**
95
- ```bash
96
- # Basic usage
97
- lezu load --project=proj_123 --api-key=lk_456
98
-
99
- # Download specific languages only
100
- lezu load --languages=en,es,fr
101
-
102
- # Download from a specific release
103
- lezu load --release=rel_789
104
-
105
- # Flatten keys and output as TypeScript
106
- lezu load --flatten --format=ts
107
-
108
- # Export as gettext .po files
109
- lezu load --format=po
110
-
111
- # Watch mode for development
112
- lezu load --watch --watch-interval=2000
113
- ```
114
-
115
- **Output Formats:**
116
-
117
- - **JSON** (default):
118
- ```json
119
- {
120
- "common": {
121
- "save": "Save",
122
- "cancel": "Cancel"
123
- }
124
- }
125
- ```
126
-
127
- - **JavaScript (ES modules)**:
128
- ```javascript
129
- export default {
130
- common: {
131
- save: "Save",
132
- cancel: "Cancel"
133
- }
134
- }
135
- ```
136
-
137
- - **TypeScript**:
138
- ```typescript
139
- export default {
140
- common: {
141
- save: "Save",
142
- cancel: "Cancel"
143
- }
144
- } as const
145
- ```
146
-
147
- - **YAML**:
148
- ```yaml
149
- common:
150
- save: Save
151
- cancel: Cancel
152
- ```
153
-
154
- - **Gettext (.po)**:
155
- ```po
156
- # Translation file for en
157
- # Generated by Lezu CLI on 2024-01-15T10:30:00.000Z
158
- msgid ""
159
- msgstr ""
160
- "Language: en\n"
161
- "MIME-Version: 1.0\n"
162
- "Content-Type: text/plain; charset=UTF-8\n"
163
- "Content-Transfer-Encoding: 8bit\n"
164
- "Generated-By: Lezu CLI\n"
165
-
166
- msgid "common.save"
167
- msgstr "Save"
168
-
169
- msgid "common.cancel"
170
- msgstr "Cancel"
171
- ```
172
-
173
- ### `lezu add`
174
- Add a new translation key with values.
175
-
176
- **Usage:**
177
- ```bash
178
- lezu add --key=<key> [options]
179
- ```
180
-
181
- **Options:**
182
- - `-k, --key <key>` - **Required.** Translation key (e.g., "common.save")
183
- - `-v, --value <value>` - Value for the source language
184
- - `--en <value>` - English translation
185
- - `--es <value>` - Spanish translation
186
- - `--fr <value>` - French translation
187
- - `--de <value>` - German translation
188
- - `--nl <value>` - Dutch translation
189
- - `--it <value>` - Italian translation
190
- - `--pt <value>` - Portuguese translation
191
- - `--ru <value>` - Russian translation
192
- - `--ja <value>` - Japanese translation
193
- - `--ko <value>` - Korean translation
194
- - `--zh <value>` - Chinese translation
195
- - `--ar <value>` - Arabic translation
196
- - `-d, --description <desc>` - Description for the translation key
197
- - `--auto` - Auto-translate to all enabled languages using AI
198
- - `-p, --project <id>` - Project ID
199
- - `-a, --api-key <key>` - API key
200
-
201
- **Examples:**
202
- ```bash
203
- # Add key with specific translations
204
- lezu add --key=common.save --en="Save" --es="Guardar" --fr="Enregistrer"
205
-
206
- # Add key with auto-translation
207
- lezu add --key=common.delete --en="Delete" --auto
208
-
209
- # Add key with description
210
- lezu add --key=error.validation --description="Validation error message" --en="This field is required"
211
- ```
212
-
213
- **Subscription Requirements:**
214
- - **Free**: Cannot add keys
215
- - **Basic+**: Can add keys and translations
216
- - **Pro+**: Can add keys with auto-translation
217
-
218
- ### `lezu get`
219
- Get information about your project.
220
-
221
- #### `lezu get project`
222
- Get project information and statistics.
223
-
224
- **Usage:**
225
- ```bash
226
- lezu get project [options]
227
- ```
228
-
229
- **Options:**
230
- - `--stats` - Include detailed statistics
231
- - `--json` - Output as JSON
232
- - `-p, --project <id>` - Project ID
233
- - `-a, --api-key <key>` - API key
234
-
235
- **Example:**
236
- ```bash
237
- lezu get project --stats
238
- ```
239
-
240
- #### `lezu get languages`
241
- List all languages in your project.
242
-
243
- **Usage:**
244
- ```bash
245
- lezu get languages [options]
246
- ```
247
-
248
- **Options:**
249
- - `--include-disabled` - Include disabled languages
250
- - `--json` - Output as JSON
251
- - `-p, --project <id>` - Project ID
252
- - `-a, --api-key <key>` - API key
253
-
254
- **Example:**
255
- ```bash
256
- lezu get languages --include-disabled
257
- ```
258
-
259
- #### `lezu get releases`
260
- List all releases in your project.
261
-
262
- **Usage:**
263
- ```bash
264
- lezu get releases [options]
265
- ```
266
-
267
- **Options:**
268
- - `-e, --environment <env>` - Environment (default: `production`)
269
- - `--limit <n>` - Limit number of results (default: `10`)
270
- - `--json` - Output as JSON
271
- - `-p, --project <id>` - Project ID
272
- - `-a, --api-key <key>` - API key
273
-
274
- **Example:**
275
- ```bash
276
- lezu get releases --environment=staging --limit=20
277
- ```
278
-
279
- ### `lezu release`
280
- Manage releases.
281
-
282
- #### `lezu release create`
283
- Create a new release.
284
-
285
- **Usage:**
286
- ```bash
287
- lezu release create [options]
288
- ```
289
-
290
- **Options:**
291
- - `-v, --version <version>` - Release version (e.g., "1.0.0")
292
- - `-n, --name <name>` - Release name
293
- - `-d, --description <desc>` - Release description
294
- - `-e, --environment <env>` - Environment (default: `production`)
295
- - `--reviewed-only` - Include only reviewed translations
296
- - `--set-current` - Set this release as the current release
297
- - `--timestamp <iso>` - Specific timestamp for the release (ISO format)
298
- - `--languages <langs>` - Comma-separated list of languages to include
299
- - `--json` - Output as JSON
300
- - `-p, --project <id>` - Project ID
301
- - `-a, --api-key <key>` - API key
302
-
303
- **Examples:**
304
- ```bash
305
- # Create a basic release
306
- lezu release create --version=1.0.0
307
-
308
- # Create release with specific timestamp and set as current
309
- lezu release create --version=1.1.0 --timestamp=2024-01-15T10:00:00Z --set-current
310
-
311
- # Create release with only reviewed translations
312
- lezu release create --version=1.0.1 --reviewed-only --name="Hotfix Release"
313
- ```
314
-
315
- **Subscription Requirements:**
316
- - **Free**: Cannot create releases
317
- - **Basic**: Cannot create releases
318
- - **Pro+**: Can create releases
319
-
320
- #### `lezu release current <releaseId>`
321
- Set a release as current.
322
-
323
- **Usage:**
324
- ```bash
325
- lezu release current <releaseId> [options]
326
- ```
327
-
328
- **Example:**
329
- ```bash
330
- lezu release current rel_123abc456def
331
- ```
332
-
333
- #### `lezu release list`
334
- List all releases (alias for `lezu get releases`).
335
-
336
- ## API Keys and Authentication
337
-
338
- ### Getting an API Key
339
- 1. Go to [Lezu Dashboard](https://app.lezu.app)
340
- 2. Navigate to your project settings
341
- 3. Go to the "API Keys" section
342
- 4. Click "Create API Key"
343
- 5. Copy the generated key (it will only be shown once)
344
-
345
- ### API Key Scopes
346
- API keys have different capabilities based on your subscription:
347
-
348
- **Free Plan:**
349
- - ✅ Download translations (`load`)
350
- - ✅ Get project information (`get`)
351
- - ❌ Add keys (`add`)
352
- - ❌ Create releases (`release create`)
353
-
354
- **Basic Plan:**
355
- - ✅ All Free features
356
- - ✅ Add translation keys (`add`)
357
- - ✅ Update translations
358
- - ❌ Create releases
359
-
360
- **Pro+ Plans:**
361
- - ✅ All Basic features
362
- - ✅ Create releases (`release create`)
363
- - ✅ Auto-translation with AI
364
- - ✅ Higher rate limits
365
-
366
- ### Rate Limits
367
- Rate limits are applied per API key per minute:
368
-
369
- | Plan | Requests/min | Translations/min |
370
- |------|-------------|------------------|
371
- | Free | 50 | 10 |
372
- | Basic | 500 | 100 |
373
- | Pro | 5,000 | 1,000 |
374
- | Team | 10,000 | 2,000 |
375
- | Enterprise | 50,000 | 10,000 |
376
-
377
- ## Error Handling
378
-
379
- The CLI provides clear error messages for common issues:
380
-
381
- - **401 Unauthorized**: Invalid API key
382
- - **402 Payment Required**: Subscription required or expired
383
- - **403 Forbidden**: Feature requires subscription upgrade
384
- - **404 Not Found**: Project or resource not found
385
- - **429 Too Many Requests**: Rate limit exceeded
386
-
387
- ## Troubleshooting
388
-
389
- ### Common Issues
390
-
391
- **"Configuration errors: Project ID is required"**
392
- - Set `LEZU_PROJECT_ID` environment variable
393
- - Or use `--project` flag
394
- - Or add `projectId` to `.lezurc` file
395
-
396
- **"API request failed: 401 Unauthorized"**
397
- - Check your API key is correct
398
- - Ensure the API key hasn't expired
399
- - Verify the API key belongs to the correct project
400
-
401
- **"Subscription upgrade required"**
402
- - Your current plan doesn't support this feature
403
- - Upgrade your subscription at [app.lezu.app/billing](https://app.lezu.app/billing)
404
-
405
- **"Rate limit exceeded"**
406
- - Wait for the rate limit window to reset
407
- - Consider upgrading your subscription for higher limits
408
-
409
- ### Debug Mode
410
- Set the `DEBUG` environment variable to see detailed logs:
411
-
412
- ```bash
413
- DEBUG=lezu* npx lezu load
414
- ```
415
-
416
- ## Integration Examples
417
-
418
- ### CI/CD Pipeline
419
- ```yaml
420
- # GitHub Actions example
421
- - name: Download translations
422
- run: npx lezu load
423
- env:
424
- LEZU_PROJECT_ID: ${{ secrets.LEZU_PROJECT_ID }}
425
- LEZU_API_KEY: ${{ secrets.LEZU_API_KEY }}
426
- ```
427
-
428
- ### Package.json Scripts
429
- ```json
430
- {
431
- "scripts": {
432
- "i18n:pull": "lezu load",
433
- "i18n:watch": "lezu load --watch",
434
- "i18n:release": "lezu release create --version=$npm_package_version"
435
- }
436
- }
437
- ```
438
-
439
- ### Pre-build Hook
440
- ```json
441
- {
442
- "scripts": {
443
- "prebuild": "lezu load --format=js",
444
- "build": "vite build"
445
- }
446
- }
447
- ```
448
-
449
- ## Support
450
-
451
- - 📖 [Documentation](https://docs.lezu.app)
452
- - 💬 [Discord Community](https://discord.gg/lezu)
453
- - 📧 [Email Support](mailto:support@lezu.app)
454
- - 🐛 [Report Issues](https://github.com/lezu-app/cli/issues)
455
-
456
- ## License
457
-
458
- MIT License - see [LICENSE](LICENSE) file for details.
@@ -1,7 +0,0 @@
1
- import {
2
- LezuApiClient
3
- } from "./chunk-V2UO7VTR.js";
4
- export {
5
- LezuApiClient
6
- };
7
- //# sourceMappingURL=api-ITNPB7RZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}