lezu 0.0.22 → 0.0.24
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/{chunk-BCNTD3QK.js → chunk-CUKGTW6G.js} +20 -20
- package/dist/chunk-CUKGTW6G.js.map +1 -0
- package/dist/{chunk-4YJMQGUZ.js → chunk-EVS3X4J2.js} +3 -3
- package/dist/chunk-EVS3X4J2.js.map +1 -0
- package/dist/{chunk-G75WRDSJ.js → chunk-XLG4OXOO.js} +13 -13
- package/dist/chunk-XLG4OXOO.js.map +1 -0
- package/dist/get-N7YBCERI.js +9 -0
- package/dist/index.js +59 -55
- package/dist/index.js.map +1 -1
- package/dist/{load-5EN5NPEL.js → load-5U463JIB.js} +3 -3
- package/package.json +2 -2
- package/dist/chunk-4YJMQGUZ.js.map +0 -1
- package/dist/chunk-BCNTD3QK.js.map +0 -1
- package/dist/chunk-G75WRDSJ.js.map +0 -1
- package/dist/get-R4XXTDRV.js +0 -9
- /package/dist/{get-R4XXTDRV.js.map → get-N7YBCERI.js.map} +0 -0
- /package/dist/{load-5EN5NPEL.js.map → load-5U463JIB.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig,
|
|
3
3
|
validateConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EVS3X4J2.js";
|
|
5
5
|
import {
|
|
6
6
|
LezuApiClient
|
|
7
7
|
} from "./chunk-WZDLWLM3.js";
|
|
@@ -18,12 +18,12 @@ function createGetCommand() {
|
|
|
18
18
|
const errors = validateConfig(config);
|
|
19
19
|
if (errors.length > 0) {
|
|
20
20
|
console.error(chalk.red("Configuration errors:"));
|
|
21
|
-
errors.forEach((error) => console.error(chalk.red(`
|
|
21
|
+
errors.forEach((error) => console.error(chalk.red(` - ${error}`)));
|
|
22
22
|
process.exit(1);
|
|
23
23
|
}
|
|
24
24
|
await getLanguages(config, options);
|
|
25
25
|
} catch (error) {
|
|
26
|
-
console.error(chalk.red("\n
|
|
26
|
+
console.error(chalk.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
27
27
|
process.exit(1);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
@@ -33,12 +33,12 @@ function createGetCommand() {
|
|
|
33
33
|
const errors = validateConfig(config);
|
|
34
34
|
if (errors.length > 0) {
|
|
35
35
|
console.error(chalk.red("Configuration errors:"));
|
|
36
|
-
errors.forEach((error) => console.error(chalk.red(`
|
|
36
|
+
errors.forEach((error) => console.error(chalk.red(` - ${error}`)));
|
|
37
37
|
process.exit(1);
|
|
38
38
|
}
|
|
39
39
|
await getReleases(config, options);
|
|
40
40
|
} catch (error) {
|
|
41
|
-
console.error(chalk.red("\n
|
|
41
|
+
console.error(chalk.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
42
42
|
process.exit(1);
|
|
43
43
|
}
|
|
44
44
|
});
|
|
@@ -48,12 +48,12 @@ function createGetCommand() {
|
|
|
48
48
|
const errors = validateConfig(config);
|
|
49
49
|
if (errors.length > 0) {
|
|
50
50
|
console.error(chalk.red("Configuration errors:"));
|
|
51
|
-
errors.forEach((error) => console.error(chalk.red(`
|
|
51
|
+
errors.forEach((error) => console.error(chalk.red(` - ${error}`)));
|
|
52
52
|
process.exit(1);
|
|
53
53
|
}
|
|
54
54
|
await getProject(config, options);
|
|
55
55
|
} catch (error) {
|
|
56
|
-
console.error(chalk.red("\n
|
|
56
|
+
console.error(chalk.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
57
57
|
process.exit(1);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
@@ -69,13 +69,13 @@ async function getLanguages(config, options) {
|
|
|
69
69
|
console.log(JSON.stringify(response, null, 2));
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
console.log(chalk.green("\n
|
|
72
|
+
console.log(chalk.green("\n[Project Languages]"));
|
|
73
73
|
if (!response.languages || response.languages.length === 0) {
|
|
74
74
|
console.log(chalk.gray(" No languages found"));
|
|
75
75
|
return;
|
|
76
76
|
}
|
|
77
77
|
response.languages.forEach((lang) => {
|
|
78
|
-
const status = lang.enabled ? chalk.green("
|
|
78
|
+
const status = lang.enabled ? chalk.green("[ON]") : chalk.gray("[OFF]");
|
|
79
79
|
const progress = lang.progress ? ` (${lang.progress.percentage}% complete)` : "";
|
|
80
80
|
const source = lang.is_source ? chalk.yellow(" [SOURCE]") : "";
|
|
81
81
|
console.log(` ${status} ${lang.language?.name || lang.language_code} (${lang.language_code})${source}${progress}`);
|
|
@@ -101,7 +101,7 @@ async function getReleases(config, options) {
|
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
console.log(chalk.green(`
|
|
104
|
-
|
|
104
|
+
[Releases] (${options.environment} environment):`));
|
|
105
105
|
if (!response.releases || response.releases.length === 0) {
|
|
106
106
|
console.log(chalk.gray(" No releases found"));
|
|
107
107
|
return;
|
|
@@ -159,7 +159,7 @@ async function getProject(config, options) {
|
|
|
159
159
|
console.log(JSON.stringify({ project: projectData, stats: statsData }, null, 2));
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
console.log(chalk.green("\n
|
|
162
|
+
console.log(chalk.green("\n[Project Information]"));
|
|
163
163
|
console.log(` Name: ${projectData.name}`);
|
|
164
164
|
console.log(` Key: ${projectData.key}`);
|
|
165
165
|
console.log(` ID: ${projectData.id}`);
|
|
@@ -169,40 +169,40 @@ async function getProject(config, options) {
|
|
|
169
169
|
console.log(` Source Language: ${projectData.source_language}`);
|
|
170
170
|
console.log(` Created: ${new Date(projectData.created_at).toLocaleDateString()}`);
|
|
171
171
|
if (projectData.stats) {
|
|
172
|
-
console.log(chalk.green("\n
|
|
172
|
+
console.log(chalk.green("\n[Basic Statistics]"));
|
|
173
173
|
console.log(` Translation Keys: ${projectData.stats.keys}`);
|
|
174
174
|
console.log(` Languages: ${projectData.stats.languages}`);
|
|
175
175
|
console.log(` Translations: ${projectData.stats.translations}`);
|
|
176
176
|
console.log(` Completeness: ${projectData.stats.completeness}%`);
|
|
177
177
|
}
|
|
178
178
|
if (statsData) {
|
|
179
|
-
console.log(chalk.green("\n
|
|
179
|
+
console.log(chalk.green("\n[Detailed Statistics]"));
|
|
180
180
|
console.log(` Total Keys: ${statsData.overview.totalKeys}`);
|
|
181
181
|
console.log(` Total Languages: ${statsData.overview.totalLanguages}`);
|
|
182
182
|
console.log(` Total Releases: ${statsData.overview.totalReleases}`);
|
|
183
183
|
console.log(` Keys Added Last Month: ${statsData.overview.keysAddedLastMonth}`);
|
|
184
184
|
if (statsData.languages && statsData.languages.length > 0) {
|
|
185
|
-
console.log(chalk.green("\n
|
|
185
|
+
console.log(chalk.green("\n[Language Progress]"));
|
|
186
186
|
statsData.languages.forEach((lang) => {
|
|
187
187
|
const percentage = lang.percentage;
|
|
188
|
-
const bar = "
|
|
188
|
+
const bar = "#".repeat(Math.floor(percentage / 5)) + "-".repeat(20 - Math.floor(percentage / 5));
|
|
189
189
|
console.log(` ${lang.language_code}: [${bar}] ${percentage}%`);
|
|
190
190
|
console.log(chalk.gray(` ${lang.translated}/${lang.total} translated, ${lang.reviewed} reviewed, ${lang.missing} missing`));
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
if (statsData.recentReleases && statsData.recentReleases.length > 0) {
|
|
194
|
-
console.log(chalk.green("\n
|
|
194
|
+
console.log(chalk.green("\n[Recent Releases]"));
|
|
195
195
|
statsData.recentReleases.forEach((release) => {
|
|
196
196
|
const date = new Date(release.created_at).toLocaleDateString();
|
|
197
|
-
console.log(`
|
|
197
|
+
console.log(` - ${release.version} (${date})`);
|
|
198
198
|
});
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
if (projectData.environments && projectData.environments.length > 0) {
|
|
202
|
-
console.log(chalk.green("\n
|
|
202
|
+
console.log(chalk.green("\n[Environments]"));
|
|
203
203
|
projectData.environments.forEach((env) => {
|
|
204
204
|
const current = env.current_release_id ? ` (current: ${env.current_release_id.substring(0, 8)}...)` : "";
|
|
205
|
-
console.log(`
|
|
205
|
+
console.log(` - ${env.name}${current}`);
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
} catch (error) {
|
|
@@ -214,4 +214,4 @@ async function getProject(config, options) {
|
|
|
214
214
|
export {
|
|
215
215
|
createGetCommand
|
|
216
216
|
};
|
|
217
|
-
//# sourceMappingURL=chunk-
|
|
217
|
+
//# sourceMappingURL=chunk-CUKGTW6G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/get.ts"],"sourcesContent":["import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport type { Config } from '../types.js'\n\nexport function createGetCommand() {\n const command = new Command('get')\n .description('Get information about your project')\n \n // Languages subcommand\n command\n .command('languages')\n .alias('langs')\n .description('List all languages in your project')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--include-disabled', 'Include disabled languages')\n .option('--json', 'Output as JSON')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n await getLanguages(config, options)\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // Releases subcommand\n command\n .command('releases')\n .description('List all releases in your project')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('--json', 'Output as JSON')\n .option('--limit <n>', 'Limit number of results', '10')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n await getReleases(config, options)\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // Project info subcommand\n command\n .command('project')\n .alias('info')\n .description('Get project information and statistics')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--json', 'Output as JSON')\n .option('--stats', 'Include detailed statistics')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n await getProject(config, options)\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n return command\n}\n\nasync function getLanguages(config: Config, options: any) {\n const spinner = ora('Fetching languages...').start()\n \n try {\n const client = new LezuApiClient(config)\n const response = await client.getLanguages()\n \n spinner.succeed('Languages fetched successfully!')\n \n if (options.json) {\n console.log(JSON.stringify(response, null, 2))\n return\n }\n \n console.log(chalk.green('\\n[Project Languages]'))\n \n if (!response.languages || response.languages.length === 0) {\n console.log(chalk.gray(' No languages found'))\n return\n }\n \n response.languages.forEach((lang: any) => {\n const status = lang.enabled ? chalk.green('[ON]') : chalk.gray('[OFF]')\n const progress = lang.progress ? ` (${lang.progress.percentage}% complete)` : ''\n const source = lang.is_source ? chalk.yellow(' [SOURCE]') : ''\n \n console.log(` ${status} ${lang.language?.name || lang.language_code} (${lang.language_code})${source}${progress}`)\n \n if (lang.progress && lang.progress.total > 0) {\n console.log(chalk.gray(` ${lang.progress.translated}/${lang.progress.total} keys translated`))\n }\n })\n \n console.log(chalk.gray(`\\nTotal: ${response.total} languages`))\n \n } catch (error) {\n spinner.fail('Failed to fetch languages')\n throw error\n }\n}\n\nasync function getReleases(config: Config, options: any) {\n const spinner = ora('Fetching releases...').start()\n \n try {\n const client = new LezuApiClient(config)\n const response = await client.getReleases()\n \n spinner.succeed('Releases fetched successfully!')\n \n if (options.json) {\n console.log(JSON.stringify(response, null, 2))\n return\n }\n \n console.log(chalk.green(`\\n[Releases] (${options.environment} environment):`))\n \n if (!response.releases || response.releases.length === 0) {\n console.log(chalk.gray(' No releases found'))\n return\n }\n \n const limit = parseInt(options.limit, 10)\n const releases = response.releases.slice(0, limit)\n \n releases.forEach((release: any, index: number) => {\n const current = release.is_current ? chalk.yellow(' [CURRENT]') : ''\n const date = new Date(release.created_at).toLocaleDateString()\n const reviewedTag = release.reviewed_only ? chalk.blue(' [REVIEWED ONLY]') : ''\n \n console.log(` ${index + 1}. ${release.version}${current}${reviewedTag}`)\n if (release.name && release.name !== release.version) {\n console.log(chalk.gray(` ${release.name}`))\n }\n if (release.description) {\n console.log(chalk.gray(` ${release.description}`))\n }\n console.log(chalk.gray(` Created: ${date}`))\n if (release.created_by_user?.email) {\n console.log(chalk.gray(` By: ${release.created_by_user.email}`))\n }\n console.log() // empty line\n })\n \n if (response.releases.length > limit) {\n console.log(chalk.gray(`... and ${response.releases.length - limit} more releases`))\n console.log(chalk.gray(`Use --limit ${response.releases.length} to see all releases`))\n }\n \n } catch (error) {\n spinner.fail('Failed to fetch releases')\n throw error\n }\n}\n\nasync function getProject(config: Config, options: any) {\n const spinner = ora('Fetching project information...').start()\n \n try {\n const client = new LezuApiClient(config)\n \n let projectData, statsData\n \n if (options.stats) {\n // Fetch both project info and detailed stats\n const [projectResponse, statsResponse] = await Promise.all([\n client.getProject(),\n fetch(`${config.apiUrl}/v1/projects/${config.projectId}/stats`, {\n headers: {\n 'Authorization': `Bearer ${config.apiKey}`,\n },\n }).then(r => r.json())\n ])\n projectData = projectResponse.project\n statsData = statsResponse.stats\n } else {\n const response = await client.getProject()\n projectData = response.project\n }\n \n spinner.succeed('Project information fetched successfully!')\n \n if (options.json) {\n console.log(JSON.stringify({ project: projectData, stats: statsData }, null, 2))\n return\n }\n \n console.log(chalk.green('\\n[Project Information]'))\n console.log(` Name: ${projectData.name}`)\n console.log(` Key: ${projectData.key}`)\n console.log(` ID: ${projectData.id}`)\n if (projectData.description) {\n console.log(` Description: ${projectData.description}`)\n }\n console.log(` Source Language: ${projectData.source_language}`)\n console.log(` Created: ${new Date(projectData.created_at).toLocaleDateString()}`)\n \n // Basic stats (always available)\n if (projectData.stats) {\n console.log(chalk.green('\\n[Basic Statistics]'))\n console.log(` Translation Keys: ${projectData.stats.keys}`)\n console.log(` Languages: ${projectData.stats.languages}`)\n console.log(` Translations: ${projectData.stats.translations}`)\n console.log(` Completeness: ${projectData.stats.completeness}%`)\n }\n \n // Detailed stats (when --stats is used)\n if (statsData) {\n console.log(chalk.green('\\n[Detailed Statistics]'))\n console.log(` Total Keys: ${statsData.overview.totalKeys}`)\n console.log(` Total Languages: ${statsData.overview.totalLanguages}`)\n console.log(` Total Releases: ${statsData.overview.totalReleases}`)\n console.log(` Keys Added Last Month: ${statsData.overview.keysAddedLastMonth}`)\n \n if (statsData.languages && statsData.languages.length > 0) {\n console.log(chalk.green('\\n[Language Progress]'))\n statsData.languages.forEach((lang: any) => {\n const percentage = lang.percentage\n const bar = '#'.repeat(Math.floor(percentage / 5)) + '-'.repeat(20 - Math.floor(percentage / 5))\n console.log(` ${lang.language_code}: [${bar}] ${percentage}%`)\n console.log(chalk.gray(` ${lang.translated}/${lang.total} translated, ${lang.reviewed} reviewed, ${lang.missing} missing`))\n })\n }\n \n if (statsData.recentReleases && statsData.recentReleases.length > 0) {\n console.log(chalk.green('\\n[Recent Releases]'))\n statsData.recentReleases.forEach((release: any) => {\n const date = new Date(release.created_at).toLocaleDateString()\n console.log(` - ${release.version} (${date})`)\n })\n }\n }\n \n // Show environments\n if (projectData.environments && projectData.environments.length > 0) {\n console.log(chalk.green('\\n[Environments]'))\n projectData.environments.forEach((env: any) => {\n const current = env.current_release_id ? ` (current: ${env.current_release_id.substring(0, 8)}...)` : ''\n console.log(` - ${env.name}${current}`)\n })\n }\n \n } catch (error) {\n spinner.fail('Failed to fetch project information')\n throw error\n }\n}"],"mappings":";;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,SAAS;AAKT,SAAS,mBAAmB;AACjC,QAAM,UAAU,IAAI,QAAQ,KAAK,EAC9B,YAAY,oCAAoC;AAGnD,UACG,QAAQ,WAAW,EACnB,MAAM,OAAO,EACb,YAAY,oCAAoC,EAChD,OAAO,sBAAsB,YAAY,EACzC,OAAO,uBAAuB,SAAS,EACvC,OAAO,mBAAmB,WAAW,sBAAsB,EAC3D,OAAO,sBAAsB,4BAA4B,EACzD,OAAO,UAAU,gBAAgB,EACjC,OAAO,OAAO,YAAY;AACzB,QAAI;AACF,YAAM,SAAS,WAAW,OAAO;AACjC,YAAM,SAAS,eAAe,MAAM;AACpC,UAAI,OAAO,SAAS,GAAG;AACrB,gBAAQ,MAAM,MAAM,IAAI,uBAAuB,CAAC;AAChD,eAAO,QAAQ,WAAS,QAAQ,MAAM,MAAM,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC;AAChE,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,YAAM,aAAa,QAAQ,OAAO;AAAA,IACpC,SAAS,OAAO;AACd,cAAQ,MAAM,MAAM,IAAI,WAAW,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AACpF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAGH,UACG,QAAQ,UAAU,EAClB,YAAY,mCAAmC,EAC/C,OAAO,sBAAsB,YAAY,EACzC,OAAO,uBAAuB,SAAS,EACvC,OAAO,mBAAmB,WAAW,sBAAsB,EAC3D,OAAO,2BAA2B,eAAe,YAAY,EAC7D,OAAO,UAAU,gBAAgB,EACjC,OAAO,eAAe,2BAA2B,IAAI,EACrD,OAAO,OAAO,YAAY;AACzB,QAAI;AACF,YAAM,SAAS,WAAW,OAAO;AACjC,YAAM,SAAS,eAAe,MAAM;A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AE,mBAAmB;AAC7D,kBAAQ,IAAI,OAAO,QAAQ,OAAO,KAAK,IAAI,GAAG;AAAA,QAChD,CAAC;AAAA,MACH;AAAA,IACF;AAGA,QAAI,YAAY,gBAAgB,YAAY,aAAa,SAAS,GAAG;AACnE,cAAQ,IAAI,MAAM,MAAM,kBAAkB,CAAC;AAC3C,kBAAY,aAAa,QAAQ,CAAC,QAAa;AAC7C,cAAM,UAAU,IAAI,qBAAqB,cAAc,IAAI,mBAAmB,UAAU,GAAG,CAAC,CAAC,SAAS;AACtG,gBAAQ,IAAI,OAAO,IAAI,IAAI,GAAG,OAAO,EAAE;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EAEF,SAAS,OAAO;AACd,YAAQ,KAAK,qCAAqC;AAClD,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -43,10 +43,10 @@ function loadConfig(options = {}) {
|
|
|
43
43
|
const content = readFileSync(configPath, "utf-8");
|
|
44
44
|
const fileConfig = JSON.parse(content);
|
|
45
45
|
config = { ...config, ...fileConfig };
|
|
46
|
-
console.log(
|
|
46
|
+
console.log(`[Config] Loaded from ${file}`);
|
|
47
47
|
break;
|
|
48
48
|
} catch (error) {
|
|
49
|
-
console.warn(
|
|
49
|
+
console.warn(`[Warning] Failed to load config from ${file}:`, error);
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -93,4 +93,4 @@ export {
|
|
|
93
93
|
loadConfig,
|
|
94
94
|
validateConfig
|
|
95
95
|
};
|
|
96
|
-
//# sourceMappingURL=chunk-
|
|
96
|
+
//# sourceMappingURL=chunk-EVS3X4J2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/types.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\nimport dotenv from 'dotenv'\nimport { Config, ConfigSchema } from './types.js'\n\n// Load environment variables\ndotenv.config()\n\nexport function loadConfig(options: Partial<Config> = {}): Config {\n // 1. Start with defaults\n let config: Partial<Config> = {\n apiUrl: 'https://api.lezu.app',\n dest: './src/i18n',\n format: 'json',\n environment: 'production',\n flatten: false,\n namespace: false,\n includeEmpty: false,\n watch: false,\n watchInterval: 5000\n }\n\n // 2. Load from config file (only JSON files to avoid JS module complexity)\n const configFiles = ['.lezurc', '.lezurc.json']\n for (const file of configFiles) {\n const configPath = resolve(process.cwd(), file)\n if (existsSync(configPath)) {\n try {\n // JSON config files only\n const content = readFileSync(configPath, 'utf-8')\n const fileConfig = JSON.parse(content)\n config = { ...config, ...fileConfig }\n console.log(`[Config] Loaded from ${file}`)\n break\n } catch (error) {\n console.warn(`[Warning] Failed to load config from ${file}:`, error)\n }\n }\n }\n\n // 3. Load from environment variables\n if (process.env.LEZU_PROJECT_ID) {\n config.projectId = process.env.LEZU_PROJECT_ID\n }\n if (process.env.LEZU_API_KEY) {\n config.apiKey = process.env.LEZU_API_KEY\n }\n if (process.env.LEZU_API_URL) {\n config.apiUrl = process.env.LEZU_API_URL\n }\n if (process.env.LEZU_DEST) {\n config.dest = process.env.LEZU_DEST\n }\n if (process.env.LEZU_FORMAT) {\n config.format = process.env.LEZU_FORMAT as any\n }\n if (process.env.LEZU_ENVIRONMENT) {\n config.environment = process.env.LEZU_ENVIRONMENT\n }\n\n // 4. Apply CLI options (highest priority)\n config = { ...config, ...options }\n\n // 5. Validate and return\n try {\n return ConfigSchema.parse(config)\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Invalid configuration: ${error.message}`)\n }\n throw error\n }\n}\n\nexport function validateConfig(config: Config): string[] {\n const errors: string[] = []\n\n if (!config.projectId) {\n errors.push('Project ID is required (use --project, LEZU_PROJECT_ID env var, or projectId in config file)')\n }\n\n if (!config.apiKey) {\n errors.push('API Key is required (use --api-key, LEZU_API_KEY env var, or apiKey in config file)')\n }\n\n return errors\n}","import { z } from 'zod'\n\nexport const ConfigSchema = z.object({\n projectId: z.string().optional(),\n apiKey: z.string().optional(),\n apiUrl: z.string().default('https://api.lezu.app'),\n dest: z.string().default('./src/i18n'),\n format: z.enum(['json', 'js', 'ts', 'yaml', 'po']).default('json'),\n languages: z.array(z.string()).optional(),\n release: z.string().optional(),\n environment: z.string().default('production'),\n flatten: z.boolean().default(false),\n namespace: z.boolean().default(false),\n includeEmpty: z.boolean().default(false),\n watch: z.boolean().default(false),\n watchInterval: z.number().default(5000)\n})\n\nexport type Config = z.infer<typeof ConfigSchema>\n\nexport interface TranslationBundle {\n [key: string]: string | TranslationBundle\n}\n\nexport interface ApiResponse {\n translations: Record<string, any>\n meta?: {\n version?: string\n timestamp?: string\n languages?: string[]\n }\n}\n\nexport interface ReleaseResponse {\n releases: Array<{\n id: string\n version: string\n name?: string\n created_at: string\n }>\n}"],"mappings":";AAAA,SAAS,cAAc,kBAAkB;AACzC,SAAS,eAAe;AACxB,OAAO,YAAY;;;ACFnB,SAAS,SAAS;AAEX,IAAM,eAAe,EAAE,OAAO;AAAA,EACnC,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,QAAQ,EAAE,OAAO,EAAE,QAAQ,sBAAsB;AAAA,EACjD,MAAM,EAAE,OAAO,EAAE,QAAQ,YAAY;AAAA,EACrC,QAAQ,EAAE,KAAK,CAAC,QAAQ,MAAM,MAAM,QAAQ,IAAI,CAAC,EAAE,QAAQ,MAAM;AAAA,EACjE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACxC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,QAAQ,YAAY;AAAA,EAC5C,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EAClC,WAAW,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACpC,cAAc,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACvC,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,E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C,MAAI;AACF,WAAO,aAAa,MAAM,MAAM;AAAA,EAClC,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,0BAA0B,MAAM,OAAO,EAAE;AAAA,IAC3D;AACA,UAAM;AAAA,EACR;AACF;AAEO,SAAS,eAAe,QAA0B;AACvD,QAAM,SAAmB,CAAC;AAE1B,MAAI,CAAC,OAAO,WAAW;AACrB,WAAO,KAAK,8FAA8F;AAAA,EAC5G;AAEA,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO,KAAK,qFAAqF;AAAA,EACnG;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadConfig,
|
|
3
3
|
validateConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-EVS3X4J2.js";
|
|
5
5
|
import {
|
|
6
6
|
LezuApiClient
|
|
7
7
|
} from "./chunk-WZDLWLM3.js";
|
|
@@ -27,7 +27,7 @@ var TranslationWriter = class {
|
|
|
27
27
|
mkdirSync(dirname(filePath), { recursive: true });
|
|
28
28
|
const fileContent = this.formatContent(processedContent, language);
|
|
29
29
|
writeFileSync(filePath, fileContent, "utf-8");
|
|
30
|
-
console.log(
|
|
30
|
+
console.log(`[Written] ${language} translations to ${filePath}`);
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
processContent(content) {
|
|
@@ -181,21 +181,21 @@ function createLoadCommand() {
|
|
|
181
181
|
const errors = validateConfig(config);
|
|
182
182
|
if (errors.length > 0) {
|
|
183
183
|
console.error(chalk.red("Configuration errors:"));
|
|
184
|
-
errors.forEach((error) => console.error(chalk.red(`
|
|
184
|
+
errors.forEach((error) => console.error(chalk.red(` - ${error}`)));
|
|
185
185
|
process.exit(1);
|
|
186
186
|
}
|
|
187
187
|
await syncTranslations(config);
|
|
188
188
|
if (config.watch) {
|
|
189
189
|
console.log(chalk.cyan(`
|
|
190
|
-
|
|
190
|
+
[Watching] Monitoring for changes every ${config.watchInterval}ms...`));
|
|
191
191
|
console.log(chalk.gray("Press Ctrl+C to stop"));
|
|
192
192
|
setInterval(async () => {
|
|
193
|
-
console.log(chalk.gray("\n
|
|
193
|
+
console.log(chalk.gray("\n[Checking] Looking for updates..."));
|
|
194
194
|
await syncTranslations(config);
|
|
195
195
|
}, config.watchInterval);
|
|
196
196
|
}
|
|
197
197
|
} catch (error) {
|
|
198
|
-
console.error(chalk.red("\n
|
|
198
|
+
console.error(chalk.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
199
199
|
process.exit(1);
|
|
200
200
|
}
|
|
201
201
|
});
|
|
@@ -226,14 +226,14 @@ async function syncTranslations(config) {
|
|
|
226
226
|
spinner.succeed(`Fetched translations for ${Object.keys(response.translations).length} languages`);
|
|
227
227
|
const writer = new TranslationWriter(config);
|
|
228
228
|
writer.write(response.translations);
|
|
229
|
-
console.log(chalk.green("\n
|
|
229
|
+
console.log(chalk.green("\n[Success] Translations synced successfully!"));
|
|
230
230
|
console.log(chalk.gray("\nSummary:"));
|
|
231
|
-
console.log(chalk.gray(`
|
|
232
|
-
console.log(chalk.gray(`
|
|
233
|
-
console.log(chalk.gray(`
|
|
234
|
-
console.log(chalk.gray(`
|
|
231
|
+
console.log(chalk.gray(` - Project: ${config.projectId}`));
|
|
232
|
+
console.log(chalk.gray(` - Languages: ${Object.keys(response.translations).join(", ")}`));
|
|
233
|
+
console.log(chalk.gray(` - Destination: ${config.dest}`));
|
|
234
|
+
console.log(chalk.gray(` - Format: ${config.format}`));
|
|
235
235
|
if (response.meta?.version) {
|
|
236
|
-
console.log(chalk.gray(`
|
|
236
|
+
console.log(chalk.gray(` - Version: ${response.meta.version}`));
|
|
237
237
|
}
|
|
238
238
|
} catch (error) {
|
|
239
239
|
spinner.fail("Failed to sync translations");
|
|
@@ -245,4 +245,4 @@ export {
|
|
|
245
245
|
createLoadCommand,
|
|
246
246
|
syncTranslations
|
|
247
247
|
};
|
|
248
|
-
//# sourceMappingURL=chunk-
|
|
248
|
+
//# sourceMappingURL=chunk-XLG4OXOO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/load.ts","../src/writer.ts"],"sourcesContent":["import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport { TranslationWriter } from '../writer.js'\nimport type { Config } from '../types.js'\n\nexport function createLoadCommand() {\n const command = new Command('load')\n .description('Download translation files from Lezu')\n .option('-p, --project <id>', 'Project ID')\n .option('-k, --api-key <key>', 'API key')\n .option('-d, --dest <path>', 'Destination folder', './src/i18n')\n .option('-f, --format <format>', 'Output format (json, js, ts, yaml, po)', 'json')\n .option('-l, --languages <languages>', 'Comma-separated list of languages to download')\n .option('-r, --release <id>', 'Specific release ID')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--flatten', 'Flatten nested keys')\n .option('--namespace', 'Use namespace folder structure')\n .option('--include-empty', 'Include empty translations')\n .option('-w, --watch', 'Watch for changes')\n .option('--watch-interval <ms>', 'Watch interval in milliseconds', '5000')\n .action(async (options) => {\n try {\n // Parse languages from comma-separated string\n if (options.languages) {\n options.languages = options.languages.split(',').map((l: string) => l.trim())\n }\n\n // Convert watch interval to number\n if (options.watchInterval) {\n options.watchInterval = parseInt(options.watchInterval, 10)\n }\n\n // Load configuration\n const config = loadConfig(options)\n\n // Validate configuration\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n\n // Run the sync\n await syncTranslations(config)\n\n // Watch mode\n if (config.watch) {\n console.log(chalk.cyan(`\\n[Watching] Monitoring for changes every ${config.watchInterval}ms...`))\n console.log(chalk.gray('Press Ctrl+C to stop'))\n \n setInterval(async () => {\n console.log(chalk.gray('\\n[Checking] Looking for updates...'))\n await syncTranslations(config)\n }, config.watchInterval)\n }\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n\n return command\n}\n\nexport async function syncTranslations(config: Config) {\n const spinner = ora('Connecting to Lezu API...').start()\n\n try {\n // Create API client\n const client = new LezuApiClient(config)\n\n // If no release specified and not using latest, try to get latest release\n if (!config.release && config.environment) {\n spinner.text = 'Fetching latest release...'\n const latestRelease = await client.getLatestRelease()\n if (latestRelease) {\n config.release = latestRelease\n spinner.succeed(`Using latest release: ${latestRelease}`)\n spinner.start('Fetching translations...')\n } else {\n spinner.info('No releases found, fetching current translations...')\n spinner.start()\n }\n }\n\n // Fetch translations\n spinner.text = 'Fetching translations...'\n const response = await client.getTranslations()\n\n if (!response.translations || Object.keys(response.translations).length === 0) {\n spinner.fail('No translations found')\n return\n }\n\n spinner.succeed(`Fetched translations for ${Object.keys(response.translations).length} languages`)\n\n // Write translations\n const writer = new TranslationWriter(config)\n writer.write(response.translations)\n\n console.log(chalk.green('\\n[Success] Translations synced successfully!'))\n\n // Show summary\n console.log(chalk.gray('\\nSummary:'))\n console.log(chalk.gray(` - Project: ${config.projectId}`))\n console.log(chalk.gray(` - Languages: ${Object.keys(response.translations).join(', ')}`))\n console.log(chalk.gray(` - Destination: ${config.dest}`))\n console.log(chalk.gray(` - Format: ${config.format}`))\n \n if (response.meta?.version) {\n console.log(chalk.gray(` - Version: ${response.meta.version}`))\n }\n\n } catch (error) {\n spinner.fail('Failed to sync translations')\n throw error\n }\n}","import { writeFileSync, mkdirSync } from 'fs'\nimport { resolve, dirname, join } from 'path'\nimport type { Config, TranslationBundle } from './types.js'\n\nexport class TranslationWriter {\n private config: Config\n\n constructor(config: Config) {\n this.config = config\n }\n\n write(translations: Record<string, any>): void {\n // Ensure destination directory exists\n mkdirSync(this.config.dest, { recursive: true })\n\n // Write each language to its own file\n for (const [language, content] of Object.entries(translations)) {\n const processedContent = this.processContent(content)\n const filePath = this.getFilePath(language)\n \n mkdirSync(dirname(filePath), { recursive: true })\n \n const fileContent = this.formatContent(processedContent, language)\n writeFileSync(filePath, fileContent, 'utf-8')\n \n console.log(`[Written] ${language} translations to ${filePath}`)\n }\n }\n\n private processContent(content: any): any {\n if (this.config.flatten) {\n return this.flattenObject(content)\n }\n \n if (!this.config.includeEmpty) {\n return this.removeEmptyValues(content)\n }\n \n return content\n }\n\n private flattenObject(obj: any, prefix = ''): Record<string, string> {\n const result: Record<string, string> = {}\n \n for (const [key, value] of Object.entries(obj)) {\n const newKey = prefix ? `${prefix}.${key}` : key\n \n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n Object.assign(result, this.flattenObject(value, newKey))\n } else {\n result[newKey] = value as string\n }\n }\n \n return result\n }\n\n private removeEmptyValues(obj: any): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj\n }\n \n const result: any = {}\n \n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'object' && value !== null) {\n const cleaned = this.removeEmptyValues(value)\n if (Object.keys(cleaned).length > 0) {\n result[key] = cleaned\n }\n } else if (value !== '' && value !== null && value !== undefined) {\n result[key] = value\n }\n }\n \n return result\n }\n\n private getFilePath(language: string): string {\n const extension = this.getFileExtension()\n \n if (this.config.namespace) {\n // Use namespace structure: dest/locales/en.json\n return join(this.config.dest, 'locales', `${language}.${extension}`)\n } else {\n // Use flat structure: dest/en.json\n return join(this.config.dest, `${language}.${extension}`)\n }\n }\n\n private getFileExtension(): string {\n switch (this.config.format) {\n case 'json':\n return 'json'\n case 'js':\n return 'js'\n case 'ts':\n return 'ts'\n case 'yaml':\n return 'yaml'\n case 'po':\n return 'po'\n default:\n return 'json'\n }\n }\n\n private formatContent(content: any, language: string): string {\n switch (this.config.format) {\n case 'json':\n return JSON.stringify(content, null, 2)\n \n case 'js':\n return `export default ${JSON.stringify(content, null, 2)}`\n \n case 'ts':\n return `const translations = ${JSON.stringify(content, null, 2)} as const\\n\\nexport default translations`\n \n case 'yaml':\n return this.toYaml(content)\n \n case 'po':\n return this.toPo(content, language)\n \n default:\n return JSON.stringify(content, null, 2)\n }\n }\n\n private toYaml(obj: any, indent = 0): string {\n let result = ''\n const spaces = ' '.repeat(indent)\n \n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'object' && value !== null) {\n result += `${spaces}${key}:\\n${this.toYaml(value, indent + 2)}`\n } else {\n const escapedValue = String(value).includes(':') || String(value).includes('#') \n ? `\"${String(value).replace(/\"/g, '\\\\\"')}\"` \n : value\n result += `${spaces}${key}: ${escapedValue}\\n`\n }\n }\n \n return result\n }\n\n private toPo(obj: any, language: string): string {\n const now = new Date().toISOString()\n let result = `# Translation file for ${language}\n# Generated by Lezu CLI on ${now}\nmsgid \"\"\nmsgstr \"\"\n\"Language: ${language}\\\\n\"\n\"MIME-Version: 1.0\\\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\\\n\"\n\"Content-Transfer-Encoding: 8bit\\\\n\"\n\"Generated-By: Lezu CLI\\\\n\"\n\n`\n\n const flatEntries = this.flattenForPo(obj)\n \n for (const [key, value] of Object.entries(flatEntries)) {\n const escapedKey = this.escapePoString(key)\n const escapedValue = this.escapePoString(String(value))\n \n result += `msgid \"${escapedKey}\"\\n`\n result += `msgstr \"${escapedValue}\"\\n\\n`\n }\n \n return result\n }\n\n private flattenForPo(obj: any, prefix = ''): Record<string, string> {\n const result: Record<string, string> = {}\n \n for (const [key, value] of Object.entries(obj)) {\n const fullKey = prefix ? `${prefix}.${key}` : key\n \n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n Object.assign(result, this.flattenForPo(value, fullKey))\n } else {\n result[fullKey] = String(value)\n }\n }\n \n return result\n }\n\n private escapePoString(str: string): string {\n return str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\t/g, '\\\\t')\n }\n}"],"mappings":";;;;;;;;;AAAA,SAAS,eAAe;AACx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AAQ,MAAM;AAAA,MAChB;AAAA,IACF;AAGA,YAAQ,OAAO;AACf,UAAM,WAAW,MAAM,OAAO,gBAAgB;AAE9C,QAAI,CAAC,SAAS,gBAAgB,OAAO,KAAK,SAAS,YAAY,EAAE,WAAW,GAAG;AAC7E,cAAQ,KAAK,uBAAuB;AACpC;AAAA,IACF;AAEA,YAAQ,QAAQ,4BAA4B,OAAO,KAAK,SAAS,YAAY,EAAE,MAAM,YAAY;AAGjG,UAAM,SAAS,IAAI,kBAAkB,MAAM;AAC3C,WAAO,MAAM,SAAS,YAAY;AAElC,YAAQ,IAAI,MAAM,MAAM,+CAA+C,CAAC;AAGxE,YAAQ,IAAI,MAAM,KAAK,YAAY,CAAC;AACpC,YAAQ,IAAI,MAAM,KAAK,gBAAgB,OAAO,SAAS,EAAE,CAAC;AAC1D,YAAQ,IAAI,MAAM,KAAK,kBAAkB,OAAO,KAAK,SAAS,YAAY,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;AACzF,YAAQ,IAAI,MAAM,KAAK,oBAAoB,OAAO,IAAI,EAAE,CAAC;AACzD,YAAQ,IAAI,MAAM,KAAK,eAAe,OAAO,MAAM,EAAE,CAAC;AAEtD,QAAI,SAAS,MAAM,SAAS;AAC1B,cAAQ,IAAI,MAAM,KAAK,gBAAgB,SAAS,KAAK,OAAO,EAAE,CAAC;AAAA,IACjE;AAAA,EAEF,SAAS,OAAO;AACd,YAAQ,KAAK,6BAA6B;AAC1C,UAAM;AAAA,EACR;AACF;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLoadCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XLG4OXOO.js";
|
|
4
4
|
import {
|
|
5
5
|
createGetCommand
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CUKGTW6G.js";
|
|
7
7
|
import {
|
|
8
8
|
loadConfig,
|
|
9
9
|
validateConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EVS3X4J2.js";
|
|
11
11
|
import {
|
|
12
12
|
LezuApiClient
|
|
13
13
|
} from "./chunk-WZDLWLM3.js";
|
|
@@ -27,7 +27,7 @@ function createAddCommand() {
|
|
|
27
27
|
const errors = validateConfig(config);
|
|
28
28
|
if (errors.length > 0) {
|
|
29
29
|
console.error(chalk.red("Configuration errors:"));
|
|
30
|
-
errors.forEach((error) => console.error(chalk.red(`
|
|
30
|
+
errors.forEach((error) => console.error(chalk.red(` - ${error}`)));
|
|
31
31
|
process.exit(1);
|
|
32
32
|
}
|
|
33
33
|
const translations = {};
|
|
@@ -57,7 +57,7 @@ function createAddCommand() {
|
|
|
57
57
|
auto: options.auto
|
|
58
58
|
});
|
|
59
59
|
} catch (error) {
|
|
60
|
-
console.error(chalk.red("\n
|
|
60
|
+
console.error(chalk.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
61
61
|
process.exit(1);
|
|
62
62
|
}
|
|
63
63
|
});
|
|
@@ -69,12 +69,12 @@ async function addTranslationKey(config, options) {
|
|
|
69
69
|
const client = new LezuApiClient(config);
|
|
70
70
|
const response = await client.addTranslationKey(options.key, options.translations);
|
|
71
71
|
spinner.succeed("Translation key added successfully!");
|
|
72
|
-
console.log(chalk.green("\n
|
|
73
|
-
console.log(chalk.gray(`
|
|
72
|
+
console.log(chalk.green("\n[Success] Key added:"));
|
|
73
|
+
console.log(chalk.gray(` - Key: ${options.key}`));
|
|
74
74
|
if (options.description) {
|
|
75
|
-
console.log(chalk.gray(`
|
|
75
|
+
console.log(chalk.gray(` - Description: ${options.description}`));
|
|
76
76
|
}
|
|
77
|
-
console.log(chalk.gray(`
|
|
77
|
+
console.log(chalk.gray(` - Languages: ${Object.keys(options.translations).join(", ")}`));
|
|
78
78
|
if (Object.keys(options.translations).length > 0) {
|
|
79
79
|
console.log(chalk.gray("\n Translations:"));
|
|
80
80
|
Object.entries(options.translations).forEach(([lang, value]) => {
|
|
@@ -82,7 +82,7 @@ async function addTranslationKey(config, options) {
|
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
if (options.auto) {
|
|
85
|
-
console.log(chalk.cyan("\n
|
|
85
|
+
console.log(chalk.cyan("\n[AI] Auto-translation was enabled. Check the dashboard to review AI-generated translations."));
|
|
86
86
|
}
|
|
87
87
|
} catch (error) {
|
|
88
88
|
spinner.fail("Failed to add translation key");
|
|
@@ -102,12 +102,12 @@ function createReleaseCommand() {
|
|
|
102
102
|
const errors = validateConfig(config);
|
|
103
103
|
if (errors.length > 0) {
|
|
104
104
|
console.error(chalk2.red("Configuration errors:"));
|
|
105
|
-
errors.forEach((error) => console.error(chalk2.red(`
|
|
105
|
+
errors.forEach((error) => console.error(chalk2.red(` - ${error}`)));
|
|
106
106
|
process.exit(1);
|
|
107
107
|
}
|
|
108
108
|
await createRelease(config, options);
|
|
109
109
|
} catch (error) {
|
|
110
|
-
console.error(chalk2.red("\n
|
|
110
|
+
console.error(chalk2.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
111
111
|
process.exit(1);
|
|
112
112
|
}
|
|
113
113
|
});
|
|
@@ -117,12 +117,12 @@ function createReleaseCommand() {
|
|
|
117
117
|
const errors = validateConfig(config);
|
|
118
118
|
if (errors.length > 0) {
|
|
119
119
|
console.error(chalk2.red("Configuration errors:"));
|
|
120
|
-
errors.forEach((error) => console.error(chalk2.red(`
|
|
120
|
+
errors.forEach((error) => console.error(chalk2.red(` - ${error}`)));
|
|
121
121
|
process.exit(1);
|
|
122
122
|
}
|
|
123
123
|
await setCurrentRelease(config, releaseId, options);
|
|
124
124
|
} catch (error) {
|
|
125
|
-
console.error(chalk2.red("\n
|
|
125
|
+
console.error(chalk2.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
126
126
|
process.exit(1);
|
|
127
127
|
}
|
|
128
128
|
});
|
|
@@ -132,13 +132,13 @@ function createReleaseCommand() {
|
|
|
132
132
|
const errors = validateConfig(config);
|
|
133
133
|
if (errors.length > 0) {
|
|
134
134
|
console.error(chalk2.red("Configuration errors:"));
|
|
135
|
-
errors.forEach((error) => console.error(chalk2.red(`
|
|
135
|
+
errors.forEach((error) => console.error(chalk2.red(` - ${error}`)));
|
|
136
136
|
process.exit(1);
|
|
137
137
|
}
|
|
138
|
-
const { getReleases } = await import("./get-
|
|
138
|
+
const { getReleases } = await import("./get-N7YBCERI.js");
|
|
139
139
|
await getReleases(config, options);
|
|
140
140
|
} catch (error) {
|
|
141
|
-
console.error(chalk2.red("\n
|
|
141
|
+
console.error(chalk2.red("\n[Error]"), error instanceof Error ? error.message : error);
|
|
142
142
|
process.exit(1);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
@@ -174,7 +174,7 @@ async function createRelease(config, options) {
|
|
|
174
174
|
console.log(JSON.stringify(response, null, 2));
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
|
-
console.log(chalk2.green("\n
|
|
177
|
+
console.log(chalk2.green("\n[Release Created]"));
|
|
178
178
|
console.log(` ID: ${response.release.id}`);
|
|
179
179
|
console.log(` Version: ${response.release.version}`);
|
|
180
180
|
if (response.release.name) {
|
|
@@ -188,18 +188,18 @@ async function createRelease(config, options) {
|
|
|
188
188
|
console.log(` Is Current: ${response.release.is_current ? "Yes" : "No"}`);
|
|
189
189
|
console.log(` Created: ${new Date(response.release.created_at).toLocaleString()}`);
|
|
190
190
|
if (response.release.artifacts && response.release.artifacts.length > 0) {
|
|
191
|
-
console.log(chalk2.green("\n
|
|
191
|
+
console.log(chalk2.green("\n[Bundles Generated]"));
|
|
192
192
|
response.release.artifacts.forEach((artifact) => {
|
|
193
193
|
const sizeKB = Math.round(artifact.file_size / 1024);
|
|
194
|
-
console.log(`
|
|
194
|
+
console.log(` - ${artifact.language_code}: ${sizeKB}KB`);
|
|
195
195
|
});
|
|
196
196
|
console.log(chalk2.gray(`
|
|
197
197
|
Total: ${response.release.artifacts.length} language bundles`));
|
|
198
198
|
}
|
|
199
|
-
console.log(chalk2.cyan("\n
|
|
199
|
+
console.log(chalk2.cyan("\n[Tip] You can now use this release with:"));
|
|
200
200
|
console.log(chalk2.gray(` npx lezu load --release ${response.release.id}`));
|
|
201
201
|
if (response.release.is_current) {
|
|
202
|
-
console.log(chalk2.green("\n
|
|
202
|
+
console.log(chalk2.green("\n[Success] This release is now set as current!"));
|
|
203
203
|
}
|
|
204
204
|
} catch (error) {
|
|
205
205
|
spinner.fail("Failed to create release");
|
|
@@ -227,10 +227,10 @@ ${error}`);
|
|
|
227
227
|
console.log(JSON.stringify(data, null, 2));
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
console.log(chalk2.green("\n
|
|
230
|
+
console.log(chalk2.green("\n[Release Updated]"));
|
|
231
231
|
console.log(` Release ID: ${releaseId}`);
|
|
232
232
|
console.log(" Status: Now set as current release");
|
|
233
|
-
console.log(chalk2.cyan("\n
|
|
233
|
+
console.log(chalk2.cyan("\n[Info] All new bundle requests will now use this release"));
|
|
234
234
|
} catch (error) {
|
|
235
235
|
spinner.fail("Failed to set release as current");
|
|
236
236
|
throw error;
|
|
@@ -245,7 +245,7 @@ import chalk3 from "chalk";
|
|
|
245
245
|
async function interactiveMode(initialConfig) {
|
|
246
246
|
const rl = readline.createInterface({ input, output });
|
|
247
247
|
const question = promisify(rl.question).bind(rl);
|
|
248
|
-
console.log(chalk3.cyan("
|
|
248
|
+
console.log(chalk3.cyan("[Lezu CLI] Interactive Mode\n"));
|
|
249
249
|
console.log(chalk3.gray("What would you like to do?\n"));
|
|
250
250
|
try {
|
|
251
251
|
console.log("Available commands:");
|
|
@@ -274,7 +274,7 @@ async function interactiveMode(initialConfig) {
|
|
|
274
274
|
command = "load";
|
|
275
275
|
}
|
|
276
276
|
console.log(chalk3.cyan(`
|
|
277
|
-
|
|
277
|
+
[Setup] Setting up ${command} command...
|
|
278
278
|
`));
|
|
279
279
|
const projectId = await rl.question(
|
|
280
280
|
chalk3.bold("Project ID") + (initialConfig.projectId ? chalk3.gray(` (${initialConfig.projectId}): `) : ": ")
|
|
@@ -310,7 +310,7 @@ async function interactiveMode(initialConfig) {
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
async function configureLoadCommand(rl, config) {
|
|
313
|
-
const { syncTranslations } = await import("./load-
|
|
313
|
+
const { syncTranslations } = await import("./load-5U463JIB.js");
|
|
314
314
|
console.log(chalk3.bold("\nLoad Configuration:"));
|
|
315
315
|
const dest = await rl.question(
|
|
316
316
|
chalk3.gray(`Destination folder (${config.dest || "./src/i18n"}): `)
|
|
@@ -341,8 +341,8 @@ async function configureLoadCommand(rl, config) {
|
|
|
341
341
|
environment,
|
|
342
342
|
languages: languages ? languages.split(",").map((l) => l.trim()) : void 0
|
|
343
343
|
};
|
|
344
|
-
console.log(chalk3.green("\n
|
|
345
|
-
const { syncTranslations: sync } = await import("./load-
|
|
344
|
+
console.log(chalk3.green("\n[Starting] Translation sync..."));
|
|
345
|
+
const { syncTranslations: sync } = await import("./load-5U463JIB.js");
|
|
346
346
|
await sync(finalConfig);
|
|
347
347
|
}
|
|
348
348
|
async function configureAddCommand(rl, config) {
|
|
@@ -374,14 +374,14 @@ async function configureAddCommand(rl, config) {
|
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
console.log(chalk3.green("\n
|
|
377
|
+
console.log(chalk3.green("\n[Adding] Translation key..."));
|
|
378
378
|
const { LezuApiClient: LezuApiClient2 } = await import("./api-PFXU7GZT.js");
|
|
379
379
|
const client = new LezuApiClient2(config);
|
|
380
380
|
try {
|
|
381
381
|
await client.addTranslationKey(key, translations);
|
|
382
|
-
console.log(chalk3.green("
|
|
382
|
+
console.log(chalk3.green("[Success] Translation key added successfully!"));
|
|
383
383
|
} catch (error) {
|
|
384
|
-
console.error(chalk3.red("
|
|
384
|
+
console.error(chalk3.red("[Error] Failed to add translation key:"), error);
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
async function configureGetCommand(rl, config) {
|
|
@@ -396,22 +396,22 @@ async function configureGetCommand(rl, config) {
|
|
|
396
396
|
switch (choice) {
|
|
397
397
|
case "1":
|
|
398
398
|
const project = await client.getProject();
|
|
399
|
-
console.log(chalk3.green("\n
|
|
399
|
+
console.log(chalk3.green("\n[Project Information]"));
|
|
400
400
|
console.log(` Name: ${project.project.name}`);
|
|
401
401
|
console.log(` Key: ${project.project.key}`);
|
|
402
402
|
console.log(` Source Language: ${project.project.source_language}`);
|
|
403
403
|
break;
|
|
404
404
|
case "2":
|
|
405
405
|
const languages = await client.getLanguages();
|
|
406
|
-
console.log(chalk3.green("\n
|
|
406
|
+
console.log(chalk3.green("\n[Languages]"));
|
|
407
407
|
languages.languages?.forEach((lang) => {
|
|
408
|
-
const status = lang.enabled ? "
|
|
408
|
+
const status = lang.enabled ? "[ON]" : "[OFF]";
|
|
409
409
|
console.log(` ${status} ${lang.language?.name || lang.language_code}`);
|
|
410
410
|
});
|
|
411
411
|
break;
|
|
412
412
|
case "3":
|
|
413
413
|
const releases = await client.getReleases();
|
|
414
|
-
console.log(chalk3.green("\n
|
|
414
|
+
console.log(chalk3.green("\n[Recent Releases]"));
|
|
415
415
|
releases.releases?.slice(0, 5).forEach((release) => {
|
|
416
416
|
const current = release.is_current ? " [CURRENT]" : "";
|
|
417
417
|
console.log(` \u2022 ${release.version}${current}`);
|
|
@@ -419,7 +419,7 @@ async function configureGetCommand(rl, config) {
|
|
|
419
419
|
break;
|
|
420
420
|
}
|
|
421
421
|
} catch (error) {
|
|
422
|
-
console.error(chalk3.red("
|
|
422
|
+
console.error(chalk3.red("[Error] Failed to get information:"), error);
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
425
|
async function configureReleaseCommand(rl, config) {
|
|
@@ -432,7 +432,7 @@ async function configureReleaseCommand(rl, config) {
|
|
|
432
432
|
const name = await rl.question(chalk3.gray("Name (optional): "));
|
|
433
433
|
const description = await rl.question(chalk3.gray("Description (optional): "));
|
|
434
434
|
const setCurrent = await rl.question(chalk3.gray("Set as current release? (y/n): "));
|
|
435
|
-
console.log(chalk3.green("\n
|
|
435
|
+
console.log(chalk3.green("\n[Creating] Release..."));
|
|
436
436
|
const { LezuApiClient: LezuApiClient2 } = await import("./api-PFXU7GZT.js");
|
|
437
437
|
const client = new LezuApiClient2(config);
|
|
438
438
|
try {
|
|
@@ -450,45 +450,49 @@ async function configureReleaseCommand(rl, config) {
|
|
|
450
450
|
}
|
|
451
451
|
});
|
|
452
452
|
}
|
|
453
|
-
console.log(chalk3.green("
|
|
453
|
+
console.log(chalk3.green("[Success] Release created successfully!"));
|
|
454
454
|
console.log(` ID: ${release.release.id}`);
|
|
455
455
|
console.log(` Version: ${release.release.version}`);
|
|
456
456
|
} catch (error) {
|
|
457
|
-
console.error(chalk3.red("
|
|
457
|
+
console.error(chalk3.red("[Error] Failed to create release:"), error);
|
|
458
458
|
}
|
|
459
459
|
} else {
|
|
460
460
|
const { LezuApiClient: LezuApiClient2 } = await import("./api-PFXU7GZT.js");
|
|
461
461
|
const client = new LezuApiClient2(config);
|
|
462
462
|
try {
|
|
463
463
|
const releases = await client.getReleases();
|
|
464
|
-
console.log(chalk3.green("\n
|
|
464
|
+
console.log(chalk3.green("\n[Releases]"));
|
|
465
465
|
releases.releases?.forEach((release, index) => {
|
|
466
466
|
const current = release.is_current ? " [CURRENT]" : "";
|
|
467
467
|
console.log(` ${index + 1}. ${release.version}${current}`);
|
|
468
468
|
});
|
|
469
469
|
} catch (error) {
|
|
470
|
-
console.error(chalk3.red("
|
|
470
|
+
console.error(chalk3.red("[Error] Failed to list releases:"), error);
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
|
|
475
475
|
// src/index.ts
|
|
476
|
-
var version = "0.0.
|
|
476
|
+
var version = "0.0.24";
|
|
477
477
|
program.name("lezu").description("CLI tool for managing translations with Lezu").version(version);
|
|
478
478
|
program.addCommand(createLoadCommand());
|
|
479
479
|
program.addCommand(createAddCommand());
|
|
480
480
|
program.addCommand(createGetCommand());
|
|
481
481
|
program.addCommand(createReleaseCommand());
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
482
|
+
if (process.argv.length <= 2) {
|
|
483
|
+
;
|
|
484
|
+
(async () => {
|
|
485
|
+
console.log(chalk4.blue("Welcome to Lezu CLI!"));
|
|
486
|
+
console.log();
|
|
487
|
+
try {
|
|
488
|
+
const config = loadConfig({});
|
|
489
|
+
await interactiveMode(config);
|
|
490
|
+
} catch (error) {
|
|
491
|
+
console.error(chalk4.red("\nError:"), error instanceof Error ? error.message : error);
|
|
492
|
+
process.exit(1);
|
|
493
|
+
}
|
|
494
|
+
})();
|
|
495
|
+
} else {
|
|
496
|
+
program.parse();
|
|
497
|
+
}
|
|
494
498
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/commands/release.ts","../src/interactive.ts"],"sourcesContent":["import { program } from 'commander'\nimport chalk from 'chalk'\nimport { createLoadCommand } from './commands/load.js'\nimport { createAddCommand } from './commands/add.js'\nimport { createGetCommand } from './commands/get.js'\nimport { createReleaseCommand } from './commands/release.js'\nimport { interactiveMode } from './interactive.js'\nimport { loadConfig } from './config.js'\n\n// Version from package.json\nconst version = '0.0.22'\n\nprogram\n .name('lezu')\n .description('CLI tool for managing translations with Lezu')\n .version(version)\n\n// Add subcommands\nprogram.addCommand(createLoadCommand())\nprogram.addCommand(createAddCommand())\nprogram.addCommand(createGetCommand())\nprogram.addCommand(createReleaseCommand())\n\n// Handle case when no command is provided - run interactive mode\nprogram.action(async () => {\n console.log(chalk.blue('👋 Welcome to Lezu CLI!'))\n console.log()\n \n try {\n // Load initial config from file/env for defaults\n const initialConfig = loadConfig({})\n await interactiveMode(initialConfig)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n})\n\n// Parse commands\nprogram.parse()","import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport type { Config } from '../types.js'\n\nexport function createAddCommand() {\n const command = new Command('add')\n .description('Add a new translation key with values')\n .requiredOption('-k, --key <key>', 'Translation key (e.g., \"common.save\")')\n .option('-v, --value <value>', 'Value for the source language')\n .option('--en <value>', 'English translation')\n .option('--es <value>', 'Spanish translation')\n .option('--fr <value>', 'French translation')\n .option('--de <value>', 'German translation')\n .option('--nl <value>', 'Dutch translation')\n .option('--it <value>', 'Italian translation')\n .option('--pt <value>', 'Portuguese translation')\n .option('--ru <value>', 'Russian translation')\n .option('--ja <value>', 'Japanese translation')\n .option('--ko <value>', 'Korean translation')\n .option('--zh <value>', 'Chinese translation')\n .option('--ar <value>', 'Arabic translation')\n .option('-d, --description <desc>', 'Description for the translation key')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--auto', 'Auto-translate to all enabled languages')\n .action(async (options) => {\n try {\n // Load configuration\n const config = loadConfig(options)\n \n // Validate configuration\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n // Collect translations from language options\n const translations: Record<string, string> = {}\n const languageOptions = ['en', 'es', 'fr', 'de', 'nl', 'it', 'pt', 'ru', 'ja', 'ko', 'zh', 'ar']\n \n languageOptions.forEach(lang => {\n if (options[lang]) {\n translations[lang] = options[lang]\n }\n })\n \n // If --value is provided without specific language, use project's source language\n if (options.value && Object.keys(translations).length === 0) {\n // We'll need to get the project info to determine source language\n const spinner = ora('Getting project information...').start()\n const client = new LezuApiClient(config)\n \n try {\n const { project } = await client.getProject()\n const sourceLanguage = project.source_language || 'en'\n translations[sourceLanguage] = options.value\n spinner.succeed(`Using ${sourceLanguage} as source language`)\n } catch (error) {\n spinner.fail('Failed to get project information')\n translations['en'] = options.value // fallback to English\n }\n }\n \n await addTranslationKey(config, {\n key: options.key,\n description: options.description,\n translations,\n auto: options.auto,\n })\n \n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n return command\n}\n\ninterface AddKeyOptions {\n key: string\n description?: string\n translations: Record<string, string>\n auto?: boolean\n}\n\nasync function addTranslationKey(config: Config, options: AddKeyOptions) {\n const spinner = ora('Adding translation key...').start()\n \n try {\n const client = new LezuApiClient(config)\n \n // Add the key with translations\n const response = await client.addTranslationKey(options.key, options.translations)\n \n spinner.succeed('Translation key added successfully!')\n \n // Show summary\n console.log(chalk.green('\\n✨ Key added:'))\n console.log(chalk.gray(` • Key: ${options.key}`))\n if (options.description) {\n console.log(chalk.gray(` • Description: ${options.description}`))\n }\n console.log(chalk.gray(` • Languages: ${Object.keys(options.translations).join(', ')}`))\n \n // Show translations\n if (Object.keys(options.translations).length > 0) {\n console.log(chalk.gray('\\n Translations:'))\n Object.entries(options.translations).forEach(([lang, value]) => {\n console.log(chalk.gray(` ${lang}: \"${value}\"`))\n })\n }\n \n // If auto-translate was used, show additional info\n if (options.auto) {\n console.log(chalk.cyan('\\n🤖 Auto-translation was enabled. Check the dashboard to review AI-generated translations.'))\n }\n \n } catch (error) {\n spinner.fail('Failed to add translation key')\n throw error\n }\n}","import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport type { Config } from '../types.js'\n\nexport function createReleaseCommand() {\n const command = new Command('release')\n .description('Manage releases')\n \n // Create release subcommand\n command\n .command('create')\n .alias('new')\n .description('Create a new release')\n .option('-v, --version <version>', 'Release version (e.g., \"1.0.0\")')\n .option('-n, --name <name>', 'Release name')\n .option('-d, --description <desc>', 'Release description')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--reviewed-only', 'Include only reviewed translations')\n .option('--set-current', 'Set this release as the current release')\n .option('--timestamp <iso>', 'Specific timestamp for the release (ISO format)')\n .option('--languages <langs>', 'Comma-separated list of languages to include')\n .option('--json', 'Output as JSON')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n await createRelease(config, options)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // Set current release subcommand\n command\n .command('current <releaseId>')\n .description('Set a release as current')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--json', 'Output as JSON')\n .action(async (releaseId, options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n await setCurrentRelease(config, releaseId, options)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // List releases (alias for get releases)\n command\n .command('list')\n .alias('ls')\n .description('List all releases')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('--json', 'Output as JSON')\n .option('--limit <n>', 'Limit number of results', '10')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n // Import and use the getReleases function from get command\n const { getReleases } = await import('./get.js')\n await getReleases(config, options)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n return command\n}\n\nasync function createRelease(config: Config, options: any) {\n const spinner = ora('Creating release...').start()\n \n try {\n const client = new LezuApiClient(config)\n \n // Parse languages if provided\n const languages = options.languages ? options.languages.split(',').map((l: string) => l.trim()) : undefined\n \n // Validate timestamp if provided\n let timestamp\n if (options.timestamp) {\n try {\n timestamp = new Date(options.timestamp).toISOString()\n } catch (error) {\n throw new Error('Invalid timestamp format. Use ISO format (e.g., 2023-12-01T10:00:00Z)')\n }\n }\n \n const releaseData = {\n environment: options.environment,\n version: options.version,\n name: options.name,\n description: options.description,\n reviewedOnly: options.reviewedOnly || false,\n setAsCurrent: options.setCurrent || false,\n timestamp,\n languages,\n }\n \n spinner.text = 'Creating release and generating bundles...'\n const response = await client.createRelease(releaseData)\n \n spinner.succeed('Release created successfully!')\n \n if (options.json) {\n console.log(JSON.stringify(response, null, 2))\n return\n }\n \n console.log(chalk.green('\\n🚀 Release Created:'))\n console.log(` ID: ${response.release.id}`)\n console.log(` Version: ${response.release.version}`)\n if (response.release.name) {\n console.log(` Name: ${response.release.name}`)\n }\n if (response.release.description) {\n console.log(` Description: ${response.release.description}`)\n }\n console.log(` Environment: ${response.release.environment?.name || options.environment}`)\n console.log(` Reviewed Only: ${response.release.reviewed_only ? 'Yes' : 'No'}`)\n console.log(` Is Current: ${response.release.is_current ? 'Yes' : 'No'}`)\n console.log(` Created: ${new Date(response.release.created_at).toLocaleString()}`)\n \n // Show bundle information\n if (response.release.artifacts && response.release.artifacts.length > 0) {\n console.log(chalk.green('\\n📦 Bundles Generated:'))\n response.release.artifacts.forEach((artifact: any) => {\n const sizeKB = Math.round(artifact.file_size / 1024)\n console.log(` • ${artifact.language_code}: ${sizeKB}KB`)\n })\n console.log(chalk.gray(`\\nTotal: ${response.release.artifacts.length} language bundles`))\n }\n \n console.log(chalk.cyan('\\n💡 You can now use this release with:'))\n console.log(chalk.gray(` npx lezu load --release ${response.release.id}`))\n \n if (response.release.is_current) {\n console.log(chalk.green('\\n✨ This release is now set as current!'))\n }\n \n } catch (error) {\n spinner.fail('Failed to create release')\n throw error\n }\n}\n\nasync function setCurrentRelease(config: Config, releaseId: string, options: any) {\n const spinner = ora('Setting release as current...').start()\n \n try {\n const response = await fetch(`${config.apiUrl}/v1/releases/${releaseId}/current`, {\n method: 'PUT',\n headers: {\n 'Authorization': `Bearer ${config.apiKey}`,\n 'Content-Type': 'application/json',\n },\n })\n \n if (!response.ok) {\n const error = await response.text()\n throw new Error(`Failed to set current release: ${response.status} ${response.statusText}\\n${error}`)\n }\n \n const data = await response.json()\n \n spinner.succeed('Release set as current!')\n \n if (options.json) {\n console.log(JSON.stringify(data, null, 2))\n return\n }\n \n console.log(chalk.green('\\n✨ Release Updated:'))\n console.log(` Release ID: ${releaseId}`)\n console.log(' Status: Now set as current release')\n \n console.log(chalk.cyan('\\n💡 All new bundle requests will now use this release'))\n \n } catch (error) {\n spinner.fail('Failed to set release as current')\n throw error\n }\n}","import * as readline from 'readline'\nimport { stdin as input, stdout as output } from 'process'\nimport { promisify } from 'util'\nimport chalk from 'chalk'\nimport { loadConfig } from './config.js'\nimport type { Config } from './types.js'\n\nexport async function interactiveMode(initialConfig: Partial<Config>): Promise<void> {\n const rl = readline.createInterface({ input, output })\n const question = promisify(rl.question).bind(rl)\n\n console.log(chalk.cyan('🌍 Lezu CLI - Interactive Mode\\n'))\n console.log(chalk.gray('What would you like to do?\\n'))\n\n try {\n // Show available commands\n console.log('Available commands:')\n console.log(chalk.green('1) load') + chalk.gray(' - Download translation files'))\n console.log(chalk.green('2) add') + chalk.gray(' - Add a new translation key'))\n console.log(chalk.green('3) get') + chalk.gray(' - Get project information'))\n console.log(chalk.green('4) release') + chalk.gray(' - Manage releases'))\n console.log()\n\n const commandChoice = await question(chalk.bold('Choose a command (1-4): '))\n \n let command: string\n switch (commandChoice) {\n case '1':\n command = 'load'\n break\n case '2':\n command = 'add'\n break\n case '3':\n command = 'get'\n break\n case '4':\n command = 'release'\n break\n default:\n console.log(chalk.yellow('Invalid choice, defaulting to load'))\n command = 'load'\n }\n\n console.log(chalk.cyan(`\\n📋 Setting up ${command} command...\\n`))\n\n // Get basic configuration\n const projectId = await rl.question(\n chalk.bold('Project ID') + \n (initialConfig.projectId ? chalk.gray(` (${initialConfig.projectId}): `) : ': ')\n ) || initialConfig.projectId\n\n if (!projectId) {\n throw new Error('Project ID is required')\n }\n\n const apiKey = await rl.question(\n chalk.bold('API Key') + \n (initialConfig.apiKey ? chalk.gray(' (current key will be used): ') : ': ')\n ) || initialConfig.apiKey\n\n if (!apiKey) {\n throw new Error('API Key is required')\n }\n\n const config = loadConfig({ projectId, apiKey, ...initialConfig })\n\n // Handle specific command configurations\n switch (command) {\n case 'load':\n await configureLoadCommand(rl, config)\n break\n case 'add':\n await configureAddCommand(rl, config)\n break\n case 'get':\n await configureGetCommand(rl, config)\n break\n case 'release':\n await configureReleaseCommand(rl, config)\n break\n }\n\n } catch (error) {\n throw error\n } finally {\n rl.close()\n }\n}\n\nasync function configureLoadCommand(rl: any, config: Config): Promise<void> {\n const { syncTranslations } = await import('./commands/load.js')\n \n console.log(chalk.bold('\\nLoad Configuration:'))\n \n // Destination\n const dest = await rl.question(\n chalk.gray(`Destination folder (${config.dest || './src/i18n'}): `)\n ) || config.dest || './src/i18n'\n\n // Format\n console.log(chalk.gray('\\nOutput format:'))\n console.log('1) JSON (default)')\n console.log('2) JavaScript (ES modules)')\n console.log('3) TypeScript')\n console.log('4) YAML')\n \n const formatChoice = await rl.question(chalk.gray('Choice (1-4): ')) || '1'\n const formatMap: Record<string, 'json' | 'js' | 'ts' | 'yaml'> = {\n '1': 'json',\n '2': 'js',\n '3': 'ts',\n '4': 'yaml'\n }\n const format = formatMap[formatChoice] || 'json'\n\n // Environment\n const environment = await rl.question(\n chalk.gray(`Environment (${config.environment || 'production'}): `)\n ) || config.environment || 'production'\n\n // Languages\n const languages = await rl.question(\n chalk.gray('Specific languages (comma-separated, leave empty for all): ')\n )\n\n const finalConfig = {\n ...config,\n dest,\n format,\n environment,\n languages: languages ? languages.split(',').map(l => l.trim()) : undefined\n }\n\n console.log(chalk.green('\\n🚀 Starting translation sync...'))\n \n // Import and execute the sync\n const { syncTranslations: sync } = await import('./commands/load.js')\n await sync(finalConfig)\n}\n\nasync function configureAddCommand(rl: any, config: Config): Promise<void> {\n console.log(chalk.bold('\\nAdd Translation Key:'))\n \n const key = await rl.question(chalk.bold('Translation key (e.g., \"common.save\"): '))\n if (!key) {\n throw new Error('Translation key is required')\n }\n\n const description = await rl.question(chalk.gray('Description (optional): '))\n\n console.log(chalk.gray('\\nDo you want to:'))\n console.log('1) Provide translations manually')\n console.log('2) Auto-translate from source language')\n \n const choice = await rl.question(chalk.gray('Choice (1-2): ')) || '1'\n\n let translations: Record<string, string> = {}\n let auto = false\n\n if (choice === '2') {\n auto = true\n const sourceValue = await rl.question(chalk.bold('Source language value: '))\n if (sourceValue) {\n // We'll determine the source language from the project\n translations.en = sourceValue // Default fallback\n }\n } else {\n console.log(chalk.gray('\\nEnter translations (press Enter to skip):'))\n const languages = ['en', 'es', 'fr', 'de', 'nl']\n \n for (const lang of languages) {\n const value = await rl.question(chalk.gray(`${lang}: `))\n if (value) {\n translations[lang] = value\n }\n }\n }\n\n console.log(chalk.green('\\n🚀 Adding translation key...'))\n\n // Import and execute the add command\n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n \n try {\n await client.addTranslationKey(key, translations)\n console.log(chalk.green('✅ Translation key added successfully!'))\n } catch (error) {\n console.error(chalk.red('❌ Failed to add translation key:'), error)\n }\n}\n\nasync function configureGetCommand(rl: any, config: Config): Promise<void> {\n console.log(chalk.bold('\\nGet Information:'))\n console.log('1) Project info')\n console.log('2) Languages')\n console.log('3) Releases')\n \n const choice = await rl.question(chalk.gray('What to get (1-3): ')) || '1'\n \n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n\n try {\n switch (choice) {\n case '1':\n const project = await client.getProject()\n console.log(chalk.green('\\n📋 Project Information:'))\n console.log(` Name: ${project.project.name}`)\n console.log(` Key: ${project.project.key}`)\n console.log(` Source Language: ${project.project.source_language}`)\n break\n \n case '2':\n const languages = await client.getLanguages()\n console.log(chalk.green('\\n🌍 Languages:'))\n languages.languages?.forEach((lang: any) => {\n const status = lang.enabled ? '✅' : '❌'\n console.log(` ${status} ${lang.language?.name || lang.language_code}`)\n })\n break\n \n case '3':\n const releases = await client.getReleases()\n console.log(chalk.green('\\n🚀 Recent Releases:'))\n releases.releases?.slice(0, 5).forEach((release: any) => {\n const current = release.is_current ? ' [CURRENT]' : ''\n console.log(` • ${release.version}${current}`)\n })\n break\n }\n } catch (error) {\n console.error(chalk.red('❌ Failed to get information:'), error)\n }\n}\n\nasync function configureReleaseCommand(rl: any, config: Config): Promise<void> {\n console.log(chalk.bold('\\nRelease Management:'))\n console.log('1) Create new release')\n console.log('2) List releases')\n \n const choice = await rl.question(chalk.gray('Choice (1-2): ')) || '1'\n\n if (choice === '1') {\n const version = await rl.question(chalk.bold('Version (e.g., \"1.0.0\"): '))\n const name = await rl.question(chalk.gray('Name (optional): '))\n const description = await rl.question(chalk.gray('Description (optional): '))\n \n const setCurrent = await rl.question(chalk.gray('Set as current release? (y/n): '))\n\n console.log(chalk.green('\\n🚀 Creating release...'))\n\n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n \n try {\n const release = await client.createRelease({\n version,\n name,\n description,\n reviewedOnly: false,\n })\n \n if (setCurrent?.toLowerCase() === 'y') {\n // Set as current\n await fetch(`${config.apiUrl}/v1/releases/${release.release.id}/current`, {\n method: 'PUT',\n headers: {\n 'Authorization': `Bearer ${config.apiKey}`,\n },\n })\n }\n \n console.log(chalk.green('✅ Release created successfully!'))\n console.log(` ID: ${release.release.id}`)\n console.log(` Version: ${release.release.version}`)\n } catch (error) {\n console.error(chalk.red('❌ Failed to create release:'), error)\n }\n \n } else {\n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n \n try {\n const releases = await client.getReleases()\n console.log(chalk.green('\\n🚀 Releases:'))\n releases.releases?.forEach((release: any, index: number) => {\n const current = release.is_current ? ' [CURRENT]' : ''\n console.log(` ${index + 1}. ${release.version}${current}`)\n })\n } catch (error) {\n console.error(chalk.red('❌ Failed to list releases:'), error)\n }\n }\n}"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAOA,YAAW;;;ACDlB,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,SAAS;AAKT,SAAS,mBAAmB;AACjC,QAAM,UAAU,IAAI,QAAQ,KAAK,EAC9B,YAAY,uCAAuC,EACnD,eAAe,mBAAmB,uCAAuC,EACzE,OAAO,uBAAuB,+BAA+B,EAC7D,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,gBAAgB,mBAAmB,EAC1C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,wBAAwB,EAC/C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,sBAAsB,EAC7C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,4BAA4B,qCAAqC,EACxE,OAAO,sBAAsB,YAAY,EACzC,OAAO,uBAAuB,SAAS,EACvC,OAAO,mBAAmB,WAAW,sBAAsB,EAC3D,OAAO,UAAU,yCAAyC,EAC1D,OAAO,OAAO,YAAY;AACzB,QAAI;AAEF,YAAM,SAAS,WAAW,OAAO;AAGjC,YAAM,SAAS,eAAe,MAAM;AACpC,UAAI,OAAO,SAAS,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;AACd,cAAQ,MAAMA,OAAM,IAAI,iCAA4B,GAAG,KAAK;AAAA,IAC9D;AAAA,EACF;AACF;;;AH9RA,IAAM,UAAU;AAEhB,QACG,KAAK,MAAM,EACX,YAAY,8CAA8C,EAC1D,QAAQ,OAAO;AAGlB,QAAQ,WAAW,kBAAkB,CAAC;AACtC,QAAQ,WAAW,iBAAiB,CAAC;AACrC,QAAQ,WAAW,iBAAiB,CAAC;AACrC,QAAQ,WAAW,qBAAqB,CAAC;AAGzC,QAAQ,OAAO,YAAY;AACzB,UAAQ,IAAIG,OAAM,KAAK,gCAAyB,CAAC;AACjD,UAAQ,IAAI;AAEZ,MAAI;AAEF,UAAM,gBAAgB,WAAW,CAAC,CAAC;AACnC,UAAM,gBAAgB,aAAa;AAAA,EACrC,SAAS,OAAO;AACd,YAAQ,MAAMA,OAAM,IAAI,iBAAY,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AACrF,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC;AAGD,QAAQ,MAAM;","names":["chalk","Command","chalk","ora","Command","chalk","ora","chalk","chalk","LezuApiClient","version","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/commands/release.ts","../src/interactive.ts"],"sourcesContent":["import { program } from 'commander'\nimport chalk from 'chalk'\nimport { createLoadCommand } from './commands/load.js'\nimport { createAddCommand } from './commands/add.js'\nimport { createGetCommand } from './commands/get.js'\nimport { createReleaseCommand } from './commands/release.js'\nimport { interactiveMode } from './interactive.js'\nimport { loadConfig } from './config.js'\n\n// Version from package.json\nconst version = '0.0.24'\n\nprogram\n .name('lezu')\n .description('CLI tool for managing translations with Lezu')\n .version(version)\n\n// Add subcommands\nprogram.addCommand(createLoadCommand())\nprogram.addCommand(createAddCommand())\nprogram.addCommand(createGetCommand())\nprogram.addCommand(createReleaseCommand())\n\n// If no command was provided, run interactive mode\nif (process.argv.length <= 2) {\n ;(async () => {\n console.log(chalk.blue('Welcome to Lezu CLI!'))\n console.log()\n \n try {\n const config = loadConfig({})\n await interactiveMode(config)\n } catch (error) {\n console.error(chalk.red('\\nError:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })()\n} else {\n // Parse commands normally\n program.parse()\n}","import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport type { Config } from '../types.js'\n\nexport function createAddCommand() {\n const command = new Command('add')\n .description('Add a new translation key with values')\n .requiredOption('-k, --key <key>', 'Translation key (e.g., \"common.save\")')\n .option('-v, --value <value>', 'Value for the source language')\n .option('--en <value>', 'English translation')\n .option('--es <value>', 'Spanish translation')\n .option('--fr <value>', 'French translation')\n .option('--de <value>', 'German translation')\n .option('--nl <value>', 'Dutch translation')\n .option('--it <value>', 'Italian translation')\n .option('--pt <value>', 'Portuguese translation')\n .option('--ru <value>', 'Russian translation')\n .option('--ja <value>', 'Japanese translation')\n .option('--ko <value>', 'Korean translation')\n .option('--zh <value>', 'Chinese translation')\n .option('--ar <value>', 'Arabic translation')\n .option('-d, --description <desc>', 'Description for the translation key')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--auto', 'Auto-translate to all enabled languages')\n .action(async (options) => {\n try {\n // Load configuration\n const config = loadConfig(options)\n \n // Validate configuration\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n // Collect translations from language options\n const translations: Record<string, string> = {}\n const languageOptions = ['en', 'es', 'fr', 'de', 'nl', 'it', 'pt', 'ru', 'ja', 'ko', 'zh', 'ar']\n \n languageOptions.forEach(lang => {\n if (options[lang]) {\n translations[lang] = options[lang]\n }\n })\n \n // If --value is provided without specific language, use project's source language\n if (options.value && Object.keys(translations).length === 0) {\n // We'll need to get the project info to determine source language\n const spinner = ora('Getting project information...').start()\n const client = new LezuApiClient(config)\n \n try {\n const { project } = await client.getProject()\n const sourceLanguage = project.source_language || 'en'\n translations[sourceLanguage] = options.value\n spinner.succeed(`Using ${sourceLanguage} as source language`)\n } catch (error) {\n spinner.fail('Failed to get project information')\n translations['en'] = options.value // fallback to English\n }\n }\n \n await addTranslationKey(config, {\n key: options.key,\n description: options.description,\n translations,\n auto: options.auto,\n })\n \n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n return command\n}\n\ninterface AddKeyOptions {\n key: string\n description?: string\n translations: Record<string, string>\n auto?: boolean\n}\n\nasync function addTranslationKey(config: Config, options: AddKeyOptions) {\n const spinner = ora('Adding translation key...').start()\n \n try {\n const client = new LezuApiClient(config)\n \n // Add the key with translations\n const response = await client.addTranslationKey(options.key, options.translations)\n \n spinner.succeed('Translation key added successfully!')\n \n // Show summary\n console.log(chalk.green('\\n[Success] Key added:'))\n console.log(chalk.gray(` - Key: ${options.key}`))\n if (options.description) {\n console.log(chalk.gray(` - Description: ${options.description}`))\n }\n console.log(chalk.gray(` - Languages: ${Object.keys(options.translations).join(', ')}`))\n \n // Show translations\n if (Object.keys(options.translations).length > 0) {\n console.log(chalk.gray('\\n Translations:'))\n Object.entries(options.translations).forEach(([lang, value]) => {\n console.log(chalk.gray(` ${lang}: \"${value}\"`))\n })\n }\n \n // If auto-translate was used, show additional info\n if (options.auto) {\n console.log(chalk.cyan('\\n[AI] Auto-translation was enabled. Check the dashboard to review AI-generated translations.'))\n }\n \n } catch (error) {\n spinner.fail('Failed to add translation key')\n throw error\n }\n}","import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport type { Config } from '../types.js'\n\nexport function createReleaseCommand() {\n const command = new Command('release')\n .description('Manage releases')\n \n // Create release subcommand\n command\n .command('create')\n .alias('new')\n .description('Create a new release')\n .option('-v, --version <version>', 'Release version (e.g., \"1.0.0\")')\n .option('-n, --name <name>', 'Release name')\n .option('-d, --description <desc>', 'Release description')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--reviewed-only', 'Include only reviewed translations')\n .option('--set-current', 'Set this release as the current release')\n .option('--timestamp <iso>', 'Specific timestamp for the release (ISO format)')\n .option('--languages <langs>', 'Comma-separated list of languages to include')\n .option('--json', 'Output as JSON')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n await createRelease(config, options)\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // Set current release subcommand\n command\n .command('current <releaseId>')\n .description('Set a release as current')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--json', 'Output as JSON')\n .action(async (releaseId, options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n await setCurrentRelease(config, releaseId, options)\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // List releases (alias for get releases)\n command\n .command('list')\n .alias('ls')\n .description('List all releases')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('--json', 'Output as JSON')\n .option('--limit <n>', 'Limit number of results', '10')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` - ${error}`)))\n process.exit(1)\n }\n \n // Import and use the getReleases function from get command\n const { getReleases } = await import('./get.js')\n await getReleases(config, options)\n } catch (error) {\n console.error(chalk.red('\\n[Error]'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n return command\n}\n\nasync function createRelease(config: Config, options: any) {\n const spinner = ora('Creating release...').start()\n \n try {\n const client = new LezuApiClient(config)\n \n // Parse languages if provided\n const languages = options.languages ? options.languages.split(',').map((l: string) => l.trim()) : undefined\n \n // Validate timestamp if provided\n let timestamp\n if (options.timestamp) {\n try {\n timestamp = new Date(options.timestamp).toISOString()\n } catch (error) {\n throw new Error('Invalid timestamp format. Use ISO format (e.g., 2023-12-01T10:00:00Z)')\n }\n }\n \n const releaseData = {\n environment: options.environment,\n version: options.version,\n name: options.name,\n description: options.description,\n reviewedOnly: options.reviewedOnly || false,\n setAsCurrent: options.setCurrent || false,\n timestamp,\n languages,\n }\n \n spinner.text = 'Creating release and generating bundles...'\n const response = await client.createRelease(releaseData)\n \n spinner.succeed('Release created successfully!')\n \n if (options.json) {\n console.log(JSON.stringify(response, null, 2))\n return\n }\n \n console.log(chalk.green('\\n[Release Created]'))\n console.log(` ID: ${response.release.id}`)\n console.log(` Version: ${response.release.version}`)\n if (response.release.name) {\n console.log(` Name: ${response.release.name}`)\n }\n if (response.release.description) {\n console.log(` Description: ${response.release.description}`)\n }\n console.log(` Environment: ${response.release.environment?.name || options.environment}`)\n console.log(` Reviewed Only: ${response.release.reviewed_only ? 'Yes' : 'No'}`)\n console.log(` Is Current: ${response.release.is_current ? 'Yes' : 'No'}`)\n console.log(` Created: ${new Date(response.release.created_at).toLocaleString()}`)\n \n // Show bundle information\n if (response.release.artifacts && response.release.artifacts.length > 0) {\n console.log(chalk.green('\\n[Bundles Generated]'))\n response.release.artifacts.forEach((artifact: any) => {\n const sizeKB = Math.round(artifact.file_size / 1024)\n console.log(` - ${artifact.language_code}: ${sizeKB}KB`)\n })\n console.log(chalk.gray(`\\nTotal: ${response.release.artifacts.length} language bundles`))\n }\n \n console.log(chalk.cyan('\\n[Tip] You can now use this release with:'))\n console.log(chalk.gray(` npx lezu load --release ${response.release.id}`))\n \n if (response.release.is_current) {\n console.log(chalk.green('\\n[Success] This release is now set as current!'))\n }\n \n } catch (error) {\n spinner.fail('Failed to create release')\n throw error\n }\n}\n\nasync function setCurrentRelease(config: Config, releaseId: string, options: any) {\n const spinner = ora('Setting release as current...').start()\n \n try {\n const response = await fetch(`${config.apiUrl}/v1/releases/${releaseId}/current`, {\n method: 'PUT',\n headers: {\n 'Authorization': `Bearer ${config.apiKey}`,\n 'Content-Type': 'application/json',\n },\n })\n \n if (!response.ok) {\n const error = await response.text()\n throw new Error(`Failed to set current release: ${response.status} ${response.statusText}\\n${error}`)\n }\n \n const data = await response.json()\n \n spinner.succeed('Release set as current!')\n \n if (options.json) {\n console.log(JSON.stringify(data, null, 2))\n return\n }\n \n console.log(chalk.green('\\n[Release Updated]'))\n console.log(` Release ID: ${releaseId}`)\n console.log(' Status: Now set as current release')\n \n console.log(chalk.cyan('\\n[Info] All new bundle requests will now use this release'))\n \n } catch (error) {\n spinner.fail('Failed to set release as current')\n throw error\n }\n}","import * as readline from 'readline'\nimport { stdin as input, stdout as output } from 'process'\nimport { promisify } from 'util'\nimport chalk from 'chalk'\nimport { loadConfig } from './config.js'\nimport type { Config } from './types.js'\n\nexport async function interactiveMode(initialConfig: Partial<Config>): Promise<void> {\n const rl = readline.createInterface({ input, output })\n const question = promisify(rl.question).bind(rl)\n\n console.log(chalk.cyan('[Lezu CLI] Interactive Mode\\n'))\n console.log(chalk.gray('What would you like to do?\\n'))\n\n try {\n // Show available commands\n console.log('Available commands:')\n console.log(chalk.green('1) load') + chalk.gray(' - Download translation files'))\n console.log(chalk.green('2) add') + chalk.gray(' - Add a new translation key'))\n console.log(chalk.green('3) get') + chalk.gray(' - Get project information'))\n console.log(chalk.green('4) release') + chalk.gray(' - Manage releases'))\n console.log()\n\n const commandChoice = await question(chalk.bold('Choose a command (1-4): '))\n \n let command: string\n switch (commandChoice) {\n case '1':\n command = 'load'\n break\n case '2':\n command = 'add'\n break\n case '3':\n command = 'get'\n break\n case '4':\n command = 'release'\n break\n default:\n console.log(chalk.yellow('Invalid choice, defaulting to load'))\n command = 'load'\n }\n\n console.log(chalk.cyan(`\\n[Setup] Setting up ${command} command...\\n`))\n\n // Get basic configuration\n const projectId = await rl.question(\n chalk.bold('Project ID') + \n (initialConfig.projectId ? chalk.gray(` (${initialConfig.projectId}): `) : ': ')\n ) || initialConfig.projectId\n\n if (!projectId) {\n throw new Error('Project ID is required')\n }\n\n const apiKey = await rl.question(\n chalk.bold('API Key') + \n (initialConfig.apiKey ? chalk.gray(' (current key will be used): ') : ': ')\n ) || initialConfig.apiKey\n\n if (!apiKey) {\n throw new Error('API Key is required')\n }\n\n const config = loadConfig({ projectId, apiKey, ...initialConfig })\n\n // Handle specific command configurations\n switch (command) {\n case 'load':\n await configureLoadCommand(rl, config)\n break\n case 'add':\n await configureAddCommand(rl, config)\n break\n case 'get':\n await configureGetCommand(rl, config)\n break\n case 'release':\n await configureReleaseCommand(rl, config)\n break\n }\n\n } catch (error) {\n throw error\n } finally {\n rl.close()\n }\n}\n\nasync function configureLoadCommand(rl: any, config: Config): Promise<void> {\n const { syncTranslations } = await import('./commands/load.js')\n \n console.log(chalk.bold('\\nLoad Configuration:'))\n \n // Destination\n const dest = await rl.question(\n chalk.gray(`Destination folder (${config.dest || './src/i18n'}): `)\n ) || config.dest || './src/i18n'\n\n // Format\n console.log(chalk.gray('\\nOutput format:'))\n console.log('1) JSON (default)')\n console.log('2) JavaScript (ES modules)')\n console.log('3) TypeScript')\n console.log('4) YAML')\n \n const formatChoice = await rl.question(chalk.gray('Choice (1-4): ')) || '1'\n const formatMap: Record<string, 'json' | 'js' | 'ts' | 'yaml'> = {\n '1': 'json',\n '2': 'js',\n '3': 'ts',\n '4': 'yaml'\n }\n const format = formatMap[formatChoice] || 'json'\n\n // Environment\n const environment = await rl.question(\n chalk.gray(`Environment (${config.environment || 'production'}): `)\n ) || config.environment || 'production'\n\n // Languages\n const languages = await rl.question(\n chalk.gray('Specific languages (comma-separated, leave empty for all): ')\n )\n\n const finalConfig = {\n ...config,\n dest,\n format,\n environment,\n languages: languages ? languages.split(',').map(l => l.trim()) : undefined\n }\n\n console.log(chalk.green('\\n[Starting] Translation sync...'))\n \n // Import and execute the sync\n const { syncTranslations: sync } = await import('./commands/load.js')\n await sync(finalConfig)\n}\n\nasync function configureAddCommand(rl: any, config: Config): Promise<void> {\n console.log(chalk.bold('\\nAdd Translation Key:'))\n \n const key = await rl.question(chalk.bold('Translation key (e.g., \"common.save\"): '))\n if (!key) {\n throw new Error('Translation key is required')\n }\n\n const description = await rl.question(chalk.gray('Description (optional): '))\n\n console.log(chalk.gray('\\nDo you want to:'))\n console.log('1) Provide translations manually')\n console.log('2) Auto-translate from source language')\n \n const choice = await rl.question(chalk.gray('Choice (1-2): ')) || '1'\n\n let translations: Record<string, string> = {}\n let auto = false\n\n if (choice === '2') {\n auto = true\n const sourceValue = await rl.question(chalk.bold('Source language value: '))\n if (sourceValue) {\n // We'll determine the source language from the project\n translations.en = sourceValue // Default fallback\n }\n } else {\n console.log(chalk.gray('\\nEnter translations (press Enter to skip):'))\n const languages = ['en', 'es', 'fr', 'de', 'nl']\n \n for (const lang of languages) {\n const value = await rl.question(chalk.gray(`${lang}: `))\n if (value) {\n translations[lang] = value\n }\n }\n }\n\n console.log(chalk.green('\\n[Adding] Translation key...'))\n\n // Import and execute the add command\n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n \n try {\n await client.addTranslationKey(key, translations)\n console.log(chalk.green('[Success] Translation key added successfully!'))\n } catch (error) {\n console.error(chalk.red('[Error] Failed to add translation key:'), error)\n }\n}\n\nasync function configureGetCommand(rl: any, config: Config): Promise<void> {\n console.log(chalk.bold('\\nGet Information:'))\n console.log('1) Project info')\n console.log('2) Languages')\n console.log('3) Releases')\n \n const choice = await rl.question(chalk.gray('What to get (1-3): ')) || '1'\n \n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n\n try {\n switch (choice) {\n case '1':\n const project = await client.getProject()\n console.log(chalk.green('\\n[Project Information]'))\n console.log(` Name: ${project.project.name}`)\n console.log(` Key: ${project.project.key}`)\n console.log(` Source Language: ${project.project.source_language}`)\n break\n \n case '2':\n const languages = await client.getLanguages()\n console.log(chalk.green('\\n[Languages]'))\n languages.languages?.forEach((lang: any) => {\n const status = lang.enabled ? '[ON]' : '[OFF]'\n console.log(` ${status} ${lang.language?.name || lang.language_code}`)\n })\n break\n \n case '3':\n const releases = await client.getReleases()\n console.log(chalk.green('\\n[Recent Releases]'))\n releases.releases?.slice(0, 5).forEach((release: any) => {\n const current = release.is_current ? ' [CURRENT]' : ''\n console.log(` • ${release.version}${current}`)\n })\n break\n }\n } catch (error) {\n console.error(chalk.red('[Error] Failed to get information:'), error)\n }\n}\n\nasync function configureReleaseCommand(rl: any, config: Config): Promise<void> {\n console.log(chalk.bold('\\nRelease Management:'))\n console.log('1) Create new release')\n console.log('2) List releases')\n \n const choice = await rl.question(chalk.gray('Choice (1-2): ')) || '1'\n\n if (choice === '1') {\n const version = await rl.question(chalk.bold('Version (e.g., \"1.0.0\"): '))\n const name = await rl.question(chalk.gray('Name (optional): '))\n const description = await rl.question(chalk.gray('Description (optional): '))\n \n const setCurrent = await rl.question(chalk.gray('Set as current release? (y/n): '))\n\n console.log(chalk.green('\\n[Creating] Release...'))\n\n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n \n try {\n const release = await client.createRelease({\n version,\n name,\n description,\n reviewedOnly: false,\n })\n \n if (setCurrent?.toLowerCase() === 'y') {\n // Set as current\n await fetch(`${config.apiUrl}/v1/releases/${release.release.id}/current`, {\n method: 'PUT',\n headers: {\n 'Authorization': `Bearer ${config.apiKey}`,\n },\n })\n }\n \n console.log(chalk.green('[Success] Release created successfully!'))\n console.log(` ID: ${release.release.id}`)\n console.log(` Version: ${release.release.version}`)\n } catch (error) {\n console.error(chalk.red('[Error] Failed to create release:'), error)\n }\n \n } else {\n const { LezuApiClient } = await import('./api.js')\n const client = new LezuApiClient(config)\n \n try {\n const releases = await client.getReleases()\n console.log(chalk.green('\\n[Releases]'))\n releases.releases?.forEach((release: any, index: number) => {\n const current = release.is_current ? ' [CURRENT]' : ''\n console.log(` ${index + 1}. ${release.version}${current}`)\n })\n } catch (error) {\n console.error(chalk.red('[Error] Failed to list releases:'), error)\n }\n }\n}"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAOA,YAAW;;;ACDlB,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,SAAS;AAKT,SAAS,mBAAmB;AACjC,QAAM,UAAU,IAAI,QAAQ,KAAK,EAC9B,YAAY,uCAAuC,EACnD,eAAe,mBAAmB,uCAAuC,EACzE,OAAO,uBAAuB,+BAA+B,EAC7D,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,gBAAgB,mBAAmB,EAC1C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,wBAAwB,EAC/C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,sBAAsB,EAC7C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,gBAAgB,qBAAqB,EAC5C,OAAO,gBAAgB,oBAAoB,EAC3C,OAAO,4BAA4B,qCAAqC,EACxE,OAAO,sBAAsB,YAAY,EACzC,OAAO,uBAAuB,SAAS,EACvC,OAAO,mBAAmB,WAAW,sBAAsB,EAC3D,OAAO,UAAU,yCAAyC,EAC1D,OAAO,OAAO,YAAY;AACzB,QAAI;AAEF,YAAM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OAAO,GAAG,OAAO,EAAE;AAAA,MAC5D,CAAC;AAAA,IACH,SAAS,OAAO;AACd,cAAQ,MAAMA,OAAM,IAAI,kCAAkC,GAAG,KAAK;AAAA,IACpE;AAAA,EACF;AACF;;;AH9RA,IAAM,UAAU;AAEhB,QACG,KAAK,MAAM,EACX,YAAY,8CAA8C,EAC1D,QAAQ,OAAO;AAGlB,QAAQ,WAAW,kBAAkB,CAAC;AACtC,QAAQ,WAAW,iBAAiB,CAAC;AACrC,QAAQ,WAAW,iBAAiB,CAAC;AACrC,QAAQ,WAAW,qBAAqB,CAAC;AAGzC,IAAI,QAAQ,KAAK,UAAU,GAAG;AAC5B;AAAC,GAAC,YAAY;AACZ,YAAQ,IAAIG,OAAM,KAAK,sBAAsB,CAAC;AAC9C,YAAQ,IAAI;AAEZ,QAAI;AACF,YAAM,SAAS,WAAW,CAAC,CAAC;AAC5B,YAAM,gBAAgB,MAAM;AAAA,IAC9B,SAAS,OAAO;AACd,cAAQ,MAAMA,OAAM,IAAI,UAAU,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AACnF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,GAAG;AACL,OAAO;AAEL,UAAQ,MAAM;AAChB;","names":["chalk","Command","chalk","ora","Command","chalk","ora","chalk","chalk","LezuApiClient","version","chalk"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLoadCommand,
|
|
3
3
|
syncTranslations
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-XLG4OXOO.js";
|
|
5
|
+
import "./chunk-EVS3X4J2.js";
|
|
6
6
|
import "./chunk-WZDLWLM3.js";
|
|
7
7
|
export {
|
|
8
8
|
createLoadCommand,
|
|
9
9
|
syncTranslations
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=load-
|
|
11
|
+
//# sourceMappingURL=load-5U463JIB.js.map
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts","../src/types.ts"],"sourcesContent":["import { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\nimport dotenv from 'dotenv'\nimport { Config, ConfigSchema } from './types.js'\n\n// Load environment variables\ndotenv.config()\n\nexport function loadConfig(options: Partial<Config> = {}): Config {\n // 1. Start with defaults\n let config: Partial<Config> = {\n apiUrl: 'https://api.lezu.app',\n dest: './src/i18n',\n format: 'json',\n environment: 'production',\n flatten: false,\n namespace: false,\n includeEmpty: false,\n watch: false,\n watchInterval: 5000\n }\n\n // 2. Load from config file (only JSON files to avoid JS module complexity)\n const configFiles = ['.lezurc', '.lezurc.json']\n for (const file of configFiles) {\n const configPath = resolve(process.cwd(), file)\n if (existsSync(configPath)) {\n try {\n // JSON config files only\n const content = readFileSync(configPath, 'utf-8')\n const fileConfig = JSON.parse(content)\n config = { ...config, ...fileConfig }\n console.log(`📁 Loaded config from ${file}`)\n break\n } catch (error) {\n console.warn(`⚠️ Failed to load config from ${file}:`, error)\n }\n }\n }\n\n // 3. Load from environment variables\n if (process.env.LEZU_PROJECT_ID) {\n config.projectId = process.env.LEZU_PROJECT_ID\n }\n if (process.env.LEZU_API_KEY) {\n config.apiKey = process.env.LEZU_API_KEY\n }\n if (process.env.LEZU_API_URL) {\n config.apiUrl = process.env.LEZU_API_URL\n }\n if (process.env.LEZU_DEST) {\n config.dest = process.env.LEZU_DEST\n }\n if (process.env.LEZU_FORMAT) {\n config.format = process.env.LEZU_FORMAT as any\n }\n if (process.env.LEZU_ENVIRONMENT) {\n config.environment = process.env.LEZU_ENVIRONMENT\n }\n\n // 4. Apply CLI options (highest priority)\n config = { ...config, ...options }\n\n // 5. Validate and return\n try {\n return ConfigSchema.parse(config)\n } catch (error) {\n if (error instanceof Error) {\n throw new Error(`Invalid configuration: ${error.message}`)\n }\n throw error\n }\n}\n\nexport function validateConfig(config: Config): string[] {\n const errors: string[] = []\n\n if (!config.projectId) {\n errors.push('Project ID is required (use --project, LEZU_PROJECT_ID env var, or projectId in config file)')\n }\n\n if (!config.apiKey) {\n errors.push('API Key is required (use --api-key, LEZU_API_KEY env var, or apiKey in config file)')\n }\n\n return errors\n}","import { z } from 'zod'\n\nexport const ConfigSchema = z.object({\n projectId: z.string().optional(),\n apiKey: z.string().optional(),\n apiUrl: z.string().default('https://api.lezu.app'),\n dest: z.string().default('./src/i18n'),\n format: z.enum(['json', 'js', 'ts', 'yaml', 'po']).default('json'),\n languages: z.array(z.string()).optional(),\n release: z.string().optional(),\n environment: z.string().default('production'),\n flatten: z.boolean().default(false),\n namespace: z.boolean().default(false),\n includeEmpty: z.boolean().default(false),\n watch: z.boolean().default(false),\n watchInterval: z.number().default(5000)\n})\n\nexport type Config = z.infer<typeof ConfigSchema>\n\nexport interface TranslationBundle {\n [key: string]: string | TranslationBundle\n}\n\nexport interface ApiResponse {\n translations: Record<string, any>\n meta?: {\n version?: string\n timestamp?: string\n languages?: string[]\n }\n}\n\nexport interface ReleaseResponse {\n releases: Array<{\n id: string\n version: string\n name?: string\n created_at: string\n }>\n}"],"mappings":";AAAA,SAAS,cAAc,kBAAkB;AACzC,SAAS,eAAe;AACxB,OAAO,YAAY;;;ACFnB,SAAS,SAAS;AAEX,IAAM,eAAe,EAAE,OAAO;AAAA,EACnC,WAAW,EAAE,OAAO,EAAE,SAAS;AAAA,EAC/B,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,QAAQ,EAAE,OAAO,EAAE,QAAQ,sBAAsB;AAAA,EACjD,MAAM,EAAE,OAAO,EAAE,QAAQ,YAAY;AAAA,EACrC,QAAQ,EAAE,KAAK,CAAC,QAAQ,MAAM,MAAM,QAAQ,IAAI,CAAC,EAAE,QAAQ,MAAM;AAAA,EACjE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACxC,SAAS,EAAE,OAAO,EAAE,SAAS;AAAA,EAC7B,aAAa,EAAE,OAAO,EAAE,QAAQ,Y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I;AAAA,EAC5B;AACA,MAAI,QAAQ,IAAI,aAAa;AAC3B,WAAO,SAAS,QAAQ,IAAI;AAAA,EAC9B;AACA,MAAI,QAAQ,IAAI,kBAAkB;AAChC,WAAO,cAAc,QAAQ,IAAI;AAAA,EACnC;AAGA,WAAS,EAAE,GAAG,QAAQ,GAAG,QAAQ;AAGjC,MAAI;AACF,WAAO,aAAa,MAAM,MAAM;AAAA,EAClC,SAAS,OAAO;AACd,QAAI,iBAAiB,OAAO;AAC1B,YAAM,IAAI,MAAM,0BAA0B,MAAM,OAAO,EAAE;AAAA,IAC3D;AACA,UAAM;AAAA,EACR;AACF;AAEO,SAAS,eAAe,QAA0B;AACvD,QAAM,SAAmB,CAAC;AAE1B,MAAI,CAAC,OAAO,WAAW;AACrB,WAAO,KAAK,8FAA8F;AAAA,EAC5G;AAEA,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO,KAAK,qFAAqF;AAAA,EACnG;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/get.ts"],"sourcesContent":["import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport type { Config } from '../types.js'\n\nexport function createGetCommand() {\n const command = new Command('get')\n .description('Get information about your project')\n \n // Languages subcommand\n command\n .command('languages')\n .alias('langs')\n .description('List all languages in your project')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--include-disabled', 'Include disabled languages')\n .option('--json', 'Output as JSON')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n await getLanguages(config, options)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // Releases subcommand\n command\n .command('releases')\n .description('List all releases in your project')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('--json', 'Output as JSON')\n .option('--limit <n>', 'Limit number of results', '10')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n await getReleases(config, options)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n // Project info subcommand\n command\n .command('project')\n .alias('info')\n .description('Get project information and statistics')\n .option('-p, --project <id>', 'Project ID')\n .option('-a, --api-key <key>', 'API key')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--json', 'Output as JSON')\n .option('--stats', 'Include detailed statistics')\n .action(async (options) => {\n try {\n const config = loadConfig(options)\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n \n await getProject(config, options)\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n \n return command\n}\n\nasync function getLanguages(config: Config, options: any) {\n const spinner = ora('Fetching languages...').start()\n \n try {\n const client = new LezuApiClient(config)\n const response = await client.getLanguages()\n \n spinner.succeed('Languages fetched successfully!')\n \n if (options.json) {\n console.log(JSON.stringify(response, null, 2))\n return\n }\n \n console.log(chalk.green('\\n📚 Project Languages:'))\n \n if (!response.languages || response.languages.length === 0) {\n console.log(chalk.gray(' No languages found'))\n return\n }\n \n response.languages.forEach((lang: any) => {\n const status = lang.enabled ? chalk.green('✓') : chalk.gray('✗')\n const progress = lang.progress ? ` (${lang.progress.percentage}% complete)` : ''\n const source = lang.is_source ? chalk.yellow(' [SOURCE]') : ''\n \n console.log(` ${status} ${lang.language?.name || lang.language_code} (${lang.language_code})${source}${progress}`)\n \n if (lang.progress && lang.progress.total > 0) {\n console.log(chalk.gray(` ${lang.progress.translated}/${lang.progress.total} keys translated`))\n }\n })\n \n console.log(chalk.gray(`\\nTotal: ${response.total} languages`))\n \n } catch (error) {\n spinner.fail('Failed to fetch languages')\n throw error\n }\n}\n\nasync function getReleases(config: Config, options: any) {\n const spinner = ora('Fetching releases...').start()\n \n try {\n const client = new LezuApiClient(config)\n const response = await client.getReleases()\n \n spinner.succeed('Releases fetched successfully!')\n \n if (options.json) {\n console.log(JSON.stringify(response, null, 2))\n return\n }\n \n console.log(chalk.green(`\\n🚀 Releases (${options.environment} environment):`))\n \n if (!response.releases || response.releases.length === 0) {\n console.log(chalk.gray(' No releases found'))\n return\n }\n \n const limit = parseInt(options.limit, 10)\n const releases = response.releases.slice(0, limit)\n \n releases.forEach((release: any, index: number) => {\n const current = release.is_current ? chalk.yellow(' [CURRENT]') : ''\n const date = new Date(release.created_at).toLocaleDateString()\n const reviewedTag = release.reviewed_only ? chalk.blue(' [REVIEWED ONLY]') : ''\n \n console.log(` ${index + 1}. ${release.version}${current}${reviewedTag}`)\n if (release.name && release.name !== release.version) {\n console.log(chalk.gray(` ${release.name}`))\n }\n if (release.description) {\n console.log(chalk.gray(` ${release.description}`))\n }\n console.log(chalk.gray(` Created: ${date}`))\n if (release.created_by_user?.email) {\n console.log(chalk.gray(` By: ${release.created_by_user.email}`))\n }\n console.log() // empty line\n })\n \n if (response.releases.length > limit) {\n console.log(chalk.gray(`... and ${response.releases.length - limit} more releases`))\n console.log(chalk.gray(`Use --limit ${response.releases.length} to see all releases`))\n }\n \n } catch (error) {\n spinner.fail('Failed to fetch releases')\n throw error\n }\n}\n\nasync function getProject(config: Config, options: any) {\n const spinner = ora('Fetching project information...').start()\n \n try {\n const client = new LezuApiClient(config)\n \n let projectData, statsData\n \n if (options.stats) {\n // Fetch both project info and detailed stats\n const [projectResponse, statsResponse] = await Promise.all([\n client.getProject(),\n fetch(`${config.apiUrl}/v1/projects/${config.projectId}/stats`, {\n headers: {\n 'Authorization': `Bearer ${config.apiKey}`,\n },\n }).then(r => r.json())\n ])\n projectData = projectResponse.project\n statsData = statsResponse.stats\n } else {\n const response = await client.getProject()\n projectData = response.project\n }\n \n spinner.succeed('Project information fetched successfully!')\n \n if (options.json) {\n console.log(JSON.stringify({ project: projectData, stats: statsData }, null, 2))\n return\n }\n \n console.log(chalk.green('\\n📋 Project Information:'))\n console.log(` Name: ${projectData.name}`)\n console.log(` Key: ${projectData.key}`)\n console.log(` ID: ${projectData.id}`)\n if (projectData.description) {\n console.log(` Description: ${projectData.description}`)\n }\n console.log(` Source Language: ${projectData.source_language}`)\n console.log(` Created: ${new Date(projectData.created_at).toLocaleDateString()}`)\n \n // Basic stats (always available)\n if (projectData.stats) {\n console.log(chalk.green('\\n📊 Basic Statistics:'))\n console.log(` Translation Keys: ${projectData.stats.keys}`)\n console.log(` Languages: ${projectData.stats.languages}`)\n console.log(` Translations: ${projectData.stats.translations}`)\n console.log(` Completeness: ${projectData.stats.completeness}%`)\n }\n \n // Detailed stats (when --stats is used)\n if (statsData) {\n console.log(chalk.green('\\n📈 Detailed Statistics:'))\n console.log(` Total Keys: ${statsData.overview.totalKeys}`)\n console.log(` Total Languages: ${statsData.overview.totalLanguages}`)\n console.log(` Total Releases: ${statsData.overview.totalReleases}`)\n console.log(` Keys Added Last Month: ${statsData.overview.keysAddedLastMonth}`)\n \n if (statsData.languages && statsData.languages.length > 0) {\n console.log(chalk.green('\\n🌍 Language Progress:'))\n statsData.languages.forEach((lang: any) => {\n const percentage = lang.percentage\n const bar = '█'.repeat(Math.floor(percentage / 5)) + '░'.repeat(20 - Math.floor(percentage / 5))\n console.log(` ${lang.language_code}: [${bar}] ${percentage}%`)\n console.log(chalk.gray(` ${lang.translated}/${lang.total} translated, ${lang.reviewed} reviewed, ${lang.missing} missing`))\n })\n }\n \n if (statsData.recentReleases && statsData.recentReleases.length > 0) {\n console.log(chalk.green('\\n🚀 Recent Releases:'))\n statsData.recentReleases.forEach((release: any) => {\n const date = new Date(release.created_at).toLocaleDateString()\n console.log(` • ${release.version} (${date})`)\n })\n }\n }\n \n // Show environments\n if (projectData.environments && projectData.environments.length > 0) {\n console.log(chalk.green('\\n🏗️ Environments:'))\n projectData.environments.forEach((env: any) => {\n const current = env.current_release_id ? ` (current: ${env.current_release_id.substring(0, 8)}...)` : ''\n console.log(` • ${env.name}${current}`)\n })\n }\n \n } catch (error) {\n spinner.fail('Failed to fetch project information')\n throw error\n }\n}"],"mappings":";;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,SAAS;AAKT,SAAS,mBAAmB;AACjC,QAAM,UAAU,IAAI,QAAQ,KAAK,EAC9B,YAAY,oCAAoC;AAGnD,UACG,QAAQ,WAAW,EACnB,MAAM,OAAO,EACb,YAAY,oCAAoC,EAChD,OAAO,sBAAsB,YAAY,EACzC,OAAO,uBAAuB,SAAS,EACvC,OAAO,mBAAmB,WAAW,sBAAsB,EAC3D,OAAO,sBAAsB,4BAA4B,EACzD,OAAO,UAAU,gBAAgB,EACjC,OAAO,OAAO,YAAY;AACzB,QAAI;AACF,YAAM,SAAS,WAAW,OAAO;AACjC,YAAM,SAAS,eAAe,MAAM;AACpC,UAAI,OAAO,SAAS,GAAG;AACrB,gBAAQ,MAAM,MAAM,IAAI,uBAAuB,CAAC;AAChD,eAAO,QAAQ,WAAS,QAAQ,MAAM,MAAM,IAAI,YAAO,KAAK,EAAE,CAAC,CAAC;AAChE,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAEA,YAAM,aAAa,QAAQ,OAAO;AAAA,IACpC,SAAS,OAAO;AACd,cAAQ,MAAM,MAAM,IAAI,iBAAY,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AAC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AAK,aAAa,MAAM,GAAG,KAAK,UAAU,GAAG;AAC9D,kBAAQ,IAAI,MAAM,KAAK,OAAO,KAAK,UAAU,IAAI,KAAK,KAAK,gBAAgB,KAAK,QAAQ,cAAc,KAAK,OAAO,UAAU,CAAC;AAAA,QAC/H,CAAC;AAAA,MACH;AAEA,UAAI,UAAU,kBAAkB,UAAU,eAAe,SAAS,GAAG;AACnE,gBAAQ,IAAI,MAAM,MAAM,8BAAuB,CAAC;AAChD,kBAAU,eAAe,QAAQ,CAAC,YAAiB;AACjD,gBAAM,OAAO,IAAI,KAAK,QAAQ,UAAU,EAAE,mBAAmB;AAC7D,kBAAQ,IAAI,YAAO,QAAQ,OAAO,KAAK,IAAI,GAAG;AAAA,QAChD,CAAC;AAAA,MACH;AAAA,IACF;AAGA,QAAI,YAAY,gBAAgB,YAAY,aAAa,SAAS,GAAG;AACnE,cAAQ,IAAI,MAAM,MAAM,iCAAqB,CAAC;AAC9C,kBAAY,aAAa,QAAQ,CAAC,QAAa;AAC7C,cAAM,UAAU,IAAI,qBAAqB,cAAc,IAAI,mBAAmB,UAAU,GAAG,CAAC,CAAC,SAAS;AACtG,gBAAQ,IAAI,YAAO,IAAI,IAAI,GAAG,OAAO,EAAE;AAAA,MACzC,CAAC;AAAA,IACH;AAAA,EAEF,SAAS,OAAO;AACd,YAAQ,KAAK,qCAAqC;AAClD,UAAM;AAAA,EACR;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/load.ts","../src/writer.ts"],"sourcesContent":["import { Command } from 'commander'\nimport chalk from 'chalk'\nimport ora from 'ora'\nimport { loadConfig, validateConfig } from '../config.js'\nimport { LezuApiClient } from '../api.js'\nimport { TranslationWriter } from '../writer.js'\nimport type { Config } from '../types.js'\n\nexport function createLoadCommand() {\n const command = new Command('load')\n .description('Download translation files from Lezu')\n .option('-p, --project <id>', 'Project ID')\n .option('-k, --api-key <key>', 'API key')\n .option('-d, --dest <path>', 'Destination folder', './src/i18n')\n .option('-f, --format <format>', 'Output format (json, js, ts, yaml, po)', 'json')\n .option('-l, --languages <languages>', 'Comma-separated list of languages to download')\n .option('-r, --release <id>', 'Specific release ID')\n .option('-e, --environment <env>', 'Environment', 'production')\n .option('--api-url <url>', 'API URL', 'https://api.lezu.app')\n .option('--flatten', 'Flatten nested keys')\n .option('--namespace', 'Use namespace folder structure')\n .option('--include-empty', 'Include empty translations')\n .option('-w, --watch', 'Watch for changes')\n .option('--watch-interval <ms>', 'Watch interval in milliseconds', '5000')\n .action(async (options) => {\n try {\n // Parse languages from comma-separated string\n if (options.languages) {\n options.languages = options.languages.split(',').map((l: string) => l.trim())\n }\n\n // Convert watch interval to number\n if (options.watchInterval) {\n options.watchInterval = parseInt(options.watchInterval, 10)\n }\n\n // Load configuration\n const config = loadConfig(options)\n\n // Validate configuration\n const errors = validateConfig(config)\n if (errors.length > 0) {\n console.error(chalk.red('Configuration errors:'))\n errors.forEach(error => console.error(chalk.red(` • ${error}`)))\n process.exit(1)\n }\n\n // Run the sync\n await syncTranslations(config)\n\n // Watch mode\n if (config.watch) {\n console.log(chalk.cyan(`\\n👁 Watching for changes every ${config.watchInterval}ms...`))\n console.log(chalk.gray('Press Ctrl+C to stop'))\n \n setInterval(async () => {\n console.log(chalk.gray('\\n🔄 Checking for updates...'))\n await syncTranslations(config)\n }, config.watchInterval)\n }\n } catch (error) {\n console.error(chalk.red('\\n❌ Error:'), error instanceof Error ? error.message : error)\n process.exit(1)\n }\n })\n\n return command\n}\n\nexport async function syncTranslations(config: Config) {\n const spinner = ora('Connecting to Lezu API...').start()\n\n try {\n // Create API client\n const client = new LezuApiClient(config)\n\n // If no release specified and not using latest, try to get latest release\n if (!config.release && config.environment) {\n spinner.text = 'Fetching latest release...'\n const latestRelease = await client.getLatestRelease()\n if (latestRelease) {\n config.release = latestRelease\n spinner.succeed(`Using latest release: ${latestRelease}`)\n spinner.start('Fetching translations...')\n } else {\n spinner.info('No releases found, fetching current translations...')\n spinner.start()\n }\n }\n\n // Fetch translations\n spinner.text = 'Fetching translations...'\n const response = await client.getTranslations()\n\n if (!response.translations || Object.keys(response.translations).length === 0) {\n spinner.fail('No translations found')\n return\n }\n\n spinner.succeed(`Fetched translations for ${Object.keys(response.translations).length} languages`)\n\n // Write translations\n const writer = new TranslationWriter(config)\n writer.write(response.translations)\n\n console.log(chalk.green('\\n✨ Translations synced successfully!'))\n\n // Show summary\n console.log(chalk.gray('\\nSummary:'))\n console.log(chalk.gray(` • Project: ${config.projectId}`))\n console.log(chalk.gray(` • Languages: ${Object.keys(response.translations).join(', ')}`))\n console.log(chalk.gray(` • Destination: ${config.dest}`))\n console.log(chalk.gray(` • Format: ${config.format}`))\n \n if (response.meta?.version) {\n console.log(chalk.gray(` • Version: ${response.meta.version}`))\n }\n\n } catch (error) {\n spinner.fail('Failed to sync translations')\n throw error\n }\n}","import { writeFileSync, mkdirSync } from 'fs'\nimport { resolve, dirname, join } from 'path'\nimport type { Config, TranslationBundle } from './types.js'\n\nexport class TranslationWriter {\n private config: Config\n\n constructor(config: Config) {\n this.config = config\n }\n\n write(translations: Record<string, any>): void {\n // Ensure destination directory exists\n mkdirSync(this.config.dest, { recursive: true })\n\n // Write each language to its own file\n for (const [language, content] of Object.entries(translations)) {\n const processedContent = this.processContent(content)\n const filePath = this.getFilePath(language)\n \n mkdirSync(dirname(filePath), { recursive: true })\n \n const fileContent = this.formatContent(processedContent, language)\n writeFileSync(filePath, fileContent, 'utf-8')\n \n console.log(`✅ Written ${language} translations to ${filePath}`)\n }\n }\n\n private processContent(content: any): any {\n if (this.config.flatten) {\n return this.flattenObject(content)\n }\n \n if (!this.config.includeEmpty) {\n return this.removeEmptyValues(content)\n }\n \n return content\n }\n\n private flattenObject(obj: any, prefix = ''): Record<string, string> {\n const result: Record<string, string> = {}\n \n for (const [key, value] of Object.entries(obj)) {\n const newKey = prefix ? `${prefix}.${key}` : key\n \n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n Object.assign(result, this.flattenObject(value, newKey))\n } else {\n result[newKey] = value as string\n }\n }\n \n return result\n }\n\n private removeEmptyValues(obj: any): any {\n if (typeof obj !== 'object' || obj === null) {\n return obj\n }\n \n const result: any = {}\n \n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'object' && value !== null) {\n const cleaned = this.removeEmptyValues(value)\n if (Object.keys(cleaned).length > 0) {\n result[key] = cleaned\n }\n } else if (value !== '' && value !== null && value !== undefined) {\n result[key] = value\n }\n }\n \n return result\n }\n\n private getFilePath(language: string): string {\n const extension = this.getFileExtension()\n \n if (this.config.namespace) {\n // Use namespace structure: dest/locales/en.json\n return join(this.config.dest, 'locales', `${language}.${extension}`)\n } else {\n // Use flat structure: dest/en.json\n return join(this.config.dest, `${language}.${extension}`)\n }\n }\n\n private getFileExtension(): string {\n switch (this.config.format) {\n case 'json':\n return 'json'\n case 'js':\n return 'js'\n case 'ts':\n return 'ts'\n case 'yaml':\n return 'yaml'\n case 'po':\n return 'po'\n default:\n return 'json'\n }\n }\n\n private formatContent(content: any, language: string): string {\n switch (this.config.format) {\n case 'json':\n return JSON.stringify(content, null, 2)\n \n case 'js':\n return `export default ${JSON.stringify(content, null, 2)}`\n \n case 'ts':\n return `const translations = ${JSON.stringify(content, null, 2)} as const\\n\\nexport default translations`\n \n case 'yaml':\n return this.toYaml(content)\n \n case 'po':\n return this.toPo(content, language)\n \n default:\n return JSON.stringify(content, null, 2)\n }\n }\n\n private toYaml(obj: any, indent = 0): string {\n let result = ''\n const spaces = ' '.repeat(indent)\n \n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'object' && value !== null) {\n result += `${spaces}${key}:\\n${this.toYaml(value, indent + 2)}`\n } else {\n const escapedValue = String(value).includes(':') || String(value).includes('#') \n ? `\"${String(value).replace(/\"/g, '\\\\\"')}\"` \n : value\n result += `${spaces}${key}: ${escapedValue}\\n`\n }\n }\n \n return result\n }\n\n private toPo(obj: any, language: string): string {\n const now = new Date().toISOString()\n let result = `# Translation file for ${language}\n# Generated by Lezu CLI on ${now}\nmsgid \"\"\nmsgstr \"\"\n\"Language: ${language}\\\\n\"\n\"MIME-Version: 1.0\\\\n\"\n\"Content-Type: text/plain; charset=UTF-8\\\\n\"\n\"Content-Transfer-Encoding: 8bit\\\\n\"\n\"Generated-By: Lezu CLI\\\\n\"\n\n`\n\n const flatEntries = this.flattenForPo(obj)\n \n for (const [key, value] of Object.entries(flatEntries)) {\n const escapedKey = this.escapePoString(key)\n const escapedValue = this.escapePoString(String(value))\n \n result += `msgid \"${escapedKey}\"\\n`\n result += `msgstr \"${escapedValue}\"\\n\\n`\n }\n \n return result\n }\n\n private flattenForPo(obj: any, prefix = ''): Record<string, string> {\n const result: Record<string, string> = {}\n \n for (const [key, value] of Object.entries(obj)) {\n const fullKey = prefix ? `${prefix}.${key}` : key\n \n if (typeof value === 'object' && value !== null && !Array.isArray(value)) {\n Object.assign(result, this.flattenForPo(value, fullKey))\n } else {\n result[fullKey] = String(value)\n }\n }\n \n return result\n }\n\n private escapePoString(str: string): string {\n return str\n .replace(/\\\\/g, '\\\\\\\\')\n .replace(/\"/g, '\\\\\"')\n .replace(/\\n/g, '\\\\n')\n .replace(/\\r/g, '\\\\r')\n .replace(/\\t/g, '\\\\t')\n }\n}"],"mappings":";;;;;;;;;AAAA,SAAS,eAAe;AACxB,OAAO,WAAW;AAClB,OAAO,SAAS;;;ACFhB,SAAS,eAAe,iBAAiB;AACzC,SAAkB,SAAS,YAAY;AAGhC,IAAM,oBAAN,MAAwB;AAAA,EACrB;AAAA,EAER,YAAY,QAAgB;AAC1B,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,MAAM,cAAyC;AAE7C,cAAU,KAAK,OAAO,MAAM,EAAE,WAAW,KAAK,CAAC;AAG/C,eAAW,CAAC,UAAU,OAAO,KAAK,OAAO,QAAQ,YAAY,GAAG;AAC9D,YAAM,mBAAmB,KAAK,eAAe,OAAO;AACpD,YAAM,WAAW,KAAK,YAAY,QAAQ;AAE1C,gBAAU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