2.0.6 • Published 6 months ago

@aplus-frontend/build-cli v2.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Aplus Build Cli

NPM Version NPM Downloads NPM License

aplus构建拉取应用脚本,三条线的业务应用会在构建阶段,合并拉取成一个发布应用。

提示:构建应用需要使用该脚本,业务应用不需要。

安装

pnpm add @aplus-frontend/build-cli -D -w

使用

// 构建应用中
// 根路径下的 scripts/build
import { buildAllApp } from "@aplus-frontend/build-cli";
import { execSync } from "child_process";
async function bootstrap() {
  // 拉取远程业务应用代码并构建
  await buildAllApp("master", () => {
    execSync(`pnpm build`, {
      stdio: "inherit",
      encoding: "utf8",
    });
  });
}
bootstrap();

配置文件

为了避免频繁的输入操作,可以在项目根目录下配置.aplus-build-rc文件,接收一个json配置。

以下是一个例子:

{
  "subAppRemoteAddress": {
    "subapp-mos": "https://xxx/frontend/aplus-user-group/aplus-user-mos.git",
    "subapp-wms": "https://xxx/frontend/aplus-user-group/aplus-user-wms.git",
    "subapp-bms": "https://xxx/frontend/aplus-user-group/aplus-user-bms.git"
  }
}
配置参数配置值描述类型
subAppRemoteAddress业务应用对应的远程地址映射,key作为在发布应用中生成的文件夹名字,value是远程拉取业务应用的地址Record<string, string>

方法

buildAllApp

类型: function buildAllApp(branchName?: string, afterBuild?: () => void): Promise<void>

描述: 该函数会遍历配置文件中的所有子应用名称和对应的远程仓库地址,依次拉取代码并复制到目标目录

参数

参数类型默认描述
branchNamestringmaster分支名字
afterBuild() => void-远程拉取全部业务应用并拷贝之后的回调函数

buildOneApp

类型: function buildOneApp(subAppName: string, branchName: string, repoUrl: string, afterBuild?: () => void): Promise<void>;

描述: 该函数会拉取指定子应用的代码并复制到目标目录

参数

参数类型默认描述
subAppNamestring-业务应用名称
branchNamestring-分支名字
repoUrlstring-远程仓库地址,推荐https格式
afterBuild() => void-远程拉取业务应用并拷贝之后的回调函数
2.0.6

6 months ago

2.0.5

7 months ago

2.0.4

7 months ago

2.0.3

7 months ago

2.0.2

7 months ago

2.0.1

7 months ago

2.0.0

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago