Compare commits
22 Commits
1649b25f05
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
21d4c4cb71
|
|||
|
ac99f62600
|
|||
|
f2c7fd0c84
|
|||
|
8faa6dc174
|
|||
|
c5a58dc272
|
|||
|
616db3d06a
|
|||
|
bd30e2655f
|
|||
|
0c31a6b0c0
|
|||
|
2ead714719
|
|||
|
691dd0de92
|
|||
|
9e46d74a19
|
|||
|
57e5be38e6
|
|||
|
dd9235c265
|
|||
|
cccf91dfc7
|
|||
|
7ddb71d747
|
|||
|
330fd88ecc
|
|||
|
938060cd3f
|
|||
|
bdc7499fc1
|
|||
|
b606d5f463
|
|||
|
e3e5a10ec2
|
|||
|
d0b31f0147
|
|||
|
6bd3a0174d
|
69
.github/workflows/ci.yml
vendored
Normal file
69
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-publish:
|
||||||
|
runs-on: node-latest
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: sh
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
env:
|
||||||
|
ALPINE_MIRROR: ${{ secrets.ALPINE_MIRROR }}
|
||||||
|
G_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
ALPINE_VERSION=$(cat /etc/alpine-release | cut -d'.' -f1-2) && \
|
||||||
|
echo "${ALPINE_MIRROR}v${ALPINE_VERSION}/main" > /etc/apk/repositories && \
|
||||||
|
echo "${ALPINE_MIRROR}v${ALPINE_VERSION}/community" >> /etc/apk/repositories
|
||||||
|
apk update
|
||||||
|
apk add --no-cache git
|
||||||
|
|
||||||
|
HOST="${GITHUB_SERVER_URL#https://}"
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
AUTH_URL="https://${G_TOKEN}@${HOST}/${REPO}.git"
|
||||||
|
|
||||||
|
git clone --depth 1 --branch "$GITHUB_REF_NAME" "$AUTH_URL" .
|
||||||
|
|
||||||
|
if [ "$(git rev-parse HEAD)" != "$GITHUB_SHA" ]; then
|
||||||
|
echo "Fetching exact commit $GITHUB_SHA..."
|
||||||
|
git fetch origin "$GITHUB_SHA" --depth 1
|
||||||
|
git checkout "$GITHUB_SHA"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci --prefer-offline
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: npm run lint
|
||||||
|
|
||||||
|
- name: Check formatting
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
|
# - name: Run tests
|
||||||
|
# run: npm test
|
||||||
|
|
||||||
|
- name: Build npm package
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Publish to Gitea npm registry
|
||||||
|
if: success()
|
||||||
|
env:
|
||||||
|
G_TOKEN: ${{ secrets.G_TOKEN }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
HOST="${GITHUB_SERVER_URL#https://}"
|
||||||
|
OWNER="${GITHUB_REPOSITORY_OWNER}"
|
||||||
|
|
||||||
|
npm config set "@${OWNER}:registry" "https://${HOST}/api/packages/${OWNER}/npm/"
|
||||||
|
npm config set "//${HOST}/api/packages/${OWNER}/npm/:_authToken" "${G_TOKEN}"
|
||||||
|
|
||||||
|
npm config set "//${HOST}/api/packages/npm/:_authToken" "${G_TOKEN}"
|
||||||
|
|
||||||
|
npm publish --ignore-scripts
|
||||||
47
.github/workflows/ready.yml
vendored
47
.github/workflows/ready.yml
vendored
@@ -1,47 +0,0 @@
|
|||||||
name: Build and Deploy to CDN
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Run linter
|
|
||||||
run: npm run lint
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: npm test
|
|
||||||
|
|
||||||
- name: Build CDN assets
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Build npm package
|
|
||||||
run: npm run build:raw
|
|
||||||
|
|
||||||
- name: Publish to Gitea npm registry
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
||||||
run: |
|
|
||||||
echo "//${{ secrets.GITEA_HOST || 'git.db123.ir' }}/api/packages/${{ github.repository_owner }}/${{ github.event.repository.name }}/npm/:_authToken=${GITEA_TOKEN}" > .npmrc
|
|
||||||
npm publish --registry https://${{ secrets.GITEA_HOST || 'git.db123.ir' }}/api/packages/${{ github.repository_owner }}/${{ github.event.repository.name }}/npm
|
|
||||||
|
|
||||||
- name: Upload CDN build as artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: cdn-build
|
|
||||||
path: dist/
|
|
||||||
retention-days: 7
|
|
||||||
3
LICENSE
3
LICENSE
@@ -1,5 +1,7 @@
|
|||||||
Copyright (c) 2026 db
|
Copyright (c) 2026 db
|
||||||
|
|
||||||
|
Licensed under CC-BY-NC-SA 4.0 with the text below:
|
||||||
|
|
||||||
Attribution-NonCommercial-ShareAlike 4.0 International
|
Attribution-NonCommercial-ShareAlike 4.0 International
|
||||||
|
|
||||||
=======================================================================
|
=======================================================================
|
||||||
@@ -439,3 +441,4 @@ the avoidance of doubt, this paragraph does not form part of the
|
|||||||
public licenses.
|
public licenses.
|
||||||
|
|
||||||
Creative Commons may be contacted at creativecommons.org.
|
Creative Commons may be contacted at creativecommons.org.
|
||||||
|
|
||||||
|
|||||||
20
package.json
20
package.json
@@ -1,10 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@db/VP",
|
"name": "@db/VP",
|
||||||
"version": "0.0.2",
|
"version": "0.0.2",
|
||||||
|
"description": "Low-latency video player with HLS.js and WebRTC/WHEP support",
|
||||||
|
"license": "CC-BY-NC-SA-4.0",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.db123.ir/db/VP"
|
||||||
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/video-player.cjs.js",
|
"sideEffects": [
|
||||||
"module": "./dist/video-player.es.js",
|
"*.css"
|
||||||
"types": "./dist/index.d.ts",
|
],
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./dist/video-player.es.js",
|
"import": "./dist/video-player.es.js",
|
||||||
@@ -20,7 +26,6 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --watch",
|
"dev": "vite build --watch",
|
||||||
"build": "tsc --emitDeclarationOnly && vite build",
|
"build": "tsc --emitDeclarationOnly && vite build",
|
||||||
"build:raw": "tsc",
|
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"lint": "eslint . --ext .ts",
|
"lint": "eslint . --ext .ts",
|
||||||
@@ -29,7 +34,11 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"prepublishOnly": "npm run lint && npm run format && npm run test && npm run build"
|
"prepublishOnly": "npm run lint && npm run format && npm run test && npm run build"
|
||||||
},
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"hls.js": "^1.6.16"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"hls.js": "^1.6.16",
|
||||||
"@eslint/js": "^9.39.4",
|
"@eslint/js": "^9.39.4",
|
||||||
"@types/eslint": "^9.6.1",
|
"@types/eslint": "^9.6.1",
|
||||||
"@types/node": "^25.6.0",
|
"@types/node": "^25.6.0",
|
||||||
@@ -41,8 +50,5 @@
|
|||||||
"typescript-eslint": "^8.59.0",
|
"typescript-eslint": "^8.59.0",
|
||||||
"vite": "^8.0.9",
|
"vite": "^8.0.9",
|
||||||
"vitest": "^4.1.5"
|
"vitest": "^4.1.5"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"hls.js": "^1.6.16"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user