Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,25 @@
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current",
}
{
"targets": "defaults"
}
],
["@babel/preset-react", {"runtime": "automatic"}]
]
}
],
"env": {
"test": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
["@babel/preset-react", {"runtime": "automatic"}]
]
}
}
}
16 changes: 14 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@
{
"files": ["./src/*.ts"],
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint"]
"plugins": ["@typescript-eslint"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error"
}
},
{
"files": ["demo/**/*"],
"rules": {
"import/no-extraneous-dependencies": ["error", {
"devDependencies": true
}]
}
}
]
]
}
19 changes: 11 additions & 8 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,35 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [18.x, 20.x, 22.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Build
- name: Install & Test
run: |
npm install
npm run ci

- name: React 17/18/19 compat smoke test
run: npm run test:compat

- name: Commit Badges
if: ${{ matrix.node-version == '14.x' }}
uses: stefanzweifel/git-auto-commit-action@v4
if: ${{ github.event_name == 'push' && matrix.node-version == '20.x' }}
uses: stefanzweifel/git-auto-commit-action@v5
with:
push_options: --force
token: ${{ secrets.PAT }}
file_pattern: badges/*.svg
commit_message: Updated Badges
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
node_modules
node_modules
coverage
demo/bundle.js
lib
5 changes: 4 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
src
demo
demo.html
webpack.demo.js
.babelrc
.eslintrc
webpack.config.js
coverage
test
package-lock.json
badges
package-lock.json
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

`<JWPlayer>` is a React Component that creates an instance of JW Player's web player. It allows for the use of any player configuration options and/or event hooks that can be used on the standard player (as props), and provides access to player's API directly via a `componentDidMount` callback.

**Supports React 17, 18, and 19.**

## Contents

Expand All @@ -14,6 +15,7 @@
* [Optional Props](#optional-props)
* [API Functionality](#api-functionality)
* [Advanced Implementation Examples](#advanced-implementation-examples)
* [Development](#development)
* [Contributing](#contributing)

## Installation
Expand Down Expand Up @@ -75,7 +77,7 @@ const playlist = [{
```

## Required Props
These props are required to instantient an instance of JW Player:
These props are required to instantiate an instance of JW Player:

* `library`
* Must be a url to a jwplayer web player library. Required if jwplayer library not already instantiated on page (ie. if window.jwplayer is undefined).
Expand Down Expand Up @@ -302,5 +304,33 @@ class PlayerContainer extends React.Component {
export default PlayerContainer;
```

## Development

Requires **Node.js 18+**.

```shell
# Install dependencies
npm install

# Build the library
npm run build

# Run tests
npm test

# Verify the built lib against React 17, 18, and 19 (requires npm run build first)
npm run test:compat

# Typecheck the shipped TypeScript declarations
npm run test:types

# Lint
npm run lint

# Build and open the demo page
npm run demo
# Then serve the project root (e.g. npx http-server) and open demo.html
```

## Contributing
Post issues, or put up PRs that solve pre-existing issues.
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion coverage/badge.svg

This file was deleted.

67 changes: 0 additions & 67 deletions coverage/clover.xml

This file was deleted.

Loading
Loading