File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change 2
2
3
3
本工具函数用于编写` nodejs ` 应用时使用,用来操作当前包工程。
4
4
5
- # getProjectRootPath
5
+ ## getProjectRootPath
6
6
7
7
返回当前包工程所在的根路径。
8
8
@@ -13,15 +13,15 @@ function getProjectRootPath(entryPath:string="./",exclueCurrent:boolean=false):s
13
13
- ` getProjectRootPath ` 会从指定的extryPath 开始向上查找` package.json ` 文件
14
14
- ` entryPath ` 默认以当前路径为起点。
15
15
16
- # getPackageJson
16
+ ## getPackageJson
17
17
18
18
返回当前工程的` package.json ` 文件内容
19
19
20
20
` ` ` typescript
21
21
function getPackageJson()
22
22
` ` `
23
23
24
- # getPackageTool
24
+ ## getPackageTool
25
25
26
26
返回当前项目所使用的包管理工具。
27
27
@@ -31,7 +31,7 @@ function getPackageTool():('pnpm' | 'npm' | 'yarn')[]
31
31
32
32
- getPackageTool 通过检查当前工程根目录下是否存在` pnpm-lock.yaml ` 和` yarn.lock ` 来判断当前工程所使用的包管理工具。
33
33
34
- # installPackage
34
+ ## installPackage
35
35
36
36
安装指定的包。
37
37
@@ -53,7 +53,7 @@ async function installPackage(packageName:string,options?:installPackageOptions)
53
53
- 如果安装成功则返回` true ` ,否则返回` false `
54
54
- ` use ` 默认使用` pnpm `
55
55
56
- # packageIsInstalled
56
+ ## packageIsInstalled
57
57
58
58
查询某个包是否已经安装。
59
59
@@ -65,7 +65,7 @@ async function packageIsInstalled(packageName:string,checkGlobal:boolean=false):
65
65
- ` checkGlobal ` 参数用来指定是否在全局进行检查。
66
66
67
67
68
- # updatePackageJson
68
+ ## updatePackageJson
69
69
70
70
更新当前工程的` package.json `
71
71
@@ -165,7 +165,7 @@ const args = process.argv.slice(2)
165
165
})
166
166
` ` `
167
167
168
- # getPackageEntry
168
+ ## getPackageEntry
169
169
170
170
读取包的入口文件,即` main ` 字段值
171
171
You can’t perform that action at this time.
0 commit comments