@hyext/config

2.1.7 • Public • Published

hyext config

多个 npm 包都会用到的一些 hyext 工具/配置, export 以下内容:

  • extTypes, 小程序类型列表, 数据结构如下:
interface ExtTypes = Array<{
  extType: string
  platform: 'web' | 'pc' | 'app'
  longName: string
  name: '面板' | '浮窗'
  role: 'audience' | 'streamer'
}>
  • hyextHostInfo, 获取默认的 hostInfo 数据(不经接口获取, 数据可能不是最新)
interface HostInfos Array<{
  hostId: 'huyaext'
  hostName: '虎牙直播'
  hostDesc: null
  extTypes: Array<{
    typeName: string // 虎牙直播APP-面板
    typeTag: string // app_panel
    showType: 'panel' | 'popup'
    runTerminal: 'APP' | 'PC' | 'WEB'
    isAnchor: 0 | 1
    hostId: 'huyaext'
    npmPackageName: string // @hyext/hyext-rn-sdk
  }>
}>
  • getBuildTypes, 弹出TUI界面让开发者选择开发的终端类型
入参 defaults, 小程序类型列表: string[]

返回: Promise<buildTypes>

interface buildTypes Array<{
  extType: string
  platform: string
}>

  • getCliConfig, 获取 @hyext/cli 的配置

@hyext/cli 在磁盘上存储了配置, 目前有用户的token, 当前登录的环境等等

当传入 false 时, 将重置当前环境的 token
getCliConfig(isReset: boolean): CliConfig

interface CliConfig {
  currentEnv: 'prod' | 'test'
  prod: {
    token: string
  }
  test: {
    token: string
  }
}
  • apiFactory
interface Request {
  findExtTypeList4Cli: () => Promise<HostInfos>

  getDeveloperInfo: () => Promise<{
    appId: string
    authorName: string
    authorUid: number
    roomId: number
  }>
}
  • logger

基于 chalk 的 logger 工具

interface Logger {
  error: text => void // red
  warn: text => void // yellow
  info: text => void // cyan
  success: text => void // green
}

Readme

Keywords

none

Package Sidebar

Install

npm i @hyext/config

Weekly Downloads

78

Version

2.1.7

License

ISC

Unpacked Size

21.3 kB

Total Files

7

Last publish

Collaborators

  • hy-ext
  • wundereye
  • maizhiying
  • xiangwang123
  • zhangjiaheng
  • limingyi_100