my-code-style 1.9.0 → 1.9.2
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 +14 -0
- package/README.md +37 -16
- package/bin/doctor +24 -3
- package/bin/init +88 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
## 变更日志
|
|
2
2
|
|
|
3
|
+
## [1.9.2](https://github.com/myvn/codeStyle/compare/v1.9.1...v1.9.2) (2026-09-23)
|
|
4
|
+
|
|
5
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
6
|
+
|
|
7
|
+
- **init:** 兼容段 off→warn——带/不带 .ts 扩展名 import 双向兼容 ([a26cfb6](https://github.com/myvn/codeStyle/commit/a26cfb6884b96c466e45b935a606c217bd39069c))
|
|
8
|
+
- **init:** 显式 .ts 扩展名 import 自动兼容,fresh init 保持绿起点(BUG-037) ([4c63221](https://github.com/myvn/codeStyle/commit/4c632219817cf188d80963a45076817bcfd9d6ef))
|
|
9
|
+
|
|
10
|
+
## [1.9.1](https://github.com/myvn/codeStyle/compare/v1.9.0...v1.9.1) (2026-09-23)
|
|
11
|
+
|
|
12
|
+
### 🐛 Bug Fixes | Bug 修复
|
|
13
|
+
|
|
14
|
+
- **doctor:** ESM-only peer 误报未安装——版本探测改文件系统链优先 ([418aeb5](https://github.com/myvn/codeStyle/commit/418aeb5c90b097719a37aa96ee9bf140a4550b45))
|
|
15
|
+
- **init:** --merge 统计语义「保留/覆盖」对齐 + 新增 lint:style 全量样式入口 ([9ebe796](https://github.com/myvn/codeStyle/commit/9ebe796b7959052c1880af1af164247abcc16a98))
|
|
16
|
+
|
|
3
17
|
## [1.9.0](https://github.com/myvn/codeStyle/compare/v1.8.6...v1.9.0) (2026-09-23)
|
|
4
18
|
|
|
5
19
|
### ✨ Features | 新功能
|
package/README.md
CHANGED
|
@@ -204,6 +204,27 @@ npx my-code-style-init [--dry-run] [--backup] [--merge] [--version|-v] [--help|-
|
|
|
204
204
|
- 初始化结束时**自动自检 hooks**(存在 / 非空 / 可执行位 / `lint-staged`、`commitlint` 是否可解析),只提示不阻断——把"hook 存在但不生效"消灭在当场。
|
|
205
205
|
- 具备**事务回滚保护**:若在写入过程中遭遇文件权限或磁盘异常,自动回滚所有修改,恢复工作区原始状态。
|
|
206
206
|
|
|
207
|
+
## lint 覆盖范围须知
|
|
208
|
+
|
|
209
|
+
| 入口 | 覆盖 | 典型用途 |
|
|
210
|
+
| ------------------------- | ----------------------------------------------- | ------------------ |
|
|
211
|
+
| `pnpm lint` | ESLint(JS/TS/Vue 脚本层) | 本地与 CI 基础门禁 |
|
|
212
|
+
| `pnpm lint:style` | Stylelint 全仓(Vue/HTML 内嵌 + css/scss/less) | CI 补齐样式检查 |
|
|
213
|
+
| `pnpm lint:all` | ESLint + Stylelint 全仓 | CI 一条命令全覆盖 |
|
|
214
|
+
| lint-staged(pre-commit) | 仅本次改动的文件(三件套自动修复) | 提交门禁 |
|
|
215
|
+
|
|
216
|
+
`lint` 只跑 **ESLint**;Stylelint 默认只在 pre-commit 对**本次改动的文件**执行——CI 只跑 `pnpm lint` 时 CSS/SCSS/Vue 内嵌样式不会被检查。有 CSS 预处理器的项目,init 会生成 `lint:style` 与 `lint:all`。
|
|
217
|
+
|
|
218
|
+
### 显式扩展名 import 的兼容行为
|
|
219
|
+
|
|
220
|
+
`import-x/extensions` 默认要求相对导入**省略** `.ts/.tsx` 扩展名。Vite 等 bundler resolution 项目常写 `import x from "@/types/Foo.ts"`(合法但与该规则冲突)。
|
|
221
|
+
|
|
222
|
+
init 会**自动检测**:命中显式扩展名 import 时,生成的 `eslint.config.mjs` 注入兼容段——该规则**降级为 warn**,`pnpm lint` 退出码不受影响:
|
|
223
|
+
|
|
224
|
+
- **带 `.ts` 与不带 `.ts` 都可以写**,两种风格共存不报错;
|
|
225
|
+
- 不一致的写法仍会出 warning,作为渐进统一的风格信号;
|
|
226
|
+
- 团队统一后想恢复严格检查(error 级、只允许省略),删除 `eslint.config.mjs` 里的兼容段即可。
|
|
227
|
+
|
|
207
228
|
## 项目体检:my-code-style-doctor
|
|
208
229
|
|
|
209
230
|
```bash
|
|
@@ -258,12 +279,12 @@ npx my-code-style-doctor
|
|
|
258
279
|
## 测试套件
|
|
259
280
|
|
|
260
281
|
```bash
|
|
261
|
-
npm run test:all # 全量运行
|
|
282
|
+
npm run test:all # 全量运行 200 项:用例明细 + 分类统计 + 最慢文件定位
|
|
262
283
|
npm run diagnose # 换机器后先跑它:进程 / git / 文件系统 / hooks 各占多少
|
|
263
284
|
npm run sweep # 给本机找最佳文件级并发(扫 integration 套件)
|
|
264
|
-
npm test # 只跑基础 CLI 与配置矩阵(
|
|
285
|
+
npm test # 只跑基础 CLI 与配置矩阵(98 项)
|
|
265
286
|
npm run test:integration:setup # 安装现代化隔离依赖运行环境
|
|
266
|
-
npm run test:integration # Flat Config、真实 Husky 及提交链路测试(
|
|
287
|
+
npm run test:integration # Flat Config、真实 Husky 及提交链路测试(66 项)
|
|
267
288
|
npm run test:legacy:setup # 安装 ESLint 8 隔离运行环境
|
|
268
289
|
npm run test:legacy # ESLint 8.57.0 兼容性回归测试(27 项)
|
|
269
290
|
npm run test:stylelint17:setup # 安装 Stylelint 17 隔离运行环境
|
|
@@ -276,47 +297,47 @@ npm run test:stylelint17 # Stylelint 17 生态兼容性回归(8 项)
|
|
|
276
297
|
```text
|
|
277
298
|
my-code-style 测试套件
|
|
278
299
|
|
|
279
|
-
▶ [1/4] 基础 CLI 与配置矩阵 (共
|
|
300
|
+
▶ [1/4] 基础 CLI 与配置矩阵 (共 98 项,5 文件 · 3 文件并发(自动:2 核 / 内存 4G))
|
|
280
301
|
✓ 运行器 TAP 解析:统计通过与失败、SKIP 与每用例耗时 · 7ms
|
|
281
302
|
✓ cz 交互提示为中文,且可选类型与 type-enum 一一对应 · 1ms
|
|
282
303
|
✓ peer 范围覆盖我们声明支持的上游大版本(校准防回退,BUG-027) · 0ms
|
|
283
304
|
✓ 一键安装命令对含 || 的版本范围加引号,可整段粘贴执行 · 40ms
|
|
284
305
|
✓ 初始化结尾指引把 cz 用法说清楚(先 git add + 指到 README 手册) · 80ms
|
|
285
306
|
…
|
|
286
|
-
✓ 通过
|
|
307
|
+
✓ 通过 98 · 4.2s · 最慢文件 init-matrix.test.cjs 4.0s
|
|
287
308
|
|
|
288
|
-
▶ [2/4] 现代工具链与提交链 (共
|
|
309
|
+
▶ [2/4] 现代工具链与提交链 (共 66 项,24 文件 · 3 文件并发(自动:2 核 / 内存 4G))
|
|
289
310
|
✓ 完整提交链:JS/TS/Vue/nvue/CSS/less 自动修复及二次复检 · 10.4s
|
|
290
311
|
✓ 发布防呆:HEAD 已有 v* tag 时拦截(此时 release 工具会静默抬版并写出空 CHANGELOG) · 609ms
|
|
291
312
|
…
|
|
292
|
-
✓ 通过
|
|
313
|
+
✓ 通过 66 · 43.8s · 最慢文件 commit-chain-both.test.cjs 11.9s
|
|
293
314
|
|
|
294
315
|
▶ [3/4] ESLint 8 兼容性 (共 27 项,1 文件 · 3 文件并发(自动:2 核 / 内存 4G))
|
|
295
316
|
✓ 独立运行 ESLint 8 支持下限而非 ESLint 9 · 1ms
|
|
296
317
|
✓ ESLint 8 base:实际 CLI 加载生成配置并接受正常文件 · 1.3s
|
|
297
318
|
…
|
|
298
|
-
✓ 通过 27 ·
|
|
319
|
+
✓ 通过 27 · 20.2s
|
|
299
320
|
|
|
300
321
|
▶ [4/4] Stylelint 17 兼容性 (共 9 项,1 文件 · 3 文件并发(自动:2 核 / 内存 4G))
|
|
301
322
|
✓ 隔离环境装的是 stylelint 17(不是 16) · 2ms
|
|
302
323
|
✓ 生成的 .stylelintrc.cjs 在 stylelint 17 下可加载并放过正常 SCSS · 700ms
|
|
303
324
|
…
|
|
304
|
-
✓ 通过 9 ·
|
|
325
|
+
✓ 通过 9 · 8.8s
|
|
305
326
|
|
|
306
327
|
──────────────────────────────────────────────────────
|
|
307
328
|
套件 通过 失败 跳过 用时
|
|
308
329
|
──────────────────────────────────────────────────────
|
|
309
|
-
基础 CLI 与配置矩阵
|
|
310
|
-
现代工具链与提交链
|
|
311
|
-
ESLint 8 兼容性 27 0 -
|
|
312
|
-
Stylelint 17 兼容性 9 0 -
|
|
330
|
+
基础 CLI 与配置矩阵 98 0 - 4.2s
|
|
331
|
+
现代工具链与提交链 66 0 - 43.8s
|
|
332
|
+
ESLint 8 兼容性 27 0 - 20.2s
|
|
333
|
+
Stylelint 17 兼容性 9 0 - 8.8s
|
|
313
334
|
──────────────────────────────────────────────────────
|
|
314
|
-
合计
|
|
335
|
+
合计 200 0 - 77.1s
|
|
315
336
|
──────────────────────────────────────────────────────
|
|
316
337
|
|
|
317
338
|
⏱ 最慢文件:eslint8.test.cjs 18.0s · commit-chain-less.test.cjs 11.4s · commit-chain-both.test.cjs 11.3s
|
|
318
339
|
|
|
319
|
-
✅ 全部通过:
|
|
340
|
+
✅ 全部通过:200/200 项,用时 77.1s
|
|
320
341
|
```
|
|
321
342
|
|
|
322
343
|
终端里每个套件下方还有一条实时进度条(`██████░░░░ 38/66 失败 0 4.0s`)。附加参数:
|
|
@@ -394,7 +415,7 @@ npm run test:all -- --profile # 看每个测试文件耗时,定位瓶颈
|
|
|
394
415
|
| `npm run test:integration`(运行器调度,自动并发 3) | 30.6s(只看集成套件那一段) |
|
|
395
416
|
| 串行套件 + 文件级并发 23(全部一波) | ✗ 3.8G 内存沙箱被 OOM 压垮(19 项 SIGKILL) |
|
|
396
417
|
|
|
397
|
-
同机复测(
|
|
418
|
+
同机复测(200 项,同一台 2 核沙箱连续跑;绝对秒数随机器负载波动,相对关系稳定):默认自动并发 3 = 77.1s、`npm run test:integration` = 43.8s(本轮实跑;串行与 parallel 口径为早前基线实测,相对关系稳定)。
|
|
398
419
|
|
|
399
420
|
(2 核沙箱里并行收益被 CPU 争抢吃掉大半,`--concurrency=1` 时单个文件只要 0.7–4.2s;
|
|
400
421
|
16 核机器上集成套件那段 ≈ 最慢子文件,即"一次真实提交"的量级。)
|
package/bin/doctor
CHANGED
|
@@ -55,15 +55,36 @@ function readManifest() {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
//
|
|
59
|
-
//
|
|
58
|
+
// 从 startDir 逐级向上直读 node_modules/<name>/package.json(纯文件系统,不经过
|
|
59
|
+
// 模块解析)。必须走这条路:ESM-only 包(如 stylelint-config-recommended@18,
|
|
60
|
+
// 下游 1.9.0 实测 BUG-035)的 exports 常常只有 "import" 条件且不暴露
|
|
61
|
+
// "./package.json",CJS require/resolve 双双抛 ERR_PACKAGE_PATH_NOT_EXPORTED,
|
|
62
|
+
// 曾被误判为"未安装"。读文件天然兼容 ESM-only / exports 任意形态 / pnpm 符号链接。
|
|
63
|
+
function findPkgUp(startDir, name) {
|
|
64
|
+
let cur = startDir
|
|
65
|
+
while (true) {
|
|
66
|
+
try {
|
|
67
|
+
return JSON.parse(
|
|
68
|
+
fs.readFileSync(path.join(cur, "node_modules", name, "package.json"), "utf8"),
|
|
69
|
+
)
|
|
70
|
+
} catch {}
|
|
71
|
+
const parent = path.dirname(cur)
|
|
72
|
+
if (parent === cur) return null
|
|
73
|
+
cur = parent
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 读取依赖包版本:文件系统链优先, exotic 布局回退模块解析
|
|
60
78
|
function installedVersion(projectRequire, name) {
|
|
79
|
+
// ① 项目根向上(标准安装);② 本脚本位置向上(npx 临时目录 / monorepo hoisting /
|
|
80
|
+
// pnpm 内部 .pnpm 的真实包经符号链接可达)
|
|
81
|
+
const direct = findPkgUp(PROJECT_ROOT, name) ?? findPkgUp(__dirname, name)
|
|
82
|
+
if (direct?.version) return direct.version
|
|
61
83
|
try {
|
|
62
84
|
return require(`${name}/package.json`).version
|
|
63
85
|
} catch {}
|
|
64
86
|
try {
|
|
65
87
|
const entry = projectRequire.resolve(name)
|
|
66
|
-
// 截掉入口文件取包目录(用 path.dirname;别用正则截第一个分隔符——会得到空串)
|
|
67
88
|
const dir = path.dirname(entry)
|
|
68
89
|
return JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")).version
|
|
69
90
|
} catch {
|
package/bin/init
CHANGED
|
@@ -555,7 +555,55 @@ module.exports = config
|
|
|
555
555
|
`
|
|
556
556
|
}
|
|
557
557
|
|
|
558
|
-
|
|
558
|
+
/**
|
|
559
|
+
* 检测项目源码是否存在显式 .ts/.tsx/.mts/.cts 扩展名 import(下游 1.9.1 实测:
|
|
560
|
+
* Vite 等 bundler resolution 项目大量使用 `import xxx from "@/types/Foo.ts"`,
|
|
561
|
+
* 全部合法,但默认的 import-x/extensions 强制省略扩展名会让 fresh init 直接
|
|
562
|
+
* 报数百个错误)。命中则生成的配置注入兼容段,fresh init 保持"绿起点"。
|
|
563
|
+
*/
|
|
564
|
+
function detectExplicitTsImports() {
|
|
565
|
+
const roots = ["src", "app", "pages", "scripts"].filter((dir) =>
|
|
566
|
+
fs.existsSync(path.resolve(PROJECT_ROOT, dir)),
|
|
567
|
+
)
|
|
568
|
+
const scanRoots = roots.length > 0 ? roots : ["."]
|
|
569
|
+
const exts = new Set([".ts", ".tsx", ".mts", ".cts", ".vue", ".js", ".jsx", ".mjs", ".cjs"])
|
|
570
|
+
const pattern =
|
|
571
|
+
/(?:from\s+|import\s*\(\s*|require\s*\(\s*)["'][^"']+:?[\w@/.-]*\.(?:ts|tsx|mts|cts)["']/
|
|
572
|
+
let scanned = 0
|
|
573
|
+
const walk = (dir) => {
|
|
574
|
+
let entries
|
|
575
|
+
try {
|
|
576
|
+
entries = fs.readdirSync(dir, { withFileTypes: true })
|
|
577
|
+
} catch {
|
|
578
|
+
return false
|
|
579
|
+
}
|
|
580
|
+
for (const entry of entries) {
|
|
581
|
+
if (scanned > 2000) return false
|
|
582
|
+
const full = path.join(dir, entry.name)
|
|
583
|
+
if (entry.isDirectory()) {
|
|
584
|
+
if (
|
|
585
|
+
entry.name === "node_modules" ||
|
|
586
|
+
entry.name === "dist" ||
|
|
587
|
+
entry.name.startsWith(".")
|
|
588
|
+
)
|
|
589
|
+
continue
|
|
590
|
+
if (walk(full)) return true
|
|
591
|
+
} else if (exts.has(path.extname(entry.name))) {
|
|
592
|
+
scanned++
|
|
593
|
+
try {
|
|
594
|
+
if (pattern.test(fs.readFileSync(full, "utf8"))) return true
|
|
595
|
+
} catch {}
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
return false
|
|
599
|
+
}
|
|
600
|
+
for (const root of scanRoots) {
|
|
601
|
+
if (walk(path.resolve(PROJECT_ROOT, root))) return true
|
|
602
|
+
}
|
|
603
|
+
return false
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
function eslintFlatConfigContent(projectType, { compatExplicitTsImports = false } = {}) {
|
|
559
607
|
let importPath = "my-code-style/eslint/flat"
|
|
560
608
|
let varName = "baseConfig"
|
|
561
609
|
if (projectType === "uniapp") {
|
|
@@ -566,11 +614,22 @@ function eslintFlatConfigContent(projectType) {
|
|
|
566
614
|
varName = "vue3Config"
|
|
567
615
|
}
|
|
568
616
|
|
|
617
|
+
const compatBlock = compatExplicitTsImports
|
|
618
|
+
? `,
|
|
619
|
+
// 兼容存量代码:检测到项目存在显式 .ts/.tsx 扩展名 import(Vite 等 bundler
|
|
620
|
+
// resolution 下合法)。降级为 warn:带与不带扩展名都可写、不再报错阻断,
|
|
621
|
+
// 两种写法的"风格不一致"仍会以警告提示,团队可渐进统一;想恢复严格检查
|
|
622
|
+
// (error + 只允许省略)删除此段即可。
|
|
623
|
+
{
|
|
624
|
+
files: ["**/*.{ts,tsx,mts,cts}"],
|
|
625
|
+
rules: { "import-x/extensions": "warn" },
|
|
626
|
+
}`
|
|
627
|
+
: ""
|
|
569
628
|
return `// ESLint Flat Config — powered by my-code-style
|
|
570
629
|
// https://www.npmjs.com/package/my-code-style
|
|
571
630
|
import ${varName} from "${importPath}"
|
|
572
631
|
|
|
573
|
-
export default [...${varName}]
|
|
632
|
+
export default [...${varName}${compatBlock}]
|
|
574
633
|
`
|
|
575
634
|
}
|
|
576
635
|
|
|
@@ -837,6 +896,12 @@ function main() {
|
|
|
837
896
|
console.log(" 保留已有 ESLint 配置,不生成额外入口")
|
|
838
897
|
} else if (useFlatConfig) {
|
|
839
898
|
console.log(" 生成 Flat Config 入口 eslint.config.mjs")
|
|
899
|
+
const compatExplicitTsImports = detectExplicitTsImports()
|
|
900
|
+
if (compatExplicitTsImports) {
|
|
901
|
+
console.log(
|
|
902
|
+
" · 检测到显式 .ts 扩展名 import:已注入兼容段(import-x/extensions 降级为 warn,带/不带扩展名均可写;统一风格时删除该段)",
|
|
903
|
+
)
|
|
904
|
+
}
|
|
840
905
|
files.push({
|
|
841
906
|
path: "eslint.config.mjs",
|
|
842
907
|
exists:
|
|
@@ -844,7 +909,7 @@ function main() {
|
|
|
844
909
|
fileExists("eslint.config.js") ||
|
|
845
910
|
fileExists("eslint.config.ts") ||
|
|
846
911
|
fileExists("eslint.config.cjs"),
|
|
847
|
-
content: eslintFlatConfigContent(projectType),
|
|
912
|
+
content: eslintFlatConfigContent(projectType, { compatExplicitTsImports }),
|
|
848
913
|
})
|
|
849
914
|
} else {
|
|
850
915
|
console.log(" 生成传统格式入口 .eslintrc.cjs")
|
|
@@ -926,10 +991,13 @@ function main() {
|
|
|
926
991
|
stepHeader(3, 6, "配置文件与 Git hooks")
|
|
927
992
|
let overwriteTotal = 0
|
|
928
993
|
let createTotal = 0
|
|
994
|
+
// --merge 下"已存在"的语义是保留而非覆盖,统计与文案必须一致,
|
|
995
|
+
// 否则预览先吓唬人、写入段再改口"保留",前后矛盾(下游 1.9.0 实测)
|
|
996
|
+
const verb = mergeMode ? "保留" : "覆盖"
|
|
929
997
|
for (const f of files) {
|
|
930
998
|
if (f.exists) {
|
|
931
999
|
overwriteTotal++
|
|
932
|
-
console.log(`
|
|
1000
|
+
console.log(` ${verb} ${f.path}`)
|
|
933
1001
|
} else {
|
|
934
1002
|
createTotal++
|
|
935
1003
|
console.log(` 新建 ${f.path}`)
|
|
@@ -951,7 +1019,7 @@ function main() {
|
|
|
951
1019
|
for (const h of hooks) {
|
|
952
1020
|
if (fileExists(h.path)) {
|
|
953
1021
|
overwriteTotal++
|
|
954
|
-
console.log(`
|
|
1022
|
+
console.log(` ${verb} ${h.path}`)
|
|
955
1023
|
} else {
|
|
956
1024
|
createTotal++
|
|
957
1025
|
console.log(` 新建 ${h.path}`)
|
|
@@ -959,7 +1027,7 @@ function main() {
|
|
|
959
1027
|
}
|
|
960
1028
|
|
|
961
1029
|
console.log(
|
|
962
|
-
`
|
|
1030
|
+
` 小计:${verb} ${overwriteTotal} 个 · 新建 ${createTotal} 个` +
|
|
963
1031
|
(backup ? " · 旧文件将备份到 .my-code-style-backup/" : "") +
|
|
964
1032
|
(dryRun ? "(Dry run 预览,不写入)" : ""),
|
|
965
1033
|
)
|
|
@@ -981,11 +1049,13 @@ function main() {
|
|
|
981
1049
|
stepHeader(4, 6, "package.json")
|
|
982
1050
|
if (dryRun) {
|
|
983
1051
|
console.log(
|
|
984
|
-
" · 将更新 scripts(lint / lint:fix / format / prepare / release / cz)与 lint-staged",
|
|
1052
|
+
" · 将更新 scripts(lint / lint:fix / lint:style / lint:all / format / prepare / release / cz)与 lint-staged",
|
|
985
1053
|
)
|
|
986
1054
|
return
|
|
987
1055
|
}
|
|
988
|
-
console.log(
|
|
1056
|
+
console.log(
|
|
1057
|
+
" ✓ scripts 已更新(lint / lint:fix / lint:style / lint:all / format / prepare / release / cz)",
|
|
1058
|
+
)
|
|
989
1059
|
console.log(" ✓ lint-staged 已按检测到的 CSS 预处理器生成")
|
|
990
1060
|
}
|
|
991
1061
|
|
|
@@ -1017,7 +1087,7 @@ function main() {
|
|
|
1017
1087
|
success("Dry run 结束:未写入任何文件;去掉 --dry-run 执行真实初始化")
|
|
1018
1088
|
} else {
|
|
1019
1089
|
success(
|
|
1020
|
-
|
|
1090
|
+
`初始化完成:${verb} ${overwriteTotal} 个 · 新建 ${createTotal} 个 · package.json 已更新`,
|
|
1021
1091
|
)
|
|
1022
1092
|
}
|
|
1023
1093
|
console.log("")
|
|
@@ -1125,7 +1195,6 @@ function main() {
|
|
|
1125
1195
|
// Actually write files
|
|
1126
1196
|
for (const f of files) {
|
|
1127
1197
|
if (mergeMode && snapshot.get(f.path)?.existed) {
|
|
1128
|
-
console.log(` · 保留 ${f.path}(--merge 不覆盖)`)
|
|
1129
1198
|
continue
|
|
1130
1199
|
}
|
|
1131
1200
|
writeFile(f.path, f.content)
|
|
@@ -1137,7 +1206,6 @@ function main() {
|
|
|
1137
1206
|
}
|
|
1138
1207
|
for (const h of hooks) {
|
|
1139
1208
|
if (mergeMode && snapshot.get(h.path)?.existed) {
|
|
1140
|
-
console.log(` · 保留 ${h.path}(--merge 不覆盖)`)
|
|
1141
1209
|
continue
|
|
1142
1210
|
}
|
|
1143
1211
|
writeFile(h.path, h.content)
|
|
@@ -1150,6 +1218,15 @@ function main() {
|
|
|
1150
1218
|
scripts: {
|
|
1151
1219
|
lint: lintCommand,
|
|
1152
1220
|
"lint:fix": `${lintCommand} --fix`,
|
|
1221
|
+
// CI 只跑 pnpm lint 时会漏检 CSS(下游 1.9.0 反馈):给有
|
|
1222
|
+
// 预处理器的项目一个全量 stylelint 入口;ignoreFiles 已在
|
|
1223
|
+
// 配置里排除 node_modules/dist 等,glob 全仓是安全的
|
|
1224
|
+
...(skipStylelint
|
|
1225
|
+
? {}
|
|
1226
|
+
: {
|
|
1227
|
+
"lint:style": 'stylelint "**/*.{vue,nvue,html,css,scss,less}"',
|
|
1228
|
+
"lint:all": `${lintCommand} && stylelint "**/*.{vue,nvue,html,css,scss,less}"`,
|
|
1229
|
+
}),
|
|
1153
1230
|
format: "prettier --write .",
|
|
1154
1231
|
prepare: "husky",
|
|
1155
1232
|
release: "commit-and-tag-version",
|
package/package.json
CHANGED