@lazycatcloud/lzc-cli 1.3.13 → 1.3.14
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/changelog.md +12 -0
- package/lib/app/lpk_build.js +14 -10
- package/lib/app/lpk_create.js +3 -2
- package/lib/app/lpk_create_generator.js +6 -3
- package/lib/app/lpk_devshell.js +2 -2
- package/lib/app/lpk_installer.js +7 -6
- package/lib/appstore/index.js +56 -16
- package/lib/appstore/publish.js +16 -13
- package/lib/box/index.js +2 -2
- package/lib/config/index.js +3 -2
- package/lib/debug_bridge.js +17 -15
- package/lib/i18n/locales/en/translation.json +250 -249
- package/lib/i18n/locales/zh/translation.json +42 -41
- package/lib/shellapi.js +5 -5
- package/lib/utils.js +14 -11
- package/package.json +3 -3
package/changelog.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.3.14](https://gitee.com/linakesi/lzc-cli/compare/v1.3.13...v1.3.14) (2025-12-17)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* dealing with the i18n difference escape problem ([2b98cdf](https://gitee.com/linakesi/lzc-cli/commits/2b98cdf0573a1537bee409079d6160da1b7cd80b))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* cmd publish add `changelog-files` option ([17d95c6](https://gitee.com/linakesi/lzc-cli/commits/17d95c6fa761f25af234946dedd3d6a0503ba962))
|
|
14
|
+
|
|
3
15
|
## [1.3.13](https://gitee.com/linakesi/lzc-cli/compare/v1.3.12...v1.3.13) (2025-12-10)
|
|
4
16
|
|
|
5
17
|
|
package/lib/app/lpk_build.js
CHANGED
|
@@ -24,7 +24,7 @@ import { t } from '../i18n/index.js';
|
|
|
24
24
|
async function archiveFolderTo(appDir, out, format = 'zip') {
|
|
25
25
|
return new Promise(async (resolve, reject) => {
|
|
26
26
|
if (!fs.existsSync(appDir)) {
|
|
27
|
-
reject(new Error(t('lzc_cli.lib.app.lpk_build.archive_folder_to_exist_fail', `{{appDir}} 文件夹不存在`, { appDir })));
|
|
27
|
+
reject(new Error(t('lzc_cli.lib.app.lpk_build.archive_folder_to_exist_fail', `{{appDir}} 文件夹不存在`, { appDir, interpolation: { escapeValue: false } })));
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -63,15 +63,15 @@ async function fetchIconTo(options, cwd, destDir) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
if (!isFileExist(iconPath)) {
|
|
66
|
-
logger.warn(t('lzc_cli.lib.app.lpk_build.fetch_icon_to_icon_file_not_exist_fail', `图标icon {{iconPath}} 不存在`, { iconPath }));
|
|
66
|
+
logger.warn(t('lzc_cli.lib.app.lpk_build.fetch_icon_to_icon_file_not_exist_fail', `图标icon {{ iconPath }} 不存在`, { iconPath, interpolation: { escapeValue: false } }));
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
if (!isPngWithFile(iconPath)) {
|
|
71
|
-
logger.warn(t('lzc_cli.lib.app.lpk_build.fetch_icon_to_icon_not_is_png_fail', `图标icon {{iconPath}} 验证失败(不是一个png格式)`, { iconPath }));
|
|
71
|
+
logger.warn(t('lzc_cli.lib.app.lpk_build.fetch_icon_to_icon_not_is_png_fail', `图标icon {{ iconPath }} 验证失败(不是一个png格式)`, { iconPath, interpolation: { escapeValue: false } }));
|
|
72
72
|
return;
|
|
73
73
|
} else {
|
|
74
|
-
logger.debug(t('lzc_cli.lib.app.lpk_build.fetch_icon_to_icon_is_png', `图标icon {{iconPath}} 验证成功(png格式)`, { iconPath }));
|
|
74
|
+
logger.debug(t('lzc_cli.lib.app.lpk_build.fetch_icon_to_icon_is_png', `图标icon {{ iconPath }} 验证成功(png格式)`, { iconPath, interpolation: { escapeValue: false } }));
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
fs.copyFileSync(iconPath, path.join(destDir, 'icon.png'));
|
|
@@ -97,7 +97,7 @@ async function fetchLzcDeployParamTo(options, cwd, destDir) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
if (!isFileExist(deployParamsPath)) {
|
|
100
|
-
logger.warn(t('lzc_cli.lib.app.lpk_build.fetch_lzc_deploy_param_to_not_exist', `deploy_params {{deployParamsPath}} 不存在`, { deployParamsPath }));
|
|
100
|
+
logger.warn(t('lzc_cli.lib.app.lpk_build.fetch_lzc_deploy_param_to_not_exist', `deploy_params {{ deployParamsPath }} 不存在`, { deployParamsPath, interpolation: { escapeValue: false } }));
|
|
101
101
|
return;
|
|
102
102
|
}
|
|
103
103
|
|
|
@@ -210,7 +210,7 @@ export class LpkBuild {
|
|
|
210
210
|
this.excpManifest = lpkM.excpManifest;
|
|
211
211
|
|
|
212
212
|
if (!isValidPackageName(this.manifest['package'])) {
|
|
213
|
-
throw t('lzc_cli.lib.app.lpk_build.get_manifest_package_name_fail', `{{package}} 含有非法字符,请使用正确的包名格式(java的包名格式),如:cloud.lazycat.apps.video`, {
|
|
213
|
+
throw t('lzc_cli.lib.app.lpk_build.get_manifest_package_name_fail', `{{ package }} 含有非法字符,请使用正确的包名格式(java的包名格式),如:cloud.lazycat.apps.video`, {
|
|
214
214
|
package: this.manifest['package'],
|
|
215
215
|
});
|
|
216
216
|
}
|
|
@@ -247,7 +247,7 @@ export class LpkBuild {
|
|
|
247
247
|
let packName = this.options['lpkPath'];
|
|
248
248
|
const pkgout = path.resolve(this.pwd, this.options['pkgout']);
|
|
249
249
|
if (!packName && !isDirExist(pkgout)) {
|
|
250
|
-
throw t('lzc_cli.lib.app.lpk_build.exec_pkgout_not_exist', `{{pkgout}} 不存在`, { pkgout });
|
|
250
|
+
throw t('lzc_cli.lib.app.lpk_build.exec_pkgout_not_exist', `{{ pkgout }} 不存在`, { pkgout, interpolation: { escapeValue: false } });
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
const tempDir = fs.mkdtempSync('.lzc-cli-build');
|
|
@@ -291,15 +291,16 @@ export class LpkBuild {
|
|
|
291
291
|
} else if (isFileExist(browserExtension)) {
|
|
292
292
|
fs.copyFileSync(browserExtension, path.join(tempDir, 'extension.zip'));
|
|
293
293
|
} else {
|
|
294
|
-
throw t('lzc_cli.lib.app.lpk_build.exec_browser_extension_not_exist', `{{browserExtension}} 不存在`, { browserExtension });
|
|
294
|
+
throw t('lzc_cli.lib.app.lpk_build.exec_browser_extension_not_exist', `{{ browserExtension }} 不存在`, { browserExtension, interpolation: { escapeValue: false } });
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
if (aiPodService) {
|
|
299
299
|
aiPodService = path.resolve(this.pwd, aiPodService);
|
|
300
300
|
if (!isDirExist(aiPodService)) {
|
|
301
|
-
throw t('lzc_cli.lib.app.lpk_build.exec_ai_pos_service_not_exist', `{{aiPodService}} 不存在`, {
|
|
301
|
+
throw t('lzc_cli.lib.app.lpk_build.exec_ai_pos_service_not_exist', `{{ aiPodService }} 不存在`, {
|
|
302
302
|
aiPodService,
|
|
303
|
+
interpolation: { escapeValue: false }
|
|
303
304
|
});
|
|
304
305
|
}
|
|
305
306
|
fs.cpSync(aiPodService, path.join(tempDir, 'ai-pod-service'), {
|
|
@@ -349,7 +350,10 @@ export class LpkBuild {
|
|
|
349
350
|
}
|
|
350
351
|
|
|
351
352
|
const lpkPath = await archiveFolderTo(tempDir, packName);
|
|
352
|
-
logger.info(t('lzc_cli.lib.app.lpk_build.exec_output_lpk_path',
|
|
353
|
+
logger.info(`${t('lzc_cli.lib.app.lpk_build.exec_output_lpk_path', '输出lpk包 {{ path }}', {
|
|
354
|
+
path: lpkPath.path,
|
|
355
|
+
interpolation: { escapeValue: false } // https://www.i18next.com/translation-function/interpolation#unescape
|
|
356
|
+
})}`);
|
|
353
357
|
|
|
354
358
|
return lpkPath.path;
|
|
355
359
|
} finally {
|
package/lib/app/lpk_create.js
CHANGED
|
@@ -127,13 +127,14 @@ class LpkCreate {
|
|
|
127
127
|
const template = new TemplateInit(this.cwd, this.name, type);
|
|
128
128
|
await template.init();
|
|
129
129
|
|
|
130
|
-
console.log(chalk.green(t('lzc_cli.lib.app.lpk_create.exec_init_project_tips', `✨ 初始化项目 {{name}}`, { name: this.name })));
|
|
130
|
+
console.log(chalk.green(t('lzc_cli.lib.app.lpk_create.exec_init_project_tips', `✨ 初始化项目 {{ name }}`, { name: this.name, interpolation: { escapeValue: false } })));
|
|
131
131
|
const { isExists, renamedFileName } = ensureDirectoryExists(this.appDir, true);
|
|
132
132
|
if (isExists && renamedFileName) {
|
|
133
133
|
console.warn(
|
|
134
134
|
chalk.yellow(
|
|
135
|
-
t('lzc_cli.lib.app.lpk_create.exec_init_project_name_exist_tips', `! 检测到相同目录,已自动将旧目录重命名为 {{renamedFileName}}`, {
|
|
135
|
+
t('lzc_cli.lib.app.lpk_create.exec_init_project_name_exist_tips', `! 检测到相同目录,已自动将旧目录重命名为 {{ renamedFileName }}`, {
|
|
136
136
|
renamedFileName,
|
|
137
|
+
interpolation: { escapeValue: false }
|
|
137
138
|
}),
|
|
138
139
|
),
|
|
139
140
|
);
|
|
@@ -46,7 +46,7 @@ function writeFileTree(target, files) {
|
|
|
46
46
|
if (!fs.existsSync(path.dirname(filePath))) {
|
|
47
47
|
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
48
48
|
}
|
|
49
|
-
logger.debug(t('lzc_cli.lib.app.lpk_create_generator.write_file_tree_create_file', `创建文件 {{filePath}}`, { filePath }));
|
|
49
|
+
logger.debug(t('lzc_cli.lib.app.lpk_create_generator.write_file_tree_create_file', `创建文件 {{ filePath }}`, { filePath, interpolation: { escapeValue: false } }));
|
|
50
50
|
fs.writeFileSync(filePath, files[p].content, { mode: files[p].mode });
|
|
51
51
|
});
|
|
52
52
|
}
|
|
@@ -64,10 +64,13 @@ function appCreateSuccessTip(name) {
|
|
|
64
64
|
`
|
|
65
65
|
✨ 懒猫微服应用已创建成功 !
|
|
66
66
|
✨ 进行下面步骤后即可进入容器开发
|
|
67
|
-
cd {{name}}
|
|
67
|
+
cd {{ name }}
|
|
68
68
|
lzc-cli project devshell
|
|
69
69
|
`,
|
|
70
|
-
{
|
|
70
|
+
{
|
|
71
|
+
name,
|
|
72
|
+
interpolation: { escapeValue: false }
|
|
73
|
+
},
|
|
71
74
|
).trim(),
|
|
72
75
|
),
|
|
73
76
|
);
|
package/lib/app/lpk_devshell.js
CHANGED
|
@@ -260,7 +260,7 @@ export class AppDevShell {
|
|
|
260
260
|
await createTemplateFileCommon(dockerfilePath, path.join(tempDir, 'Dockerfile'), { dependencies: depsStr });
|
|
261
261
|
|
|
262
262
|
const label = `${await md5String(depsStr)}:latest`;
|
|
263
|
-
logger.debug(t('lzc_cli.lib.app.lpk_devshell.devshell_build_image_for_box_tips', `开始在盒子中构建 {{label}} 镜像 from {{tempDir}}`, { label, tempDir }));
|
|
263
|
+
logger.debug(t('lzc_cli.lib.app.lpk_devshell.devshell_build_image_for_box_tips', `开始在盒子中构建 {{ label }} 镜像 from {{ tempDir }}`, { label, tempDir, interpolation: { escapeValue: false } }));
|
|
264
264
|
|
|
265
265
|
const contextTar = await collectContextFromDockerFile(tempDir, path.resolve(tempDir, 'Dockerfile'));
|
|
266
266
|
const bridge = new DebugBridge();
|
|
@@ -287,7 +287,7 @@ export class AppDevShell {
|
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
const label = `${manifest['package']}-devshell:${manifest['version']}`;
|
|
290
|
-
logger.debug(t('lzc_cli.lib.app.lpk_devshell.devshell_build_label_image_box_tips', `开始在盒子中构建 {{label}} 镜像`, { label }));
|
|
290
|
+
logger.debug(t('lzc_cli.lib.app.lpk_devshell.devshell_build_label_image_box_tips', `开始在盒子中构建 {{ label }} 镜像`, { label, interpolation: { escapeValue: false } }));
|
|
291
291
|
|
|
292
292
|
const contextTar = await collectContextFromDockerFile(process.cwd(), path.resolve(process.cwd(), config['build'], 'Dockerfile'));
|
|
293
293
|
|
package/lib/app/lpk_installer.js
CHANGED
|
@@ -26,9 +26,9 @@ function findOnceLpkByDir(dir = process.cwd()) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export class LpkInstaller {
|
|
29
|
-
constructor() {}
|
|
29
|
+
constructor() { }
|
|
30
30
|
|
|
31
|
-
async init() {}
|
|
31
|
+
async init() { }
|
|
32
32
|
|
|
33
33
|
// deploy 构建和安装
|
|
34
34
|
async deploy(builder) {
|
|
@@ -61,7 +61,7 @@ export class LpkInstaller {
|
|
|
61
61
|
async installFromDirectory(dir) {
|
|
62
62
|
const lpk = findOnceLpkByDir(dir);
|
|
63
63
|
if (lpk) {
|
|
64
|
-
logger.info(t('lzc_cli.lib.app.lpk_installer.install_from_dir_scan_tips', `正在安装自动扫描出来的lpk包({{lpk}})`, { lpk }));
|
|
64
|
+
logger.info(t('lzc_cli.lib.app.lpk_installer.install_from_dir_scan_tips', `正在安装自动扫描出来的lpk包({{ lpk }})`, { lpk, interpolation: { escapeValue: false } }));
|
|
65
65
|
}
|
|
66
66
|
return this.installFromFile(lpk);
|
|
67
67
|
}
|
|
@@ -88,7 +88,7 @@ export class LpkInstaller {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
if (!fs.existsSync(pkgPath)) {
|
|
91
|
-
throw t('lzc_cli.lib.app.lpk_installer.install_from_file_lpk_path_not_exists_fail', `{{pkgPath}} 不存在`, { pkgPath });
|
|
91
|
+
throw t('lzc_cli.lib.app.lpk_installer.install_from_file_lpk_path_not_exists_fail', `{{ pkgPath }} 不存在`, { pkgPath, interpolation: { escapeValue: false } });
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
const tempDir = fs.mkdtempSync('.lzc-cli-install');
|
|
@@ -123,15 +123,16 @@ export class LpkInstaller {
|
|
|
123
123
|
logger.info(t('lzc_cli.lib.app.lpk_installer.install_from_file_success_tips', `安装成功!`));
|
|
124
124
|
if (manifest) {
|
|
125
125
|
logger.info(
|
|
126
|
-
t('lzc_cli.lib.app.lpk_installer.install_from_file_done_tips', `👉 请在浏览器中访问 https://{{subdomain}}.{{boxname}}.heiyu.space`, {
|
|
126
|
+
t('lzc_cli.lib.app.lpk_installer.install_from_file_done_tips', `👉 请在浏览器中访问 https://{{ subdomain }}.{{ boxname }}.heiyu.space`, {
|
|
127
127
|
subdomain: manifest['application']['subdomain'],
|
|
128
128
|
boxname: shellapi.boxname,
|
|
129
|
+
interpolation: { escapeValue: false }
|
|
129
130
|
}),
|
|
130
131
|
);
|
|
131
132
|
logger.info(t('lzc_cli.lib.app.lpk_installer.install_from_file_login_tips', `👉 并使用微服的用户名和密码登录`));
|
|
132
133
|
}
|
|
133
134
|
} catch (error) {
|
|
134
|
-
logger.error(t('lzc_cli.lib.app.lpk_installer.install_from_file_fail_tips', `安装失败: {{error}}`, { error }));
|
|
135
|
+
logger.error(t('lzc_cli.lib.app.lpk_installer.install_from_file_fail_tips', `安装失败: {{ error }}`, { error, interpolation: { escapeValue: false } }));
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
}
|
package/lib/appstore/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { Publish } from './publish.js';
|
|
2
|
-
import logger from 'loglevel';
|
|
3
|
-
import { PrePublish } from './prePublish.js';
|
|
4
|
-
import { reLogin, request } from './login.js';
|
|
5
1
|
import fs from 'node:fs';
|
|
2
|
+
import logger from 'loglevel';
|
|
3
|
+
|
|
6
4
|
import { sleep } from '../utils.js';
|
|
7
5
|
import { t } from '../i18n/index.js';
|
|
6
|
+
|
|
7
|
+
import { Publish } from './publish.js';
|
|
8
|
+
import { PrePublish } from './prePublish.js';
|
|
9
|
+
import { reLogin, request } from './login.js';
|
|
8
10
|
import { appStoreServerUrl } from './env.js';
|
|
9
11
|
|
|
10
12
|
export function appstoreCommand(program) {
|
|
@@ -19,18 +21,18 @@ export function appstoreCommand(program) {
|
|
|
19
21
|
{
|
|
20
22
|
command: 'pre-publish <pkgPath>',
|
|
21
23
|
desc: t('lzc_cli.lib.appstore.index.pre_publish_cmd_desc', '发布到内测'),
|
|
22
|
-
builder: (
|
|
23
|
-
|
|
24
|
+
builder: (yargs) => {
|
|
25
|
+
yargs.option('c', {
|
|
24
26
|
alias: 'changelog',
|
|
25
27
|
describe: t('lzc_cli.lib.appstore.index.pre_publish_cmd_changelog_desc', '更改日志'),
|
|
26
28
|
type: 'string',
|
|
27
29
|
});
|
|
28
|
-
|
|
30
|
+
yargs.option('F', {
|
|
29
31
|
alias: 'file',
|
|
30
32
|
describe: t('lzc_cli.lib.appstore.index.pre_publish_cmd_changelog_file_desc', '更改日志文件'),
|
|
31
33
|
type: 'string',
|
|
32
34
|
});
|
|
33
|
-
|
|
35
|
+
yargs.option('G', {
|
|
34
36
|
alias: 'gid',
|
|
35
37
|
describe: t('lzc_cli.lib.appstore.index.pre_publish_cmd_gid_desc', '内测组ID'),
|
|
36
38
|
type: 'string',
|
|
@@ -47,30 +49,68 @@ export function appstoreCommand(program) {
|
|
|
47
49
|
{
|
|
48
50
|
command: 'publish <pkgPath>',
|
|
49
51
|
desc: t('lzc_cli.lib.appstore.index.publish_cmd_desc', '发布到商店'),
|
|
50
|
-
builder: (
|
|
51
|
-
|
|
52
|
+
builder: (yargs) => {
|
|
53
|
+
yargs.option('c', {
|
|
52
54
|
alias: 'changelog',
|
|
53
55
|
describe: t('lzc_cli.lib.appstore.index.publish_cmd_changelog_desc', '更新日志'),
|
|
54
56
|
type: 'string',
|
|
55
57
|
});
|
|
56
|
-
|
|
58
|
+
yargs.option('clang', {
|
|
57
59
|
alias: 'changelog-locale',
|
|
58
60
|
describe: t('lzc_cli.lib.appstore.index.publish_cmd_changelog_lang_desc', '更新日志语言标识,默认通过当前 shell 语言环境识别'),
|
|
59
61
|
type: 'string',
|
|
60
62
|
});
|
|
61
|
-
|
|
63
|
+
yargs.option('clangs', {
|
|
64
|
+
alias: 'changelog-files',
|
|
65
|
+
type: 'string',
|
|
66
|
+
array: true,
|
|
67
|
+
describe: t('lzc_cli.lib.appstore.index.publish_cmd_changelog_files_desc', '更新日志本地化语言文件 lang:path 例如 en:changelog.en.md'),
|
|
68
|
+
});
|
|
69
|
+
yargs.option('F', {
|
|
62
70
|
alias: 'file',
|
|
71
|
+
deprecate: 'use --clangs=en:clog_en.txt',
|
|
63
72
|
describe: t('lzc_cli.lib.appstore.index.publish_cmd_changelog_file_desc', '更新日志文件'),
|
|
64
73
|
type: 'string',
|
|
65
74
|
});
|
|
66
75
|
},
|
|
67
|
-
handler: async ({ pkgPath, changelog, changelogLocale, file }) => {
|
|
68
|
-
const
|
|
76
|
+
handler: async ({ pkgPath, changelog, changelogLocale, file, changelogFiles }) => {
|
|
77
|
+
const currentLocale = changelogLocale ?? program.locale();
|
|
69
78
|
const p = new Publish();
|
|
79
|
+
|
|
80
|
+
async function readChangelogFiles(files, changelogs = {}) {
|
|
81
|
+
const result = {}
|
|
82
|
+
if (!files || !Array.isArray(files) || files.length < 1) {
|
|
83
|
+
return { ...result, ...changelogs }
|
|
84
|
+
}
|
|
85
|
+
for (const item of files) {
|
|
86
|
+
const [lang, path] = item.split(':');
|
|
87
|
+
if (!lang || !path) {
|
|
88
|
+
throw new Error('changelog files resolution error')
|
|
89
|
+
}
|
|
90
|
+
if (!fs.existsSync(path)) {
|
|
91
|
+
throw new Error(`changelog ${lang} file ${path} does not exist`)
|
|
92
|
+
}
|
|
93
|
+
const content = fs.readFileSync(path, 'utf8');
|
|
94
|
+
if (!content) {
|
|
95
|
+
throw new Error(`changelog ${lang} file ${path} content is empty`)
|
|
96
|
+
}
|
|
97
|
+
result[lang] = content.trim()
|
|
98
|
+
}
|
|
99
|
+
return { ...result, ...changelogs }
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// deprecate: 移除 `--file` 参数时删除该逻辑
|
|
70
103
|
if (!changelog && file) {
|
|
71
104
|
changelog = fs.readFileSync(file, 'utf8');
|
|
72
105
|
}
|
|
73
|
-
|
|
106
|
+
|
|
107
|
+
const changelogInitial = {}
|
|
108
|
+
if (changelog) {
|
|
109
|
+
changelogInitial[currentLocale] = changelog
|
|
110
|
+
}
|
|
111
|
+
const changelogs = await readChangelogFiles(changelogFiles, changelogInitial)
|
|
112
|
+
|
|
113
|
+
await p.publish(pkgPath, changelogs, currentLocale);
|
|
74
114
|
},
|
|
75
115
|
},
|
|
76
116
|
{
|
|
@@ -138,7 +178,7 @@ export function appstoreCommand(program) {
|
|
|
138
178
|
process.stdout.write('\x1B[?25h'); // 恢复光标显示
|
|
139
179
|
};
|
|
140
180
|
|
|
141
|
-
for (
|
|
181
|
+
for (; ;) {
|
|
142
182
|
const pgsResp = await request(progressUrl);
|
|
143
183
|
if (pgsResp.ok) {
|
|
144
184
|
const pgs = JSON.parse(await pgsResp.text());
|
package/lib/appstore/publish.js
CHANGED
|
@@ -14,7 +14,7 @@ async function askChangeLog(locale) {
|
|
|
14
14
|
{
|
|
15
15
|
name: 'changelog',
|
|
16
16
|
type: 'editor',
|
|
17
|
-
message: t('lzc_cli.lib.publish.ask_changelog_prompt', `填写 changelog 内容 ({{locale}})`, { locale }),
|
|
17
|
+
message: t('lzc_cli.lib.publish.ask_changelog_prompt', `填写 changelog 内容 ({{ locale }})`, { locale }),
|
|
18
18
|
validate: noEmpty,
|
|
19
19
|
},
|
|
20
20
|
]);
|
|
@@ -128,7 +128,7 @@ async function askWhetherCreateLPK(baseUrl, manifest, locale) {
|
|
|
128
128
|
}),
|
|
129
129
|
});
|
|
130
130
|
logger.debug('create app res: ', await crateAppRes.text());
|
|
131
|
-
logger.info(t('lzc_cli.lib.publish.ask_whether_create_lpk_success_tips', `创建 {{package}} 应用成功!`, { package: manifest['package'] }));
|
|
131
|
+
logger.info(t('lzc_cli.lib.publish.ask_whether_create_lpk_success_tips', `创建 {{ package }} 应用成功!`, { package: manifest['package'], interpolation: { escapeValue: false } }));
|
|
132
132
|
} else {
|
|
133
133
|
logger.info(
|
|
134
134
|
t(
|
|
@@ -205,9 +205,9 @@ export class Publish {
|
|
|
205
205
|
/**
|
|
206
206
|
* @param {string} pkgPath
|
|
207
207
|
* @param {string} changelog
|
|
208
|
-
* @param {string}
|
|
208
|
+
* @param {string} currentLocale
|
|
209
209
|
*/
|
|
210
|
-
async publish(pkgPath,
|
|
210
|
+
async publish(pkgPath, changelogs, currentLocale = 'zh') {
|
|
211
211
|
if (!Publish.preCheck(pkgPath)) return;
|
|
212
212
|
|
|
213
213
|
const { manifest, appIdExisted } = await this.checkAppIdExist(pkgPath);
|
|
@@ -237,19 +237,25 @@ export class Publish {
|
|
|
237
237
|
logger.debug('upload lpk response', lpkInfo);
|
|
238
238
|
if (res.status >= 400) {
|
|
239
239
|
logger.error(
|
|
240
|
-
t('lzc_cli.lib.publish.publish_lpk_fail_tips', `LPK 文件上传失败,err: {{message}}`, {
|
|
240
|
+
t('lzc_cli.lib.publish.publish_lpk_fail_tips', `LPK 文件上传失败,err: {{ message }}`, {
|
|
241
241
|
message: lpkInfo?.message ?? lpkInfo,
|
|
242
|
+
interpolation: { escapeValue: false }
|
|
242
243
|
}),
|
|
243
244
|
);
|
|
244
245
|
throw new Error(lpkInfo?.message ?? lpkInfo);
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
// 填写更新日志
|
|
248
|
-
if (!
|
|
249
|
-
const answer = await askChangeLog(
|
|
250
|
-
changelog = answer.changelog;
|
|
249
|
+
if (!changelogs || Object.keys(changelogs).length < 1) {
|
|
250
|
+
const answer = await askChangeLog(currentLocale);
|
|
251
|
+
let changelog = answer.changelog;
|
|
252
|
+
changelog = changelog.trim(); // clean space ^:)
|
|
253
|
+
|
|
254
|
+
// changelogs 本地化
|
|
255
|
+
const langKey = getLanguageForLocale(currentLocale);
|
|
256
|
+
changelogs[langKey] = changelog
|
|
251
257
|
}
|
|
252
|
-
|
|
258
|
+
logger.debug('publish changelogs is', changelogs);
|
|
253
259
|
|
|
254
260
|
const sendURL = this.baseUrl + `/app/${lpkInfo.package}/review/create`;
|
|
255
261
|
logger.debug('publish url is', sendURL);
|
|
@@ -264,12 +270,9 @@ export class Publish {
|
|
|
264
270
|
pkg_path: lpkInfo.url,
|
|
265
271
|
unsupported_platforms: lpkInfo.unsupportedPlatforms,
|
|
266
272
|
min_os_version: lpkInfo.minOsVersion,
|
|
267
|
-
changelogs
|
|
273
|
+
changelogs,
|
|
268
274
|
},
|
|
269
275
|
};
|
|
270
|
-
// changelogs 本地化
|
|
271
|
-
const langKey = getLanguageForLocale(locale);
|
|
272
|
-
formData.version.changelogs[langKey] = changelog;
|
|
273
276
|
|
|
274
277
|
logger.debug('form data is', formData);
|
|
275
278
|
|
package/lib/box/index.js
CHANGED
|
@@ -68,9 +68,9 @@ export function boxCommand(box) {
|
|
|
68
68
|
t(
|
|
69
69
|
'lzc_cli.lib.box.index.add_public_key_cmd_apply_tips',
|
|
70
70
|
`请点击下面的连接,或者复制到浏览器中打开,点击申请完成添加
|
|
71
|
-
-> https://dev.{{boxname}}.heiyu.space/auth?key={{pk}}
|
|
71
|
+
-> https://dev.{{ boxname }}.heiyu.space/auth?key={{ pk }}
|
|
72
72
|
`,
|
|
73
|
-
{ boxname: shellapi.boxname, pk: pk },
|
|
73
|
+
{ boxname: shellapi.boxname, pk: pk, interpolation: { escapeValue: false } },
|
|
74
74
|
),
|
|
75
75
|
);
|
|
76
76
|
},
|
package/lib/config/index.js
CHANGED
|
@@ -14,8 +14,9 @@ export function configCommand(program) {
|
|
|
14
14
|
const pair = Object.fromEntries([[key, value]]);
|
|
15
15
|
env.set(pair);
|
|
16
16
|
logger.info(
|
|
17
|
-
t('lzc_cli.lib.config.index.set_cmd_success_tips', `{{key}} 配置成功!`, {
|
|
17
|
+
t('lzc_cli.lib.config.index.set_cmd_success_tips', `{{ key }} 配置成功!`, {
|
|
18
18
|
key,
|
|
19
|
+
interpolation: { escapeValue: false }
|
|
19
20
|
}),
|
|
20
21
|
);
|
|
21
22
|
},
|
|
@@ -26,7 +27,7 @@ export function configCommand(program) {
|
|
|
26
27
|
handler: async ({ key }) => {
|
|
27
28
|
if (key) {
|
|
28
29
|
env.del(key);
|
|
29
|
-
logger.info(t('lzc_cli.lib.config.index.del_cmd_success', `删除 {{key}} 成功!`, { key }));
|
|
30
|
+
logger.info(t('lzc_cli.lib.config.index.del_cmd_success', `删除 {{ key }} 成功!`, { key, interpolation: { escapeValue: false } }));
|
|
30
31
|
return;
|
|
31
32
|
}
|
|
32
33
|
},
|
package/lib/debug_bridge.js
CHANGED
|
@@ -44,7 +44,7 @@ export class DebugBridge {
|
|
|
44
44
|
try {
|
|
45
45
|
const _ipv6 = await resolveDomain(this.domain, true);
|
|
46
46
|
domain = `[${_ipv6}]`;
|
|
47
|
-
} catch {}
|
|
47
|
+
} catch { }
|
|
48
48
|
}
|
|
49
49
|
const url = `https://${domain}/bannerfile`;
|
|
50
50
|
return new Promise((resolve, reject) => {
|
|
@@ -59,10 +59,10 @@ export class DebugBridge {
|
|
|
59
59
|
t(
|
|
60
60
|
'lzc_cli.lib.debug_bridge.check_dev_tools_not_exist_tips',
|
|
61
61
|
`检测到你还没有安装 '懒猫开发者工具',请先到商店中搜索安装
|
|
62
|
-
点击直接跳转 https://appstore.{{boxname}}.heiyu.space/#/shop/detail/cloud.lazycat.developer.tools
|
|
63
|
-
点击打开应用 https://dev.{{boxname}}.heiyu.space 查看应用状态
|
|
62
|
+
点击直接跳转 https://appstore.{{ boxname }}.heiyu.space/#/shop/detail/cloud.lazycat.developer.tools
|
|
63
|
+
点击打开应用 https://dev.{{ boxname }}.heiyu.space 查看应用状态
|
|
64
64
|
`,
|
|
65
|
-
{ boxname: this.boxname },
|
|
65
|
+
{ boxname: this.boxname, interpolation: { escapeValue: false } },
|
|
66
66
|
),
|
|
67
67
|
);
|
|
68
68
|
reject();
|
|
@@ -82,18 +82,19 @@ export class DebugBridge {
|
|
|
82
82
|
encoding: 'utf-8',
|
|
83
83
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
84
84
|
});
|
|
85
|
-
logger.debug(t('lzc_cli.lib.debug_bridge.common_start_log', `执行命令 {{cmd}} {{args}}`, { cmd, args: args.join(' ') }));
|
|
85
|
+
logger.debug(t('lzc_cli.lib.debug_bridge.common_start_log', `执行命令 {{ cmd }} {{ args }}`, { cmd, args: args.join(' '), interpolation: { escapeValue: false } }));
|
|
86
86
|
return new Promise((resolve, reject) => {
|
|
87
87
|
ssh.status == 0
|
|
88
88
|
? resolve(ssh.stdout)
|
|
89
89
|
: reject(
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
)
|
|
90
|
+
t('lzc_cli.lib.debug_bridge.common_exec_fail', `执行命令 {{ cmd }} {{ args }} 出错\n{{ stdout }}\n{{ stderr }}`, {
|
|
91
|
+
cmd,
|
|
92
|
+
args: args.join(' '),
|
|
93
|
+
stdout: ssh.stdout ?? '',
|
|
94
|
+
stdout: ssh.stderr ?? '',
|
|
95
|
+
interpolation: { escapeValue: false }
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
97
98
|
});
|
|
98
99
|
}
|
|
99
100
|
|
|
@@ -137,14 +138,15 @@ export class DebugBridge {
|
|
|
137
138
|
logger.warn(
|
|
138
139
|
t(
|
|
139
140
|
'lzc_cli.lib.debug_bridge.ssh_apply_grant_not_credible_tips',
|
|
140
|
-
`您当前机器的公钥未添加到微服({{boxname}})的信任列表中,请使用微服管理员账号在浏览器中访问以下地址,将您选择的公钥自动添加到信任列表中。(所有操作均只在您微服中进行,包括本开发机在内的任何数据不会泄漏到您的微服之外)
|
|
141
|
+
`您当前机器的公钥未添加到微服({{ boxname }})的信任列表中,请使用微服管理员账号在浏览器中访问以下地址,将您选择的公钥自动添加到信任列表中。(所有操作均只在您微服中进行,包括本开发机在内的任何数据不会泄漏到您的微服之外)
|
|
141
142
|
|
|
142
|
-
-> https://{{domain}}/auth?key={{pk}}
|
|
143
|
+
-> https://{{ domain }}/auth?key={{ pk }}
|
|
143
144
|
`,
|
|
144
145
|
{
|
|
145
146
|
boxname: this.boxname,
|
|
146
147
|
domain: this.domain,
|
|
147
|
-
|
|
148
|
+
pk,
|
|
149
|
+
interpolation: { escapeValue: false }
|
|
148
150
|
},
|
|
149
151
|
),
|
|
150
152
|
);
|