Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: migrate mediasoup WebRTC server from JavaScript to TypeScript #29

Merged
merged 14 commits into from
Jan 15, 2025
Merged
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
25 changes: 25 additions & 0 deletions .eslintrc.js
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',
},
};
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
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
38 changes: 36 additions & 2 deletions .gitignore
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
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true
}
52 changes: 32 additions & 20 deletions Dockerfile
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/*

gabrielmatau79 marked this conversation as resolved.
Show resolved Hide resolved
# 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"]

201 changes: 0 additions & 201 deletions LICENSE
gabrielmatau79 marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Loading
Loading