@agentscope-ai/i18n 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/lib/cli.js +21 -4
  2. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -376,11 +376,22 @@ program
376
376
  console.log('');
377
377
  }
378
378
 
379
+ const appName = options.app || configFileSettings.appName;
380
+ if (!appName) {
381
+ console.error(
382
+ '❌ 缺少 Medusa 应用名称 appName:请通过 --app 传入,或在 i18n.config.js 的 medusa.appName 中配置',
383
+ );
384
+ process.exit(1);
385
+ }
386
+
387
+ // tag 选填:命令行优先,其次配置文件,不设默认值
388
+ const tag = options.tag ?? configFileSettings.tag;
389
+
379
390
  // 合并配置文件和命令行参数(命令行参数优先)
380
391
  const config = {
381
392
  medusa: {
382
- appName: options.app || configFileSettings.appName || 'broadscope-bailian-frontend',
383
- tag: options.tag || configFileSettings.tag || 'bailian-fe',
393
+ appName,
394
+ tag,
384
395
  },
385
396
  type: options.type || configFileSettings.type || 'json',
386
397
  cwd: process.cwd(),
@@ -391,10 +402,16 @@ program
391
402
  // 显示配置信息
392
403
  console.log('📝 配置信息:');
393
404
  console.log(
394
- ` 应用名称: ${config.medusa.appName} ${options.app ? '(命令行)' : configFileSettings.appName ? '(配置文件)' : '(默认)'}`,
405
+ ` 应用名称: ${config.medusa.appName} ${options.app ? '(命令行)' : '(配置文件)'}`,
395
406
  );
407
+ const tagSource =
408
+ options.tag != null && options.tag !== ''
409
+ ? '(命令行)'
410
+ : configFileSettings.tag != null && configFileSettings.tag !== ''
411
+ ? '(配置文件)'
412
+ : '';
396
413
  console.log(
397
- ` 标签名称: ${config.medusa.tag} ${options.tag ? '(命令行)' : configFileSettings.tag ? '(配置文件)' : '(默认)'}`,
414
+ ` 标签名称: ${config.medusa.tag ?? '(未设置)'}${tagSource ? ` ${tagSource}` : ''}`,
398
415
  );
399
416
  console.log(
400
417
  ` 包类型: ${config.type} ${options.type ? '(命令行)' : configFileSettings.type ? '(配置文件)' : '(默认)'}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentscope-ai/i18n",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "A tool for translating Chinese content in frontend code repositories",
5
5
  "keywords": [
6
6
  "i18n",