@lazycatcloud/lzc-cli 2.0.0-pre.0 → 2.0.0-pre.1

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 (88) hide show
  1. package/README.md +22 -7
  2. package/changelog.md +50 -19
  3. package/lib/app/apkshell.js +7 -44
  4. package/lib/app/index.js +4 -0
  5. package/lib/app/lpk_build.js +266 -56
  6. package/lib/app/lpk_build_images.js +37 -16
  7. package/lib/app/lpk_create.js +158 -83
  8. package/lib/app/lpk_create_generator.js +35 -42
  9. package/lib/app/lpk_installer.js +4 -3
  10. package/lib/app/manifest_build.js +259 -0
  11. package/lib/app/project_cp.js +5 -10
  12. package/lib/app/project_deploy.js +36 -11
  13. package/lib/app/project_exec.js +48 -11
  14. package/lib/app/project_info.js +59 -59
  15. package/lib/app/project_log.js +5 -10
  16. package/lib/app/project_runtime.js +113 -18
  17. package/lib/app/project_start.js +6 -11
  18. package/lib/app/project_sync.js +499 -0
  19. package/lib/appstore/apkshell.js +50 -0
  20. package/lib/appstore/publish.js +54 -15
  21. package/lib/build_remote.js +0 -1
  22. package/lib/config/index.js +1 -1
  23. package/lib/debug_bridge.js +81 -21
  24. package/lib/i18n/locales/en/translation.json +262 -262
  25. package/lib/i18n/locales/zh/translation.json +262 -262
  26. package/lib/lpk/core.js +2 -1
  27. package/lib/migrate/index.js +52 -0
  28. package/lib/package_info.js +135 -0
  29. package/lib/shellapi.js +35 -1
  30. package/lib/sig/core.js +2 -2
  31. package/lib/utils.js +91 -14
  32. package/package.json +89 -89
  33. package/scripts/cli.js +2 -0
  34. package/scripts/smoke/frontend-dev-entry.mjs +104 -0
  35. package/scripts/smoke/template-project.mjs +311 -0
  36. package/template/_lpk/README.md +6 -3
  37. package/template/_lpk/gui-vnc.manifest.yml.in +0 -9
  38. package/template/_lpk/hello-vue.manifest.yml.in +38 -0
  39. package/template/_lpk/manifest.yml.in +0 -9
  40. package/template/_lpk/package.yml.in +7 -0
  41. package/template/_lpk/todolist-golang.manifest.yml.in +23 -9
  42. package/template/_lpk/todolist-java.manifest.yml.in +23 -9
  43. package/template/_lpk/todolist-python.manifest.yml.in +31 -9
  44. package/template/_lpk/todolist-serverless.manifest.yml.in +38 -0
  45. package/template/blank/lzc-build.dev.yml +4 -0
  46. package/template/blank/lzc-build.yml +0 -2
  47. package/template/blank/lzc-manifest.yml +3 -12
  48. package/template/blank/package.yml +7 -0
  49. package/template/golang/Dockerfile +1 -1
  50. package/template/golang/Dockerfile.dev +20 -0
  51. package/template/golang/README.md +22 -11
  52. package/template/golang/_lzcdevignore +21 -0
  53. package/template/golang/lzc-build.dev.yml +12 -0
  54. package/template/golang/lzc-build.yml +0 -5
  55. package/template/golang/main.go +1 -1
  56. package/template/golang/manifest.dev.page.js +24 -0
  57. package/template/golang/run.sh +7 -0
  58. package/template/gui-vnc/README.md +5 -1
  59. package/template/gui-vnc/lzc-build.dev.yml +4 -0
  60. package/template/gui-vnc/lzc-build.yml +0 -5
  61. package/template/python/Dockerfile +2 -2
  62. package/template/python/Dockerfile.dev +18 -0
  63. package/template/python/README.md +28 -11
  64. package/template/python/_lzcdevignore +21 -0
  65. package/template/python/app.py +1 -1
  66. package/template/python/lzc-build.dev.yml +12 -0
  67. package/template/python/lzc-build.yml +0 -5
  68. package/template/python/manifest.dev.page.js +25 -0
  69. package/template/python/run.sh +12 -1
  70. package/template/springboot/Dockerfile +1 -1
  71. package/template/springboot/Dockerfile.dev +20 -0
  72. package/template/springboot/README.md +22 -11
  73. package/template/springboot/_lzcdevignore +21 -0
  74. package/template/springboot/lzc-build.dev.yml +12 -0
  75. package/template/springboot/lzc-build.yml +0 -5
  76. package/template/springboot/manifest.dev.page.js +24 -0
  77. package/template/springboot/run.sh +7 -0
  78. package/template/vue/README.md +14 -27
  79. package/template/vue/_gitignore +0 -1
  80. package/template/vue/lzc-build.dev.yml +7 -0
  81. package/template/vue/lzc-build.yml +0 -2
  82. package/template/vue/manifest.dev.page.js +50 -0
  83. package/template/vue-minidb/README.md +11 -19
  84. package/template/vue-minidb/_gitignore +0 -1
  85. package/template/vue-minidb/lzc-build.dev.yml +7 -0
  86. package/template/vue-minidb/lzc-build.yml +0 -2
  87. package/template/vue-minidb/manifest.dev.page.js +50 -0
  88. package/template/blank/_gitignore +0 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ npm install -g @lazycatcloud/lzc-cli
14
14
  lzc-cli completion >> ~/.zshrc
15
15
  ```
16
16
 
17
- 下面开始使用 `lzc-cli` 去创建一个项目吧!
17
+ 下面开始使用 `lzc-cli` 去创建一个项目吧。
18
18
 
19
19
  ```bash
20
20
  # 在新目录创建项目(交互选择模板)
@@ -23,22 +23,37 @@ lzc-cli project create you_project
23
23
  # 在当前目录初始化空白项目
24
24
  lzc-cli project create --in-place
25
25
 
26
- # 构建 release lpk 包(优先 lzc-build.release.yml,不存在则回退 lzc-build.yml
27
- lzc-cli project release
26
+ # 部署开发态项目(优先使用 lzc-build.dev.yml)
27
+ lzc-cli project deploy
28
28
 
29
- # 将lpk包安装到盒子中去
30
- lzc-cli lpk install
29
+ # 查看当前部署信息与 Target URL
30
+ lzc-cli project info
31
31
 
32
- # 部署后默认自动启动
33
- lzc-cli project deploy
32
+ # 持续同步本地代码到真实运行环境
33
+ lzc-cli project sync --watch
34
34
 
35
35
  # 进入运行容器调试
36
36
  lzc-cli project exec /bin/sh
37
37
 
38
+ # 构建 release lpk 包(使用 lzc-build.yml)
39
+ lzc-cli project release
40
+
41
+ # 将 lpk 包安装到盒子中去
42
+ lzc-cli lpk install
43
+
38
44
  # 经过测试后,将包发布到懒猫云商店中去
39
45
  lzc-cli appstore publish
40
46
  ```
41
47
 
48
+ 补充说明:
49
+
50
+ 1. 只要项目里存在 `lzc-build.dev.yml`,`project deploy/info/start/exec/cp/log/sync` 默认都会优先使用它。
51
+ 2. 所有 `project` 命令都会打印当前实际使用的 `Build config`。
52
+ 3. 如需显式操作 release,请加 `--release`。
53
+ 4. 前端模板建议先 `project deploy` 并打开应用,再根据页面提示执行 `npm run dev`。
54
+ 5. 后端模板建议先打开应用,再根据页面提示执行 `project sync --watch` 与容器内进程启动。
55
+ 6. `project create` 生成的新项目会默认包含 `lzc-manifest.yml` 与 `package.yml`;静态包元数据不再写在 manifest 顶层。
56
+
42
57
  [changelog](./changelog.md)
43
58
 
44
59
  #### box add-by-ssh 远端直连模式
package/changelog.md CHANGED
@@ -1,52 +1,83 @@
1
1
  # Changelog
2
2
 
3
- ## 2.0.0-pre.0
3
+ ## [2.0.0-pre.1](https://gitee.com/linakesi/lzc-cli/compare/v1.3.17...v2.0.0-pre.1) (2026-03-11)
4
4
 
5
- 1. Add lpkv2 features for internal testing
5
+ ### Features
6
6
 
7
- ## [1.3.14](https://gitee.com/linakesi/lzc-cli/compare/v1.3.13...v1.3.14) (2025-12-17)
7
+ - add the LPK v2 project workflow with `project deploy`, `project start`, `project exec`, `project log`, `project cp`, and `project sync`
8
+ - refresh `project create` templates for request inject based frontend and backend development
9
+ - add dev id sync support during `project deploy` for remote development routing
10
+
11
+ ### Bug Fixes
12
+
13
+ - restore old cli devshell compatibility with current developer tools backend
14
+ - refine `project exec` and deploy behavior in dev mode
15
+ - load Vue devtools only in serve mode
16
+
17
+ ## [1.3.17](https://gitee.com/linakesi/lzc-cli/compare/v1.3.15...v1.3.17) (2026-03-03)
8
18
 
9
19
 
10
20
  ### Bug Fixes
11
21
 
12
- * dealing with the i18n difference escape problem ([2b98cdf](https://gitee.com/linakesi/lzc-cli/commits/2b98cdf0573a1537bee409079d6160da1b7cd80b))
22
+ * dealing with the error prompt of creating a new app ([6069b28](https://gitee.com/linakesi/lzc-cli/commits/6069b282027c7a6ddbcde45a0ff26156e6745030))
23
+ * playground site url ([5afd2ec](https://gitee.com/linakesi/lzc-cli/commits/5afd2ec5edd8aee51579add5daed3ccaabc4650f))
24
+ * submit the app file size ([7dffe90](https://gitee.com/linakesi/lzc-cli/commits/7dffe90b4a18f6f4b8afd8ace23c836d7fba17a7))
13
25
 
26
+ ## [1.3.16](https://gitee.com/linakesi/lzc-cli/compare/v1.3.13...v1.3.16) (2026-02-28)
27
+
28
+ ### Bug Fixes
29
+
30
+ - dealing with the i18n difference escape problem ([2b98cdf](https://gitee.com/linakesi/lzc-cli/commits/2b98cdf0573a1537bee409079d6160da1b7cd80b))
31
+ - disable i18next support notice output ([f433c88](https://gitee.com/linakesi/lzc-cli/commits/f433c88e9a2434c9cff303c088fa39d33bf59309))
32
+ - playground site url ([5afd2ec](https://gitee.com/linakesi/lzc-cli/commits/5afd2ec5edd8aee51579add5daed3ccaabc4650f))
14
33
 
15
34
  ### Features
16
35
 
17
- * cmd publish add `changelog-files` option ([17d95c6](https://gitee.com/linakesi/lzc-cli/commits/17d95c6fa761f25af234946dedd3d6a0503ba962))
36
+ - cmd publish add `changelog-files` option ([17d95c6](https://gitee.com/linakesi/lzc-cli/commits/17d95c6fa761f25af234946dedd3d6a0503ba962))
18
37
 
19
- ## [1.3.13](https://gitee.com/linakesi/lzc-cli/compare/v1.3.12...v1.3.13) (2025-12-10)
38
+ ## [1.3.15](https://gitee.com/linakesi/lzc-cli/compare/v1.3.14...v1.3.15) (2026-02-26)
20
39
 
40
+ ### Bug Fixes
41
+
42
+ - disable i18next support notice output ([f433c88](https://gitee.com/linakesi/lzc-cli/commits/f433c88e9a2434c9cff303c088fa39d33bf59309))
43
+
44
+ ## [1.3.14](https://gitee.com/linakesi/lzc-cli/compare/v1.3.13...v1.3.14) (2025-12-17)
45
+
46
+ ### Bug Fixes
47
+
48
+ - dealing with the i18n difference escape problem ([2b98cdf](https://gitee.com/linakesi/lzc-cli/commits/2b98cdf0573a1537bee409079d6160da1b7cd80b))
21
49
 
22
50
  ### Features
23
51
 
24
- * add i18n ([f62c52a](https://gitee.com/linakesi/lzc-cli/commits/f62c52a9b443d2226ffa06d17593f1912b9dc4de))
25
- * add i18n config ([185418d](https://gitee.com/linakesi/lzc-cli/commits/185418d5e77858d55fca485ff115191c0c95834e))
26
- * some copywriters provide i18n calls ([54d92f1](https://gitee.com/linakesi/lzc-cli/commits/54d92f17520e6413d735c82d57d3aa3404410add))
52
+ - cmd publish add `changelog-files` option ([17d95c6](https://gitee.com/linakesi/lzc-cli/commits/17d95c6fa761f25af234946dedd3d6a0503ba962))
27
53
 
28
- ## [1.3.12](https://gitee.com/linakesi/lzc-cli/compare/v1.3.11...v1.3.12) (2025-10-29)
54
+ ## [1.3.13](https://gitee.com/linakesi/lzc-cli/compare/v1.3.12...v1.3.13) (2025-12-10)
29
55
 
56
+ ### Features
30
57
 
31
- ### Bug Fixes
58
+ - add i18n ([f62c52a](https://gitee.com/linakesi/lzc-cli/commits/f62c52a9b443d2226ffa06d17593f1912b9dc4de))
59
+ - add i18n config ([185418d](https://gitee.com/linakesi/lzc-cli/commits/185418d5e77858d55fca485ff115191c0c95834e))
60
+ - some copywriters provide i18n calls ([54d92f1](https://gitee.com/linakesi/lzc-cli/commits/54d92f17520e6413d735c82d57d3aa3404410add))
61
+
62
+ ## [1.3.12](https://gitee.com/linakesi/lzc-cli/compare/v1.3.11...v1.3.12) (2025-10-29)
32
63
 
33
- * ci friendly publish command ([1e7b477](https://gitee.com/linakesi/lzc-cli/commits/1e7b47740f1d9ae15d677a16a97d7cc461814c42))
34
- * pre publish print error ([55c8326](https://gitee.com/linakesi/lzc-cli/commits/55c832625aa532bab3e0fcf0d7ec09d8235db190))
64
+ ### Bug Fixes
35
65
 
66
+ - ci friendly publish command ([1e7b477](https://gitee.com/linakesi/lzc-cli/commits/1e7b47740f1d9ae15d677a16a97d7cc461814c42))
67
+ - pre publish print error ([55c8326](https://gitee.com/linakesi/lzc-cli/commits/55c832625aa532bab3e0fcf0d7ec09d8235db190))
36
68
 
37
69
  ### Features
38
70
 
39
- * add `LZC_CLI_CHECK_DNS_RESOLVE` set check dev tools to use built-in dns resolution ([78ba39e](https://gitee.com/linakesi/lzc-cli/commits/78ba39e6869cbed956141e7ff7812ce3718e41ce))
40
- * supports config the language key for publish app update logs through `--clang` ([e06eec8](https://gitee.com/linakesi/lzc-cli/commits/e06eec88f11827816ddd4e3a7ccd43b2883a1003))
41
- * uninstall app add `--delete-data` parameter ([b4378f7](https://gitee.com/linakesi/lzc-cli/commits/b4378f77b528fbb5b5a1c74771ddda9f60f4e49a))
71
+ - add `LZC_CLI_CHECK_DNS_RESOLVE` set check dev tools to use built-in dns resolution ([78ba39e](https://gitee.com/linakesi/lzc-cli/commits/78ba39e6869cbed956141e7ff7812ce3718e41ce))
72
+ - supports config the language key for publish app update logs through `--clang` ([e06eec8](https://gitee.com/linakesi/lzc-cli/commits/e06eec88f11827816ddd4e3a7ccd43b2883a1003))
73
+ - uninstall app add `--delete-data` parameter ([b4378f7](https://gitee.com/linakesi/lzc-cli/commits/b4378f77b528fbb5b5a1c74771ddda9f60f4e49a))
42
74
 
43
75
  ## [1.3.11](https://gitee.com/linakesi/lzc-cli/compare/v1.3.10...v1.3.11) (2025-10-10)
44
76
 
45
-
46
77
  ### Features
47
78
 
48
- * support setting token through environment variables ([4a25f84](https://gitee.com/linakesi/lzc-cli/commits/4a25f84fe4df938cb3d85f6391e27772dae5b071))
49
- * the copy-image command adds the `trace-level` parameter ([cd4d4c3](https://gitee.com/linakesi/lzc-cli/commits/cd4d4c351d4bd43bffcfe5f67087c6bffd65d3f4))
79
+ - support setting token through environment variables ([4a25f84](https://gitee.com/linakesi/lzc-cli/commits/4a25f84fe4df938cb3d85f6391e27772dae5b071))
80
+ - the copy-image command adds the `trace-level` parameter ([cd4d4c3](https://gitee.com/linakesi/lzc-cli/commits/cd4d4c351d4bd43bffcfe5f67087c6bffd65d3f4))
50
81
 
51
82
  ## [1.3.10](https://gitee.com/linakesi/lzc-cli/compare/v0.0.8...v1.3.10) (2025-08-15)
52
83
 
@@ -1,45 +1,8 @@
1
- import fs from 'node:fs';
2
- import logger from 'loglevel';
3
- import axios from 'axios';
4
- import { t } from '../i18n/index.js';
1
+ import { triggerApk as triggerApkFunc } from '../appstore/apkshell.js';
5
2
 
6
- // 创建 Axios 实例
7
- const api = axios.create();
8
-
9
- // 添加响应拦截器
10
- api.interceptors.response.use(
11
- (response) => response, // 直接返回响应
12
- (error) => {
13
- if (error.response && error.response.status === 304) {
14
- return Promise.resolve(error.response); // 返回响应以便后续处理
15
- }
16
- return Promise.reject(error); // 其他错误继续抛出
17
- },
18
- );
19
-
20
- export async function triggerApk(id, name, iconPath) {
21
- if (!id) {
22
- logger.error(t('lzc_cli.lib.app.apkshell.trigger_apk_empty_appid', 'Appid 为必填项!'));
23
- return;
24
- }
25
- name = name || t('lzc_cli.lib.app.apkshell.trigger_apk_default_app_name', '懒猫应用');
26
- try {
27
- const form = new FormData();
28
- form.append('app_id', id);
29
- form.append('app_name', name);
30
- if (iconPath) {
31
- form.append('app_icon', new Blob([fs.readFileSync(iconPath)]));
32
- }
33
- const resp = await api.post('https://appstore.api.lazycat.cloud/api/trigger_latest_for_app', form, { timeout: 5000 });
34
- if (resp.status == 304) {
35
- logger.debug(t('lzc_cli.lib.app.apkshell.trigger_apk_build_tips', `APK构建任务已创建成功,如需使用安卓端,请耐心等待1分钟左右`));
36
- } else if (resp.status <= 201) {
37
- logger.info(t('lzc_cli.lib.app.apkshell.trigger_apk_build_ok_tips', `APK构建任务已创建成功,如需使用安卓端,请耐心等待1分钟左右`));
38
- } else if (resp.status >= 400) {
39
- logger.debug(t('lzc_cli.lib.app.apkshell.trigger_apk_build_failed', '请求按钮应用出错:'), resp);
40
- throw t('lzc_cli.lib.app.apkshell.trigger_apk_build_failed_tips', `请求生成应用出错! 使用 --apk=n 停止生成APK`);
41
- }
42
- } catch (error) {
43
- logger.debug(error);
44
- }
45
- }
3
+ /**
4
+ * @deprecated use appstore/apk.js triggerApk
5
+ * @return {*}
6
+ */
7
+ const triggerApk = triggerApkFunc;
8
+ export { triggerApk };
package/lib/app/index.js CHANGED
@@ -8,6 +8,7 @@ import { projectLogCommand } from './project_log.js';
8
8
  import { projectInfoCommand } from './project_info.js';
9
9
  import { projectStartCommand } from './project_start.js';
10
10
  import { projectDeployCommand } from './project_deploy.js';
11
+ import { projectSyncCommand } from './project_sync.js';
11
12
  import { LpkInstaller, installConfig } from './lpk_installer.js';
12
13
  import logger from 'loglevel';
13
14
  import { sleep, checkRsync } from '../utils.js';
@@ -134,6 +135,7 @@ export function lpkProjectCommand(program) {
134
135
  },
135
136
  handler: async ({ context, output, file }) => {
136
137
  const lpk = await new LpkBuild(context, file).init();
138
+ logger.info(`Build config: ${lpk.optionsFilePath}`);
137
139
  // 正常的打包逻辑不需要 devshell
138
140
  lpk.onBeforeBuildPackage(async (options) => {
139
141
  delete options['devshell'];
@@ -164,6 +166,7 @@ export function lpkProjectCommand(program) {
164
166
  handler: async ({ context, output, file }) => {
165
167
  const cwd = context ? path.resolve(context) : process.cwd();
166
168
  const configPath = resolveProjectReleaseConfigPath(cwd, file);
169
+ logger.info(`Build config: ${configPath}`);
167
170
  const projectCwd = path.dirname(configPath);
168
171
  const configName = path.basename(configPath);
169
172
  const lpk = await new LpkBuild(projectCwd, configName).init();
@@ -253,6 +256,7 @@ export function lpkProjectCommand(program) {
253
256
  projectInfoCommand(),
254
257
  projectStartCommand(),
255
258
  projectDeployCommand(),
259
+ projectSyncCommand(),
256
260
  ];
257
261
  program.command({
258
262
  command: 'project',