@lark-apaas/fullstack-cli 1.1.62-alpha.20260823195003 → 1.1.62-alpha.20260824081932

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/index.js CHANGED
@@ -7698,7 +7698,7 @@ function sanitizeStructuredLog(value) {
7698
7698
  delete sanitized.pid;
7699
7699
  return sanitized;
7700
7700
  }
7701
- var TRANSIENT_CONNECTION_ERROR_PATTERN = /ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENETUNREACH|proxy error|\[Proxy\] (?:Error:\s*$|Error during|Connection error|Non-connection error|Headers already sent|Service (?:recovered|did not recover))/i;
7701
+ var TRANSIENT_CONNECTION_ERROR_PATTERN = /ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENETUNREACH|socket hang up|proxy error|\[Proxy\] (?:Error:\s*$|Error during|Connection error|Non-connection error|Headers already sent|Service (?:recovered|did not recover))/i;
7702
7702
  function hasErrorInStdLines(lines) {
7703
7703
  const filtered = lines.filter((line) => !TRANSIENT_CONNECTION_ERROR_PATTERN.test(line));
7704
7704
  const combined = filtered.join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.62-alpha.20260823195003",
3
+ "version": "1.1.62-alpha.20260824081932",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,14 +1,18 @@
1
1
  #!/usr/bin/env bash
2
- # `npm run dev` 入口;按 SANDBOX_ID 是否非空判断运行环境:
3
- # - SANDBOX_ID 非空(沙箱平台注入应用所属沙箱 ID)→ 直接跑 dev.js
2
+ # `npm run dev` 入口;按 MIAODA_DEP_CACHE_DIR 是否非空判断运行环境(与 miaoda-cli
3
+ # isSandboxEnv() 同口径):
4
+ # - 非空(沙箱平台注入的依赖缓存目录)→ 直接跑 dev.js
4
5
  # (保活 / restart loop / 文件日志 —— 沙箱生产形态)。脚本同步由平台 pod 启动阶段做过,
5
6
  # dev 入口不再额外 `npm run upgrade`。
6
7
  # - 否则(本地)→ 走 miaoda app sync 兜底 + 跑 dev-local.js:纯 stdout、崩了就崩、Agent 友好。
7
- # 显式想跑本地路径可用 `npm run dev:local`(绕过 SANDBOX_ID 判断)。
8
+ # 显式想跑本地路径可用 `npm run dev:local`(绕过本判断)。
9
+ #
10
+ # 不用 SANDBOX_ID:它由 sandbox_console 在绑定沙箱时才写入 .force/environment/env,预热池实例
11
+ # 在绑定前拿不到,会被误判成本地。保留为附加条件只为兼容,不影响判定结果。
8
12
  set -euo pipefail
9
13
  SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
10
14
 
11
- if [ -n "${SANDBOX_ID:-}" ]; then
15
+ if [ -n "${MIAODA_DEP_CACHE_DIR:-}" ] || [ -n "${SANDBOX_ID:-}" ]; then
12
16
  exec node "$SCRIPT_DIR/dev.js" "$@"
13
17
  fi
14
18
 
@@ -18,7 +22,7 @@ if [ ! -f "$SCRIPT_DIR/dev-local.js" ]; then
18
22
  fi
19
23
 
20
24
  # 本地启动前先跑一次 miaoda app sync:同步 platform-controlled 内容 + 升 @lark-apaas/* 到
21
- # latest + 迁移老 npm scripts。沙箱不走这里(SANDBOX_ID 分支已经 exec return)。
25
+ # latest + 迁移老 npm scripts。沙箱不走这里(上面的沙箱分支已经 exec return)。
22
26
  npx -y @lark-apaas/miaoda-cli@latest app sync || echo "[dev] miaoda app sync 失败,按现状继续" >&2
23
27
 
24
28
  exec node "$SCRIPT_DIR/dev-local.js" "$@"
@@ -76,13 +76,49 @@ function isStylelintTarget(filePath) {
76
76
  return filePath.endsWith('.css');
77
77
  }
78
78
 
79
+ const STYLELINT_CONFIG_FILES = [
80
+ '.stylelintrc',
81
+ '.stylelintrc.js',
82
+ '.stylelintrc.cjs',
83
+ '.stylelintrc.json',
84
+ 'stylelint.config.js',
85
+ ];
86
+
87
+ /**
88
+ * 老模板(fullstack-nestjs-template 1.x 时代)的应用跑不了 stylelint,跑了就挂、把 pre-commit
89
+ * 卡死。两种形态都实测过:
90
+ *
91
+ * - 缺 scripts.stylelint → `npm error Missing script: "stylelint"`
92
+ * - 缺 .stylelintrc.* → `ConfigurationError: No configuration provided`
93
+ *
94
+ * 注意光判断 stylelint 装没装拦不住:@lark-apaas/fullstack-presets 的 dependencies 里有
95
+ * stylelint,只要 dep 了 presets 二进制就在。缺任一件就跳过这一步。
96
+ */
97
+ function canRunStylelint() {
98
+ let pkg;
99
+ try {
100
+ pkg = JSON.parse(fs.readFileSync(path.join(cwd, 'package.json'), 'utf8'));
101
+ } catch {
102
+ return false;
103
+ }
104
+
105
+ if (!pkg.scripts || !pkg.scripts.stylelint) return false;
106
+
107
+ return STYLELINT_CONFIG_FILES.some(file => fs.existsSync(path.join(cwd, file)));
108
+ }
109
+
79
110
  async function runDefaultLint() {
80
111
  const taskSpecs = [
81
112
  [getBinName('npm'), ['run', 'eslint']],
82
113
  [getBinName('npm'), ['run', 'type:check']],
83
- [getBinName('npm'), ['run', 'stylelint']],
84
114
  ];
85
115
 
116
+ if (canRunStylelint()) {
117
+ taskSpecs.push([getBinName('npm'), ['run', 'stylelint']]);
118
+ } else {
119
+ console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
120
+ }
121
+
86
122
  process.exit(await runTasksSerially(taskSpecs));
87
123
  }
88
124
 
@@ -120,7 +156,9 @@ async function runSelectiveLint(inputFiles) {
120
156
  taskSpecs.push([getBinName('npx'), ['eslint', '--quiet', ...eslintFiles]]);
121
157
  }
122
158
 
123
- if (stylelintFiles.length > 0) {
159
+ if (stylelintFiles.length > 0 && !canRunStylelint()) {
160
+ console.warn('[lint] Skip stylelint: missing scripts.stylelint or stylelint config');
161
+ } else if (stylelintFiles.length > 0) {
124
162
  taskSpecs.push([getBinName('npx'), ['stylelint', '--quiet', ...stylelintFiles]]);
125
163
  }
126
164