2.5.18 • Published 2 years ago

@series-one/toolkit-cliui v2.5.18

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Toolkit Cliui

CLI UI 集合

BACKGROUND

部分构建工具都需要 UI 选择项目,根据选中项目查找相关依赖关系等。 该公共模块主要是提供通用方法,快速接入命令行 UI,并能通过通用函数快速理清依赖关系等。

FEATURE

  • MonoRepo 项目提供 Project 选择 UI 能力。
  • 其他能力待完善
    • 扩展只需要在 options 中扩展选项能力即可。

INSTALL

# local install
$ yarn add --dev @series-one/toolkit-cliui
# global install
$ yarn global add @series-one/toolkit-cliui

USAGE

import { uiSelectProject } from '@series-one/toolkit-cliui'
;(async () => {
  const selected = ['app']
  const include = ['packages/*']
  const exclude = ['test/*']
  const response = await uiSelectProject('请选择需要运行的项目', true, { selected, include, exclude })
  console.log(response)
})()
import { findProjects, graphDependency } from '@series-one/toolkit-cliui'

const projects = await findProjects()
console.log(projects)

const graph = graphDependency(projects)
console.log(graph)

findProjects 并不是使用 yarn workspaces info,而是利用 pacakge.json 去遍历。 如果保证 context 肯定在当前项目中,可以直接 yarn workspaces info 使用场景,如果在 e2e 环境中,yarn workspaces info 会读取测试用例的上下文, 而需要测试的则在另外一个环境中,此时就可以使用 findProjects 利用 context 去变更上下文。当然也可以使用将 spawn 等方法来更改上下文。

CONTRIBUTING

可以通过 Git 对项目进行贡献; 若没有本项目组权限, 项目需要权限申请, 请通过 OA Git 项目权限申请流程进行申请, 用户角色为 Developer

CONTRIBUTORS

2.5.18

2 years ago

2.5.17

2 years ago

2.5.16

2 years ago

2.5.15

2 years ago

2.5.14

2 years ago

2.5.13

2 years ago

2.5.12

2 years ago