@lark-apaas/miaoda-cli 0.1.33-alpha.e92fe00 → 0.1.33-alpha.fbcdd20

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/README.md CHANGED
@@ -63,7 +63,7 @@ miaoda app export-standalone --json
63
63
  ```
64
64
 
65
65
  支持 `design-html` / `html` / `vite-react` / `nestjs-react-fullstack`。页面与代码里字面以
66
- `/spark/app` 开头的存储图片会经沙箱网关(localhost:8080)下载到 `images/` 并改写成相对路径。
66
+ `/spark/app` 开头的存储图片会经 dev server 代理下载到 `images/` 并改写成相对路径。
67
67
 
68
68
  默认输出落在 `dist/` 下是刻意的:`dist` 已在部署扫描的 EXCLUDES 与各模板 `.gitignore` 中,
69
69
  产物不会污染部署包、不会被误提交;代价是下一次构建会清掉它。
@@ -184,7 +184,7 @@ function registerAppExportStandalone(parent) {
184
184
  .description('把当前应用构建成自包含静态产物(目录 + zip),可脱离妙搭平台本地访问')
185
185
  .option('--dir <path>', '项目目录,默认 cwd(需含 .spark/meta.json)')
186
186
  .option('--out <dir>', '输出目录(相对项目根)', index_1.DEFAULT_STANDALONE_OUT)
187
- .option('--dev-server <url>', '图片下载的请求前缀,默认沙箱网关 http://localhost:8080')
187
+ .option('--dev-server <url>', 'dev server 基址,默认 http://localhost:${CLIENT_DEV_PORT:-8080}')
188
188
  .addHelpText('after', `
189
189
  与 'miaoda app export' 的区别(**两个命令语义无关,别选错**)
190
190
  app export 导出源码归档(创意应用升级链路的只读参考物)
@@ -201,7 +201,7 @@ function registerAppExportStandalone(parent) {
201
201
  代价:下一次构建会 rm -rf dist,导出产物是易失的。
202
202
 
203
203
  图片本地化
204
- 只处理页面/代码里字面以 /spark/app 开头的 URL,经沙箱网关(localhost:8080)下载到
204
+ 只处理页面/代码里字面以 /spark/app 开头的 URL,经 dev server 代理下载到
205
205
  <out>/images/ 并改写成相对路径。其它挂载前缀(/spark/p/、/app/<id>、反代)不处理。
206
206
  接口运行时返回的 download_url 属动态 URL,静态扫描覆盖不到。
207
207
 
@@ -24,20 +24,11 @@ function normalizeOutDir(rel) {
24
24
  }
25
25
  return posix;
26
26
  }
27
- /** 沙箱网关地址:它才是代理 `/spark/app` 的那个服务(响应头 `Server: openresty`)。 */
28
- const SANDBOX_GATEWAY_BASE = 'http://localhost:8080';
29
- /**
30
- * 图片下载的请求前缀。
31
- *
32
- * **刻意写死 8080,不读 `CLIENT_DEV_PORT`。** 那个 env 表示的是「应用自己的 dev server
33
- * 监听端口」,与「谁在代理 `/spark/app`」是两回事:design-html / html 用
34
- * `coding-static-server`(默认 8001,纯静态、完全不代理),读了它会把请求打到静态
35
- * server 上,稳定 404。真机踩过。
36
- */
37
27
  function resolveDevServerBase(explicit) {
38
28
  if (explicit)
39
29
  return explicit.replace(/\/+$/, '');
40
- return SANDBOX_GATEWAY_BASE;
30
+ const port = process.env.CLIENT_DEV_PORT ?? '8080';
31
+ return `http://localhost:${port}`;
41
32
  }
42
33
  /** 遍历产物树里的文本文件,返回 posix 相对路径。 */
43
34
  function* walkText(dir, rel = '') {
@@ -136,7 +127,7 @@ async function handleAppExportStandalone(opts) {
136
127
  ...(failed.length > 1
137
128
  ? [`其余 ${String(failed.length - 1)} 条见 --verbose(每条请求地址都会打到 stderr)`]
138
129
  : []),
139
- `实际请求前缀:${devServerBase}${opts.devServer ? '(--dev-server 指定)' : '(沙箱网关默认)'}`,
130
+ `实际请求前缀:${devServerBase}(来自 ${opts.devServer ? '--dev-server' : process.env.CLIENT_DEV_PORT ? 'CLIENT_DEV_PORT env' : '默认 8080'})`,
140
131
  '若端口不对,可用 --dev-server http://localhost:<port> 覆盖',
141
132
  ],
142
133
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/miaoda-cli",
3
- "version": "0.1.33-alpha.e92fe00",
3
+ "version": "0.1.33-alpha.fbcdd20",
4
4
  "description": "Miaoda 平台命令行工具,面向 Agent 调用",
5
5
  "type": "commonjs",
6
6
  "bin": {