Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 21 additions & 18 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ on:
required: true
description: Version
options:
- conventional
- patch
- minor
- major
- prerelease
- from-package
- from-git
- conventional
- patch
- minor
- major
- prerelease
- from-package
- from-git
prerelease:
type: choice
description: Pre-release
options:
-
- canary
- beta
-
- canary
- beta
dryrun:
description: 'Dry-run'
type: boolean
Expand All @@ -44,20 +44,23 @@ jobs:
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-node@v4
- uses: pnpm/action-setup@v6.1.0
- uses: actions/setup-node@v5
with:
node-version: 20
node-version-file: '.node-version'
cache: pnpm
# this line is required for the setup-node action to be able to run the npm publish below.
registry-url: 'https://registry.npmjs.org'
- uses: fregante/setup-git-user@v1
- run: npm ci
- run: npm run lint
- run: npm run test:coverage
- run: npm run build
- run: npm run build:demo
- run: pnpm install --frozen-lockfile
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm test:coverage
- run: pnpm build
- run: pnpm build:demo
- run: npx --yes wet-run@1.0.1 release ${{ inputs.version }} ${{ inputs.dryrun && '--dry-run' || '' }} ${{ inputs.prerelease && format('--prerelease {0}', inputs.prerelease) || '' }} --provenance --github-release --verbose
- name: Get NPM version
id: npm-version
Expand Down
106 changes: 56 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,76 @@
name: Node.js CI
name: CI

on: [push, pull_request]

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6.1.0
- uses: actions/setup-node@v5
with:
node-version-file: '.node-version'
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm lint

typecheck:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run lint
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6.1.0
- uses: actions/setup-node@v5
with:
node-version-file: '.node-version'
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm typecheck

test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run test:coverage
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6.1.0
- uses: actions/setup-node@v5
with:
node-version-file: '.node-version'
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm test:coverage

build:
runs-on: ubuntu-latest

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

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm run build
- run: npm run build:demo
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v6.1.0
- uses: actions/setup-node@v5
with:
node-version-file: '.node-version'
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm build
- run: pnpm build:demo

deploy-preview:
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

environment:
name: github-preview
Expand All @@ -74,14 +79,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v4
- uses: actions/setup-node@v4
- uses: actions/checkout@v5
- uses: actions/configure-pages@v5
- uses: pnpm/action-setup@v6.1.0
- uses: actions/setup-node@v5
with:
node-version: 20
- run: npm ci
- run: npm run build
- run: npm run build:demo
node-version-file: '.node-version'
cache: pnpm
- run: pnpm install --frozen-lockfile --prefer-offline
- run: pnpm build:demo
- uses: actions/upload-pages-artifact@v3
with:
path: './demo'
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ yarn-error.log
.vscode/
/disttest/
/dist/
tsconfig.tsbuildinfo
*.tsbuildinfo
.vite-hooks/_/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.14.0
1 change: 1 addition & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vp staged
21 changes: 12 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,35 @@

Thanks for contributing to ReactPlayer!

This project uses [pnpm](https://pnpm.io) and [Vite+](https://viteplus.dev) (`vp`) for building, testing, linting and formatting. The Node version is pinned in `.node-version`.

Running the demo locally is relatively easy:

```bash
git clone https://github.com/CookPete/react-player.git
cd react-player
npm install # or yarn
npm start
open http://localhost:3000
pnpm install
pnpm start
```

## `dist` files

There is **no need** to build or commit files in `dist` after making changes. The `dist` files are only there for [bower](http://bower.io) support, and there is very little point in polluting every commit or pull request with the changes. The `dist` files will be automatically built and committed when new versions are released, so your changes will be included then.
There is **no need** to build or commit files in `dist` after making changes. The `dist` files will be automatically built when new versions are released, so your changes will be included then.

## Linting
## Linting and formatting

This project uses [standard](https://github.com/feross/standard) code style. Be sure to lint the code after making changes and fix any issues that come up.
Code is linted with Oxlint and formatted with Oxfmt via Vite+. A pre-commit hook runs `vp staged` to fix staged files automatically.

```bash
npm run lint
pnpm lint # check formatting and lint
pnpm lint:fix # fix formatting and lint issues
pnpm typecheck
```

## Testing

This project uses [karma](https://karma-runner.github.io) with [mocha](https://github.com/mochajs/mocha) and [chai](https://github.com/chaijs/chai) for testing in the browser. Be sure to test `ReactPlayer` after making changes and, if you’re feeling generous, add some tests of your own.
This project uses [Vitest](https://vitest.dev) via `vp test`. Be sure to test `ReactPlayer` after making changes and, if you’re feeling generous, add some tests of your own.

```bash
npm test
pnpm test
```
Loading
Loading