2.1.7 • Published 8 months ago

@hyext/config v2.1.7

Weekly downloads
11
License
ISC
Repository
-
Last release
8 months ago

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
}
2.1.6

8 months ago

2.1.7

8 months ago

2.1.5

1 year ago

2.1.4

2 years ago

2.1.2

2 years ago

2.1.1

2 years ago

2.1.3

2 years ago

2.1.0

2 years ago

2.0.7

3 years ago

2.0.6

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.2

4 years ago

1.1.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago