Skip to content

Commit 5259e1a

Browse files
committed
fix(dsh): 补丁层扫描改用 sort 副本,toSorted 要 Node 20+
CI 矩阵含 Node 18,而 Array.prototype.toSorted 是 Node 20 才有的:上一提交在 ubuntu / windows / macos 三个 job 上都让 dsh 套件挂在 TypeError 上, 4★ 的 dsh-commandcode-quota 仓库同样如此(两处 CI 都红)。 本地 Node 24 跑不出这个问题,改用 [...entries].sort(...) 后两个仓库的 仓库检查都恢复全绿。
1 parent 0a5f288 commit 5259e1a

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎plugins/dsh/quota.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,9 @@ function dshConfigFiles(dshHome, home) {
329329
// 没有 profiles/ 目录的部署(纯 CLI、headless)走不到这里,属正常情况。
330330
continue;
331331
}
332-
for (const entry of entries.toSorted((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0))) {
332+
// Array.prototype.toSorted 要 Node 20+,而 CI 矩阵含 Node 18:排序副本而不是原地排。
333+
const ordered = [...entries].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
334+
for (const entry of ordered) {
333335
// Junction / symlink 也要收:Windows 上的 profile 可能是链接出来的。
334336
if (!entry.isDirectory() && !entry.isSymbolicLink()) continue;
335337
files.push(path.join(profilesDir, entry.name, 'cordis.patch.yml'));

0 commit comments

Comments
 (0)