-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: migrate mediasoup WebRTC server from JavaScript to TypeScri…
…pt (#29)
- Loading branch information
1 parent
9f0add4
commit 11a455f
Showing
50 changed files
with
10,436 additions
and
15,675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
tsconfigRootDir: __dirname, | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:prettier/recommended', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
rules: { | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/explicit-function-return-type': 'off', | ||
'@typescript-eslint/explicit-module-boundary-types': 'off', | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Continuous Integration | ||
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
types: [opened, synchronize, reopened, labeled] | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout webrtc-server | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup node v22 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 22 | ||
|
||
- name: Install dependencies | ||
run: | | ||
yarn install | ||
- name: Check Format | ||
run: | | ||
yarn format | ||
- name: Check Types | ||
run: | | ||
yarn check-types | ||
- name: Unit tests | ||
run: | | ||
yarn test | ||
- name: E2E tests | ||
run: | | ||
yarn test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,36 @@ | ||
node_modules | ||
certs | ||
# compiled output | ||
/dist | ||
/node_modules | ||
/certs | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
pnpm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"printWidth": 120, | ||
"semi": false, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
# Stage 0, build the Webrtc Server | ||
FROM node:18-slim | ||
|
||
# Install DEB dependencies and others. | ||
RUN \ | ||
set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /server | ||
|
||
COPY package.json . | ||
COPY package-lock.json . | ||
RUN npm install | ||
COPY server.js . | ||
COPY config.js . | ||
COPY lib lib | ||
ADD start.sh . | ||
|
||
CMD ["sh", "/server/start.sh"] | ||
# Stage 0, build the Webrtc Server | ||
FROM node:22-slim as builder | ||
|
||
# Install DEB dependencies and others. | ||
RUN \ | ||
set -x \ | ||
&& apt-get update \ | ||
&& apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/* | ||
|
||
# MPR Setup | ||
WORKDIR /app | ||
|
||
# Copy package.json and yarn.lock first to leverage Docker layer caching | ||
COPY package.json package.json | ||
COPY yarn.lock yarn.lock | ||
|
||
# Run yarn install after copying only dependency files | ||
RUN yarn install | ||
|
||
# Copy other dependencies and configuration files | ||
COPY ./src ./src | ||
COPY tsconfig.json tsconfig.json | ||
COPY tsconfig.build.json tsconfig.build.json | ||
|
||
# Build the project | ||
RUN yarn build | ||
|
||
# Define a volume for external configuration files | ||
VOLUME /app/dist/config | ||
|
||
# Command to start the application when the container runs | ||
CMD ["yarn", "start"] | ||
|
Oops, something went wrong.