Skip to content

Commit

Permalink
feat: fake-agora-rtc
Browse files Browse the repository at this point in the history
  • Loading branch information
guoxianzhe committed Sep 5, 2023
0 parents commit 9375445
Show file tree
Hide file tree
Showing 55 changed files with 8,784 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/
**/dist/*
**/coverage/*
**/node_modules/*
.snapshots/
*.min.js
53 changes: 53 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"env": {
"browser": true
},
"plugins": ["@typescript-eslint", "prettier", "import"],
"root": true,
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "error",
"@typescript-eslint/method-signature-style": "error",
"@typescript-eslint/no-non-null-asserted-optional-chain": "error",
"@typescript-eslint/consistent-type-imports": ["warn"],
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-explicit-any": ["warn", { "ignoreRestArgs": true }],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"destructuredArrayIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"@typescript-eslint/ban-types": [
"error",
{
"types": { "{}": false },
"extendDefaults": true
}
],
"import/order": [
"error",
{
"newlines-between": "always",
"alphabetize": {
"order": "asc",
"orderImportKind": "asc"
}
}
],
"sort-imports": [
"error",
{
"ignoreDeclarationSort": true,
"ignoreMemberSort": false
}
]
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.mdx linguist-detectable=false
16 changes: 16 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Setup
description: Setup Node.js and pnpm

runs:
using: composite
steps:
- name: Install pnpm 🤏🏻
uses: pnpm/[email protected]
with:
version: latest

- name: Setup Node 💚
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "pnpm"
19 changes: 19 additions & 0 deletions .github/workflows/gitleak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: gitleaks
on:
pull_request:
push:
workflow_dispatch:

jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
if: github.actor != 'dependabot[bot]'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
37 changes: 37 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on: ["pull_request"]

name: Test PR

jobs:
build:
name: Test
runs-on: ubuntu-latest

permissions:
# Required to checkout the code
contents: read
# Required to put a comment into the pull-request
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup 🛠️
uses: ./.github/actions/setup

- name: Test 🧪
run: |
pnpm install
pnpm run lint
pnpm run test
pnpm run build
- name: Report Coverage for fake-agora-rtc 🟢
if: always() # Also generate the report if tests are failing
uses: davelosert/[email protected]
with:
working-directory: "./src"
69 changes: 69 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Publish to NPM

on:
workflow_dispatch:
inputs:
publish-npm:
description: "choose true if want publish to npm"
default: false
type: boolean

jobs:
release-it:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup
uses: ./.github/actions/setup

- name: Setup Dependencies 💚
run: |
pnpm install
- name: Zip It Up 🤐
run: |
pnpm build
zip -r fake-agora-rtc.zip dist
- name: Upload Artifact ⬆️
uses: actions/upload-artifact@v3
with:
name: fake-agora-rtc.zip
path: fake-agora-rtc.zip

- name: Setup NPM auth token
if: ${{ inputs.publish-npm }}
run: |
npm set "//registry.npmjs.org/:_authToken" ${{ secrets.NPM_TOKEN }}
- name: Config Git
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global user.name "${{ github.actor }}"
- name: Get Package Info
id: package-info
run: |
version=$(node -p "require('./package.json').version")
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Update VERSION
run: |
pnpm exec esbuild-dev $PWD/scripts/release/update-version.ts @${{ steps.package-info.outputs.version }}
- name: Release and Publish
run: |
pnpm release ${{ inputs.increment }} --ci --npm.publish=${{ inputs.publish-npm }}
- name: Upload Doc Archive to GitHub release ⬆️
if: github.event.release
uses: svenstaro/[email protected]
with:
file: fake-agora-rtc.zip
asset_name: fake-agora-rtc.zip
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
release:
types: [published]
push:
branches: [main]

permissions:
contents: write
pages: write
id-token: write

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Setup
uses: ./.github/actions/setup

- name: Setup Dependencies 💚
run: |
pnpm install
- name: Zip It Up 🤐
run: |
pnpm build
zip -r fake-agora-rtc.zip dist
- name: Upload Artifact ⬆️
uses: actions/upload-artifact@v3
with:
name: fake-agora-rtc.zip
path: fake-agora-rtc.zip
- name: Upload Doc Archive to GitHub release ⬆️
if: github.event.release
uses: svenstaro/[email protected]
with:
file: fake-agora-rtc.zip
asset_name: fake-agora-rtc.zip
tag: ${{ github.ref_name }}
109 changes: 109 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache

# Next.js build output
.next

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and *not* Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

.DS_Store

typedoc/
12 changes: 12 additions & 0 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[allowlist]
description = "gh pages build file allow lists"
paths = [
'''gitleaks.toml''',
]

# ----- BEGIN Agora AppId -----
[[rules]]
id = "agora-appid"
description = "Agora AppId"
regex = '''"[0-9a-f]{32}"'''
# ----- END Agora AppId -----
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx commitlint --edit "$1"
Loading

0 comments on commit 9375445

Please sign in to comment.