@mlz/video
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

Player

    <Player
        ref={videoRef}
        src={videoUrl}
        onPause={handleVideoonPause}
        onPlay={handleVideoPlay}
        poster={videoImgUrl}
        onTouch={handleVideoTouch}
        progressStyle={fullscreen ? {} : progressStyle}
        fullscreen={fullscreen}
    />
    // 系统全屏,进入全屏后ui和交互不可控
    // 且退出全屏后,不一定都能监听到退出事件,onSystemFullscreen不一定都护触发
    <Player
        className="back"
        ref={videoRef2}
        src={videoUrl}
        onPause={handleVideoonPause}
        onPlay={handleVideoPlay}
        poster={videoImgUrl}
        onTouch={handleVideoTouch}
        hasSystemFullscreen
        onSystemFullscreen={handleSystemFullscreen}
    />    

npm库模版

使用npm模版来使得开发库更简单,不用自己搭建开发环境的配置库的打包。

特性

  • 零配置, 在npm install之后使用postinstall钩子运行init脚本设置库的名字用于发布和打包
  • 使用rollup来打包为umdcommonjs两种形式
  • 集成jest来做单元测试
  • 使用@mlz/lint来规范代码风格
  • 使用standard-version自动发布生成版本号和生成changelog
  • 配置了github actions来在代码push到master时候自动发布npm包

开发

npm run start: rollup -c rollup.config.js -w & npm run example 使用rollup来打包库的源文件到dist文件夹下,运行npm run example启动一个react项目来调试。

测试

  1. test: jest跑项目中的所有测试文件,并输出测试覆盖率
  2. test:watch: watch模式
  3. test:prod: 推到远程仓库前执行test

打包和输出

npm run build

dist
├── lib //commonjs版本,webpack等打包工具使用
│   └── pkgName.js
├── types //类型定义
│   └── index.d.ts
└── umd //umd版本,可直接使用script标签引入
    └── pkgName.js

注::使用package.json中的files文件来代替.npmignore

发布

  1. 本地运行npm run release更新版本号和自动生成CHANGELOG.md
  2. git push推送代码到master分支。触发npmpublishaction,会自动运行build test:prod然后执行npm publish 所以开发流程应该是在特性分支进行开发,合并到master分支的触发github action进行自动发版。

注意 需要配置自己的仓库的secrets.npm_token.github/workflows/npmpublish.yml中,配置路径为settings中的secrets。

Package Sidebar

Install

npm i @mlz/video

Weekly Downloads

2

Version

1.2.2

License

MIT

Unpacked Size

81.3 kB

Total Files

20

Last publish

Collaborators

  • tianxing0923
  • minyillee
  • milobluebell
  • webyom
  • fukai
  • tang-tang