@ruan-cat/vitepress-preset-config 3.1.0 → 3.1.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/dist/config.mjs CHANGED
@@ -60,22 +60,7 @@ function copyReadmeMd(target) {
60
60
  import fs2 from "fs";
61
61
  import path2 from "path";
62
62
  import consola2 from "consola";
63
- function findMonorepoRoot() {
64
- let currentDir = process.cwd();
65
- const root = path2.parse(currentDir).root;
66
- while (currentDir !== root) {
67
- const workspaceFile2 = path2.join(currentDir, "pnpm-workspace.yaml");
68
- if (fs2.existsSync(workspaceFile2)) {
69
- return currentDir;
70
- }
71
- currentDir = path2.dirname(currentDir);
72
- }
73
- const workspaceFile = path2.join(root, "pnpm-workspace.yaml");
74
- if (fs2.existsSync(workspaceFile)) {
75
- return root;
76
- }
77
- return null;
78
- }
63
+ import { findMonorepoRoot } from "@ruan-cat/utils/node-esm";
79
64
  function resolveRootDir(rootDir) {
80
65
  if (rootDir) {
81
66
  return path2.resolve(process.cwd(), rootDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruan-cat/vitepress-preset-config",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "用于给大多数的vitepress项目提供一个预设的配置文件。",
5
5
  "homepage": "https://vitepress-preset.ruancat6312.top",
6
6
  "types": "./src/config.mts",
@@ -8,24 +8,24 @@
8
8
  "dependencies": {
9
9
  "@leelaa/vitepress-plugin-extended": "^1.0.7",
10
10
  "@nolebase/vitepress-plugin-git-changelog": "^2.18.2",
11
- "@shikijs/vitepress-twoslash": "^3.15.0",
11
+ "@shikijs/vitepress-twoslash": "^3.23.0",
12
12
  "consola": "^3.4.2",
13
13
  "gray-matter": "^4.0.3",
14
- "lodash-es": "^4.17.21",
14
+ "lodash-es": "^4.17.23",
15
15
  "markdown-it-async": "^2.2.0",
16
16
  "markdown-it-mathjax3": "^4.3.2",
17
- "vitepress-demo-plugin": "^1.5.0",
18
- "vitepress-plugin-llms": "^1.10.0",
19
- "vitepress-sidebar": "^1.33.0",
20
- "vitepress-theme-teek": "^1.5.2",
21
- "vue": "^3.5.24",
22
- "@ruan-cat/utils": "^4.20.0"
17
+ "vitepress-demo-plugin": "^1.5.1",
18
+ "vitepress-plugin-llms": "^1.11.0",
19
+ "vitepress-sidebar": "^1.33.1",
20
+ "vitepress-theme-teek": "^1.5.5",
21
+ "vue": "^3.5.30",
22
+ "@ruan-cat/utils": "^4.22.0"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/lodash-es": "^4.17.12",
26
26
  "automd": "^0.4.3",
27
- "element-plus": "^2.11.7",
28
- "tsup": "^8.5.0",
27
+ "element-plus": "^2.13.5",
28
+ "tsup": "^8.5.1",
29
29
  "vitepress": "^1.6.4"
30
30
  },
31
31
  "peerDependencies": {
@@ -1,40 +1,13 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import consola from "consola";
4
+ import { findMonorepoRoot } from "@ruan-cat/utils/node-esm";
4
5
 
5
6
  /**
6
7
  * Claude 文件夹名称类型
7
8
  */
8
9
  export type ClaudeFolderName = "agents" | "commands" | "skills";
9
10
 
10
- /**
11
- * 从当前工作目录向上查找 monorepo 根目录
12
- * @returns monorepo 根目录的绝对路径,如果找不到则返回 null
13
- * @description
14
- * 通过查找 pnpm-workspace.yaml 文件来定位 monorepo 根目录。
15
- * 从 process.cwd() 开始向上遍历,直到找到该文件或到达文件系统根目录。
16
- */
17
- function findMonorepoRoot(): string | null {
18
- let currentDir = process.cwd();
19
- const root = path.parse(currentDir).root;
20
-
21
- while (currentDir !== root) {
22
- const workspaceFile = path.join(currentDir, "pnpm-workspace.yaml");
23
- if (fs.existsSync(workspaceFile)) {
24
- return currentDir;
25
- }
26
- currentDir = path.dirname(currentDir);
27
- }
28
-
29
- // 检查根目录本身
30
- const workspaceFile = path.join(root, "pnpm-workspace.yaml");
31
- if (fs.existsSync(workspaceFile)) {
32
- return root;
33
- }
34
-
35
- return null;
36
- }
37
-
38
11
  /**
39
12
  * 解析根目录路径
40
13
  * @param rootDir - 根目录路径,支持相对路径(如 `../../../`)或绝对路径