Skip to content

Commit

Permalink
✨ feat(generate-code-workspace): 对匹配出来的全部包名,做字母排序。现在生成出来的工作区目录,会先经过一次…
Browse files Browse the repository at this point in the history
…排序。其中 root 根目录不参与排序。
  • Loading branch information
ruan-cat committed Nov 16, 2024
1 parent e89918d commit 3929921
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/generate-code-workspace/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ruan-cat/generate-code-workspace

## 0.2.0

### Minor Changes

- 对匹配出来的全部包名,做字母排序。现在生成出来的工作区目录,会先经过一次排序。其中 root 根目录不参与排序。

## 0.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/generate-code-workspace/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ruan-cat/generate-code-workspace",
"version": "0.1.0",
"version": "0.2.0",
"description": "根据 pnpm-workspace.yaml 配置,生成vscode的code-workspace工作区文件。",
"type": "module",
"main": "./src/index.ts",
Expand Down
10 changes: 10 additions & 0 deletions packages/generate-code-workspace/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ function getVscodeSettings() {
}
}

/**
* 根据名称,做字母排序
*/
function sortFolder(folders: Folder[]) {
return folders.sort((a, b) => a.name.localeCompare(b.name));
}

/**
* 根据 pnpm-workspace.yaml 生成工作区配置数组
* @description
Expand Down Expand Up @@ -151,6 +158,9 @@ function getFolders() {
// }
});

// 获得完目录后,随后对目录做排序
sortFolder(folders);

return folders;
}

Expand Down

0 comments on commit 3929921

Please sign in to comment.