Skip to content

API 参考 / @142vip/utils / VipNpm

变量: VipNpm ​

const VipNpm: object

定义于: packages/utils/src/core/npm.ts:354

类型声明 ​

formatCiPnpmInstallCommand ​

formatCiPnpmInstallCommand: (args) => string

fa ci 的安装命令:始终 --frozen-lockfile --force。 pnpm i --registry <url> --frozen-lockfile --force [--ignore-scripts] [extra]

参数 ​

args ​
extraArgs? ​

string | readonly string[]

ignoreScripts? ​

boolean

registry ​

string

返回 ​

string

formatVersionStr ​

formatVersionStr: (template, newVersion) => string

接受版本字符串模板(例如“release v”或“This is the %s release”)。

  • 如果模板包含任何“%s”占位符,则它们将替换为版本号;
  • 否则,版本号将追加到字符串

参数 ​

template ​

string

newVersion ​

string

返回 ​

string

getCorepackVersion ​

getCorepackVersion: () => Promise<string | null>

返回 ​

Promise<string | null>

getNodeVersion ​

getNodeVersion: () => Promise<string | null>

获取node版本

返回 ​

Promise<string | null>

getNpmVersion ​

getNpmVersion: () => Promise<string | null>

获取npm版本

返回 ​

Promise<string | null>

getPackageJSONByPnpm ​

getPackageJSONByPnpm: (pnpmLsCommand) => PackageJSONWithPath[]

获取pnpm ls命令执行后的结果,并返回一个PackageJSON 参考:

参数 ​

pnpmLsCommand ​

string

返回 ​

PackageJSONWithPath[]

getPnpmVersion ​

getPnpmVersion: () => Promise<string | null>

返回 ​

Promise<string | null>

getTurboPackApps ​

getTurboPackApps: () => Promise<string[]>

获取TurboPack匹配到的所有apps

返回 ​

Promise<string[]>

getTurboPackVersion ​

getTurboPackVersion: () => Promise<string | null>

返回 ​

Promise<string | null>

installByNpm ​

installByNpm: (args) => Promise<void>

参数 ​

args ​
cwd? ​

string

force? ​

boolean

ignoreScripts? ​

boolean

registry? ​

string

返回 ​

Promise<void>

installByPnpm ​

installByPnpm: (args) => Promise<void>

参数 ​

args ​
corepackNpmRegistry? ​

string

无 pnpm 时经 corepack 启用

cwd? ​

string

force? ​

boolean

ignoreScripts? ​

boolean

registry? ​

string

返回 ​

Promise<void>

installForCi ​

installForCi: (options) => Promise<void>

对齐 fa ci:打印命令与 COREPACK_REGISTRY,确保 corepack / pnpm,再执行 pnpm i --registry <url> --frozen-lockfile --force。

参数 ​

options? ​

VipNpmCiInstallOptions = {}

返回 ​

Promise<void>

isExistNodeJs ​

isExistNodeJs: () => Promise<boolean>

返回 ​

Promise<boolean>

isExistNpm ​

isExistNpm: () => Promise<boolean>

返回 ​

Promise<boolean>

isExistPnpm ​

isExistPnpm: () => Promise<boolean>

返回 ​

Promise<boolean>

isExistTurboPack ​

isExistTurboPack: () => Promise<boolean>

返回 ​

Promise<boolean>

logInstallToolchain ​

logInstallToolchain: () => Promise<void>

本地 fa i 前输出工具链版本(Node / npm / corepack / pnpm)。

返回 ​

Promise<void>

userLogin ​

userLogin: (args) => Promise<void>

参数 ​

args ​
registry ​

string

返回 ​

Promise<void>