Skip to content

Commit

Permalink
chore: monorepo setup (#18)
Browse files Browse the repository at this point in the history
* chore: remove docusaurus temp

* chore: add pull request template

* chore: add issue templates

* chore: update continuous github workflow

* chore: add eslint config

* chore: add pre-commit, pre-push and commit-msg git hooks

* chore: add .nx to .gitinore

* chore: update lint staged rc

* chore: add top-level changelog.md placeholder

* chore: upd jest.config.js

* chore: update package*.json

* chore: add jest eslit configs

* chore: remove legacy eslitrc.json

* chore: add comment about globster.xyz

* chore: update nx configuration

* chore: fix lint issues in hls-parser

* chore: add rollup base config

* chore: update hls package json

* chore: update rollup config, add bundlesize generation and verification

* chore: add typedoc support

* chore: add verify bundle size to ci

* chore: add release updates

* chore: add nx release list of projects

* chore: add release workflow

* chore: update dash-parser scripts

* chore: update playback scripts

* chore: add clean install script

* chore: migrate to vitest

* chore: include only src folder for coverage

---------

Co-authored-by: Dzianis Dashkevich <ddashkevich@brightcove.com>
  • Loading branch information
dzianis-dashkevich and Dzianis Dashkevich authored Sep 5, 2024
1 parent d4da952 commit e016531
Show file tree
Hide file tree
Showing 107 changed files with 9,940 additions and 20,297 deletions.
51 changes: 0 additions & 51 deletions .eslintrc.json

This file was deleted.

96 changes: 96 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Bug Report
description: Bug report
labels: [Bug, Needs Triage]
body:
- type: markdown
attributes:
value: |
Thank you for using Video.js and contributing by opening an issue. Before you start, please check this list:
- type: checkboxes
id: checklist
attributes:
label: Checklist
options:
- label: The issue observed is not already reported by searching on Github under https://github.com/videojs/monorepo/issues
required: true
- label: The issue occurs in the latest version of the package on <tbd-demo-app>
required: true
- type: dropdown
id: package
attributes:
label: Package
description: Select a package for which you want to report a bug
options:
- @videojs/playback
- @videojs/hls-parser
- @videos/dash-parser
- videojs.dev
default: 0
validations:
required: true
- type: input
id: version
attributes:
label: What version of the package are you using?
placeholder: e.g. vX.Y.Z
validations:
required: true
- type: input
id: browser
attributes:
label: What browser are you using? (please, including version)
placeholder: e.g. Chrome 128.0.6613.85 (Official Build) (arm64)
validations:
required: true
- type: input
id: os
attributes:
label: What operation system are you using? (please, including version)
placeholder: e.g. MacOS 14.6.1 (23G93)
validations:
required: true
- type: input
id: stream
attributes:
label: Test stream
description: If possible, please provide a test stream. (While this is optional, we highly recommend providing a test stream since it will help us to find the root cause faster. Please, make sure that the stream does not have network or CORS issues)
validations:
required: false
- type: textarea
id: configuration
attributes:
label: Configuration
description: Please provide the package's configuration. (if applicable)
value: '{}'
render: JavaScript
validations:
required: false
- type: textarea
id: description
attributes:
label: Description of the issue
description: Please give a detailed description of the issue.
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to reproduce
description: Please provide clear steps to reproduce your problem. If the bug is intermittent, give a rough frequency.
value: |
1.
2.
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected behaviour
validations:
required: true
- type: textarea
id: actual
attributes:
label: What actually happened?
validations:
required: true
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Feature Request
description: Suggest an idea for this project
labels: [RFC, Needs Triage]
body:
- type: markdown
attributes:
value: |
Thank you for using Video.js and contributing by requesting a new feature. Before you start, please create your request for change in thr RFC repo: https://github.com/videojs/rfcs
- type: input
id: rfc
attributes:
label: Request for change PR
description: Add a link to your RFC PR
placeholder: https://github.com/videojs/rfcs/pull/3
validations:
required: true
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Question
description: Need help with something not related to a Bug or Feature Request?
labels: [Question, Needs Triage]
body:
- type: textarea
id: question
attributes:
label: Question
validations:
required: true
13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Description
Please describe the change as necessary.
If it's a feature or enhancement please be as detailed as possible.
If it's a bug fix, please link the issue that it fixes or describe the bug in as much detail.

## Specific Changes proposed
Please list the specific changes involved in this pull request.

## Requirements Checklist
- [ ] Feature implemented / Bug fixed
- [ ] Change has been verified in an actual browser (Chrome, Firefox, Safari, Edge) (if applicable)
- [ ] Unit Tests updated or fixed (if applicable)
- [ ] Docs/guides updated (if applicable)
44 changes: 33 additions & 11 deletions .github/workflows/continuous.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,57 @@ jobs:
name: Quality Gates
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Bun
uses: oven-sh/setup-bun@v1
uses: actions/checkout@v4

# install node version from .nvmrc
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

# install deps
- name: Install Dependencies
run: bun install
- name: Build All Packages
run: bun run build
run: npm ci

# lint all packages
- name: Lint All Packages
run: bun run lint
run: npm run lint

# build all packages
- name: Build All Packages
run: npm run build

# verify generated bundle sizes for all packages
- name: Verify Bundle Sizes
run: npm run verify:bundle-size

# run unit tests and generate test coverage for all packages
- name: Test All Packages
run: bun run test:coverage
run: npm run test:coverage

# upload @videojs/hls-parser test coverage to codecov
- name: Upload Hls-Parser Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: hls-parser
files: ./packages/hls-parser/coverage/coverage-final.json
name: hls-parser-coverage
fail_ci_if_error: true

# upload @videojs/dash-parser test coverage to codecov
- name: Upload Dash-Parser Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: dash-parser
files: ./packages/dash-parser/coverage/coverage-final.json
name: dash-parser-coverage
fail_ci_if_error: true

# upload @videojs/playback test coverage to codecov
- name: Upload Player Coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: playback
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: release
on:
push:
tags:
# match semver versions
- "v[0-9]+.[0-9]+.[0-9]+"
# match semver pre-releases
- "v[0-9]+.[0-9]+.[0-9]+-*"
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # needed for provenance data generation
name: Release
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# Install node version from .nvmrc
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
registry-url: https://registry.npmjs.org/

# Install deps
- name: Install Dependencies
run: npm ci

# Print nx env info
- name: Print Environment Info
run: npx nx report

# Publish to NPM via NX
- name: Publish to NPM
run: npm run release:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

# Generate release-info-latest.md file for GitHub releases
- name: Generate release-info-latest.md
run: node cli/generate-release-info-latest.js > RELEASE-INFO-LATEST.md

# Create GitHub release
- name: Create Github release
uses: softprops/action-gh-release@v2
with:
body_path: RELEASE-INFO-LATEST.md
token: ${{github.token}}
files: |
packages/dash-parser/videojs-dash-parser-*.tgz
packages/hls-parser/videojs-hls-parser-*.tgz
packages/playback/videojs-playback-*.tgz
# Deploy Demo apps to netlify (TBD)
# Deploy API references to netlify (TBD)
# Deploy IIFE bundles to CDN (TBD)
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ web_modules/

# Output of 'npm pack'

\*.tgz
**/*.tgz


# Yarn Integrity file

Expand Down Expand Up @@ -116,6 +117,7 @@ out

.nuxt
dist
dist-api-reference

# Gatsby files

Expand Down Expand Up @@ -175,5 +177,6 @@ dist
.DS_Store


.nx

.nx/cache
.nx/cache
5 changes: 1 addition & 4 deletions .husky/commit-msg
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bun run commitlint ${1}
npx --no -- commitlint --edit ${1}
5 changes: 1 addition & 4 deletions .husky/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

bunx lint-staged
npx lint-staged
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
2 changes: 1 addition & 1 deletion .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"*.{js,ts}": ["eslint --fix", "eslint"],
"*": ["prettier --write"]
"*.{js,ts,json}": ["prettier --write"]
}
File renamed without changes.
Loading

0 comments on commit e016531

Please sign in to comment.