node-esm
接口
MoveVercelOutputToRootOptions
定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:7
属性
| 属性 | 类型 | 描述 | 定义于 |
|---|---|---|---|
cwd? | string | 运行目录。 默认值为 process.cwd()。 | node-esm/scripts/move-vercel-output-to-root/index.ts:12 |
dryRun? | boolean | 仅打印解析结果,不实际复制文件。 默认值 false | node-esm/scripts/move-vercel-output-to-root/index.ts:48 |
rootDir? | string | monorepo 根目录。 不传时会从 cwd 开始,向上查找 pnpm-workspace.yaml。 | node-esm/scripts/move-vercel-output-to-root/index.ts:18 |
skipClean? | boolean | 是否跳过目标目录清理。 默认值 false | node-esm/scripts/move-vercel-output-to-root/index.ts:41 |
sourceDir? | string | 子包内构建产物目录。 相对路径基于 cwd 解析。 默认值 ".vercel/output" | node-esm/scripts/move-vercel-output-to-root/index.ts:26 |
targetDir? | string | monorepo 根目录内的目标输出目录。 相对路径基于 monorepo 根目录解析。 默认值 ".vercel/output" | node-esm/scripts/move-vercel-output-to-root/index.ts:34 |
MoveVercelOutputToRootResult
定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:60
继承
属性
PackageInfo
定义于: node-esm/ruan-cat-pkg-info.ts:4
包的信息
属性
| 属性 | 类型 | 描述 | 定义于 |
|---|---|---|---|
description | string | 包的描述 | node-esm/ruan-cat-pkg-info.ts:8 |
name | string | 包名 | node-esm/ruan-cat-pkg-info.ts:6 |
url | `https://npm.im/${string}` | 带有包名的官方镜像源地址 | node-esm/ruan-cat-pkg-info.ts:10 |
ResolvedMoveVercelOutputToRootOptions
定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:51
继承于
属性
| 属性 | 类型 | 定义于 |
|---|---|---|
cwd | string | node-esm/scripts/move-vercel-output-to-root/index.ts:52 |
dryRun | boolean | node-esm/scripts/move-vercel-output-to-root/index.ts:57 |
monorepoRoot | string | node-esm/scripts/move-vercel-output-to-root/index.ts:53 |
skipClean | boolean | node-esm/scripts/move-vercel-output-to-root/index.ts:56 |
sourceDir | string | node-esm/scripts/move-vercel-output-to-root/index.ts:54 |
targetDir | string | node-esm/scripts/move-vercel-output-to-root/index.ts:55 |
WriteYaml2mdParams
类型参数
| 类型参数 | 默认类型 |
|---|---|
T | Record<string, any> |
属性
| 属性 | 类型 | 描述 | 定义于 |
|---|---|---|---|
data | T | 被插入到md头部的数据 | node-esm/yaml-to-md.ts:12 |
mdPath | string | 目标md文件地址 | node-esm/yaml-to-md.ts:9 |
类型别名
WorkspacePackageInfo
type WorkspacePackageInfo = Required<Pick<PackageJson, "name" | "version">>;定义于: node-esm/scripts/relizy-runner/index.ts:13
发版基线 tag 校验所需的最小字段,由 PackageJson 派生。
变量
defaultCleanTargets
const defaultCleanTargets: readonly ["node_modules", "yarn.lock", "pnpm-lock.yaml", "package-lock.json", "dist", ".turbo", ".vercel", ".cache", ".temp"];定义于: node-esm/scripts/clean.ts:5
函数
buildBootstrapInstructions()
function buildBootstrapInstructions(missingPackages): string;定义于: node-esm/scripts/relizy-runner/index.ts:191
根据缺少基线 tag 的包列表,生成包含补打 tag 命令的提示文本。
参数
| 参数 | 类型 |
|---|---|
missingPackages | Required<Pick<PackageJson, "name" | "version">>[] |
返回
string
clean()
function clean(targets?): Promise<void>;定义于: node-esm/scripts/clean.ts:28
删除node项目的依赖项便于重新安装依赖,也包括常见的各种垃圾文件。
参数
| 参数 | 类型 | 描述 |
|---|---|---|
targets? | string[] | 被清除的目标文件夹 也包括文件 |
返回
Promise<void>
Description
ensureRelizyShellEnv()
function ensureRelizyShellEnv():
| {
PATH: string;
}
| {
[key: string]: string | undefined;
};定义于: node-esm/scripts/relizy-runner/index.ts:126
确保 relizy 所需的 GNU 工具(grep / head / sed)在 PATH 中可用。
Windows 下会自动补齐 Git for Windows 的 usr\bin 路径。
返回
| {PATH: string;
}
| {
[key: string]: string | undefined;
}
getMoveVercelOutputToRootHelpText()
function getMoveVercelOutputToRootHelpText(): string;定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:240
CLI 帮助信息。
返回
string
getRelizyRunnerHelpText()
function getRelizyRunnerHelpText(): string;定义于: node-esm/scripts/relizy-runner/index.ts:214
获取 relizy-runner CLI 的帮助文本。
返回
string
getRuanCatPkgInfo()
function getRuanCatPkgInfo(): Promise<PackageInfo[]>;定义于: node-esm/ruan-cat-pkg-info.ts:23
获得阮喵喵全部的包信息
返回
Promise<PackageInfo[]>
Description
这是一个node环境下的函数,用于获取阮喵喵的所有包的信息。
使用的是node的child_process模块,调用pnpm命令获取包信息。
- 默认仅考虑pnpm包
- 在node环境下运行
getWorkspacePackages()
function getWorkspacePackages(workspaceRoot?): Required<Pick<PackageJson, "name" | "version">>[];定义于: node-esm/scripts/relizy-runner/index.ts:24
解析根目录 pnpm-workspace.yaml 并展开 glob 模式,
收集所有含 package.json 的子包目录,返回其 name 与 version。
使用 pnpm-workspace-yaml
解析工作区清单,再用 pkg-types 的 PackageJson 约束子包字段。
参数
| 参数 | 类型 |
|---|---|
workspaceRoot? | string |
返回
Required<Pick<PackageJson, "name" | "version">>[]
moveVercelOutputToRoot()
function moveVercelOutputToRoot(options?): MoveVercelOutputToRootResult;定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:145
将当前子包内的 .vercel/output 移动到 monorepo 根目录。
参数
| 参数 | 类型 |
|---|---|
options | MoveVercelOutputToRootOptions |
返回
Description
该函数服务于 Vercel 在 monorepo 场景下的部署:
- 构建仍在子包目录内执行
- 产物默认出现在子包的
.vercel/output - Vercel 却要求在 monorepo 根目录下读取
.vercel/output
parseMoveVercelOutputToRootCliArgs()
function parseMoveVercelOutputToRootCliArgs(args): MoveVercelOutputToRootOptions & {
help?: boolean;
};定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:192
解析命令行参数。
参数
| 参数 | 类型 |
|---|---|
args | string[] |
返回
MoveVercelOutputToRootOptions & {help?: boolean;
}
parseRelizyRunnerCliArgs()
function parseRelizyRunnerCliArgs(args): {
help: boolean;
relizyArgs: string[];
};定义于: node-esm/scripts/relizy-runner/index.ts:318
解析 relizy-runner CLI 参数。
如果首个参数是 --help 或 -h,返回 { help: true }。
否则将所有参数透传给 relizy。
参数
| 参数 | 类型 |
|---|---|
args | string[] |
返回
{
help: boolean;
relizyArgs: string[];
}| 名称 | 类型 | 定义于 |
|---|---|---|
help | boolean | node-esm/scripts/relizy-runner/index.ts:318 |
relizyArgs | string[] | node-esm/scripts/relizy-runner/index.ts:318 |
resolveMoveVercelOutputToRootOptions()
function resolveMoveVercelOutputToRootOptions(options?): ResolvedMoveVercelOutputToRootOptions;定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:99
解析脚本所需的全部路径。
参数
| 参数 | 类型 |
|---|---|
options | MoveVercelOutputToRootOptions |
返回
ResolvedMoveVercelOutputToRootOptions
runMoveVercelOutputToRootCli()
function runMoveVercelOutputToRootCli(args?): void;定义于: node-esm/scripts/move-vercel-output-to-root/index.ts:257
执行 CLI。
参数
| 参数 | 类型 |
|---|---|
args | string[] |
返回
void
runRelizyRunner()
function runRelizyRunner(relizyArgs): number;定义于: node-esm/scripts/relizy-runner/index.ts:266
执行 relizy-runner。
参数
| 参数 | 类型 | 描述 |
|---|---|---|
relizyArgs | string[] | 透传给 relizy 的子命令与参数 |
返回
number
退出码
Description
在 relizy 执行前做两件事:
- Windows 下自动补齐 Git for Windows 的
usr\bin路径,避免 relizy 内部调用grep/head/sed失败。 - 在
release/bump前校验 independent 基线 tag,缺失时打印补打命令并终止。
runRelizyRunnerCli()
function runRelizyRunnerCli(args?): void;定义于: node-esm/scripts/relizy-runner/index.ts:329
执行 relizy-runner CLI。
参数
| 参数 | 类型 |
|---|---|
args | string[] |
返回
void
shouldCheckIndependentBootstrap()
function shouldCheckIndependentBootstrap(relizyArgs): boolean;定义于: node-esm/scripts/relizy-runner/index.ts:178
判断当前 relizy 子命令是否需要检查 independent 基线 tag。
仅 release 与 bump 需要。
参数
| 参数 | 类型 |
|---|---|
relizyArgs | string[] |
返回
boolean
writeYaml2md()
function writeYaml2md<T>(params): void;定义于: node-esm/yaml-to-md.ts:20
将YAML数据写入到MD文件内
类型参数
| 类型参数 |
|---|
T |
参数
| 参数 | 类型 |
|---|---|
params | WriteYaml2mdParams<T> |
返回
void
已被弃用
请使用 gray-matter 库来实现相关的更改,不使用 writeYaml2md 函数了。
参考
findMonorepoRoot
重新导出 findMonorepoRoot
isMonorepoProject
重新导出 isMonorepoProject