node package manager
Easy sharing. Manage teams and permissions with one click. Create a free org »

onlywatch

onlywatch NPM version

web player core project

Installation

For npm user

$ npm install --save onlywatch

For yarn user

$ yarn add onlywatch

Usage

var createVideoJsPlayer = require('onlywatch');
 
var player = createVideoJsPlayer(VIDEO_ID, 'hlsjs', VIDEO_OPTIONS);

By using import

import createVideoJsPlayer from 'onlywatch'
 
var player = createVideoJsPlayer(VIDEO_ID, 'hlsjs', VIDEO_OPTIONS)

Development Locally

$ yarn run dev        # to start compiler and watching 
$ yarn run dev:server # to start local http server that include some 
                      # basic html and script to render the player. 

Development by module link

For jspm user

  • do some changes, run webpack --progress, commit them
  • modify package.json to upgrade the version property
  • run jspm link npm:onlywatch -y
  • go the package that used onlywatch, and run jspm install npm:onlywatch --link

For yarn user

  • do some changes, run webpack --progress, commit them
  • modify package.json to upgrade the version property
  • run yarn link in onlywatch package
  • go the package that used onlywatch, and run yarn link onlywatch

Deploy Flow

  • do NOT change version property that in package.json (will update automatically)

  • do NOT change CHANGELOG.md (will update automatically)

  • do NOT add tag (will add automatically)

  • do some changes, commit they, following Commit Message Guidelines

  • do yarn run build and commit it with message chore: build dist (this can be done by run yarn run commit-dist)

  • change to branch: master then do yarn run changelog

    According to the content of commit, if have feat commits, will bump minor version. If bugfixs commits only, will bump patch version. If commit have BREAKING CHANGE, will bump major version.

  • do git push --follow-tags origin master and npm publish

Step 1. Build and Publish

$ yarn run pre-publish
$ git push --follow-tags origin master; npm publish

These commands will

  • build dist files
  • commit changelog
  • push to gitlab
  • publish to npm

Step 2. Deploy to GCS

$ yarn deploy -- [-e {staging|rc|production}] [-r] [-s]
  • -e: environment
  • -r: redirect to latest version
  • -s: skip build dist (if you already did yarn publish before, than you can skip build dist)

for example, deploy to staging with redirect to latest version and skip build

$ yarn deploy -- -e=staging -r -s

Step 3. Redirect to Latest Version

Sometimes we don't want to redirect immediately after deploy. When you only want to redirect to certain version of player, you can use this command.

Default is redirect to current version in package.json.

$ yarn deploy:redirect -- [-e {staging|rc|production}] [-v {$version}]

for example, redirect latest version to 6.21.4 on rc

$ yarn deploy:redirect -- -e rc -v 6.21.4

Path to player assets

player assets will be deployed to google cloud storage and can be accessed by https://${straas-app-host}/player/.*

for example on staging, entries of latest version assets will be

https://app-staging.straas.net/player/player.js
https://app-staging.straas.net/player/player.css

and entries for versioning assets (for example 6.21.4) will be

https://app-staging.straas.net/player/6.21.4/standard/player.bundle.js
https://app-staging.straas.net/player/6.21.4/standard/player.bundle.css

License

ISC © ikala frontend team