diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml index 1f38c054bc..fb738e45a8 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yaml +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -21,7 +21,7 @@ body: id: reproduction attributes: label: Reproduction - description: A detailed step-by-step guide on how to reproduce the issue or (preferably) a link to a repository that reproduces the issue. Reproductions must be [short, self-contained and correct](http://sscce.org/) and must not contain files or code that aren't relevant to the issue. It's best if you use the sample app in `example/index.ts` as a starting point for your reproduction. We will prioritize issues that include a working minimal reproduction repository. + description: A detailed step-by-step guide on how to reproduce the issue or (preferably) a link to a repository that reproduces the issue. Reproductions must be [short, self-contained and correct](http://sscce.org/) and must not contain files or code that aren't relevant to the issue. It's best if you use the sample app in `examples/demo/demo.ts` as a starting point for your reproduction. We will prioritize issues that include a working minimal reproduction repository. placeholder: Reproduction validations: required: true diff --git a/.gitignore b/.gitignore index f01289afc9..e2c8972cdb 100644 --- a/.gitignore +++ b/.gitignore @@ -111,4 +111,4 @@ docs/ pkg/ bin/ -example/build/ +examples/**/build/ diff --git a/.npmignore b/.npmignore index 47e99f161d..62c073b59b 100644 --- a/.npmignore +++ b/.npmignore @@ -2,7 +2,7 @@ bin docs protocol -example +examples node_modules tsconfig.json test diff --git a/README.md b/README.md index 0f7af68500..3c051cc7b8 100644 --- a/README.md +++ b/README.md @@ -306,9 +306,9 @@ setLogExtension((level: LogLevel, msg: string, context: object) => { ## Examples -### SDK Sample +### Demo App -[example/sample.ts](example/sample.ts) contains a demo webapp that uses the SDK. Run it with `pnpm install && pnpm sample` +[examples/demo](examples/demo/) contains a demo webapp that uses the SDK. Run it with `pnpm install && pnpm examples:demo` ## Browser Support diff --git a/example/sample.ts b/examples/demo/demo.ts similarity index 99% rename from example/sample.ts rename to examples/demo/demo.ts index 584bdc3fe5..5ac892b205 100644 --- a/example/sample.ts +++ b/examples/demo/demo.ts @@ -1,5 +1,5 @@ //@ts-ignore -import E2EEWorker from '../src/e2ee/worker/e2ee.worker?worker'; +import E2EEWorker from '../../src/e2ee/worker/e2ee.worker?worker'; import type { ChatMessage, RoomConnectOptions, @@ -8,7 +8,7 @@ import type { SimulationScenario, VideoCaptureOptions, VideoCodec, -} from '../src/index'; +} from '../../src/index'; import { ConnectionQuality, ConnectionState, @@ -34,8 +34,8 @@ import { setLogLevel, supportsAV1, supportsVP9, -} from '../src/index'; -import { isSVCCodec } from '../src/room/utils'; +} from '../../src/index'; +import { isSVCCodec } from '../../src/room/utils'; const $ = (id: string) => document.getElementById(id) as T; diff --git a/example/index.html b/examples/demo/index.html similarity index 99% rename from example/index.html rename to examples/demo/index.html index 2ce4a369f1..02c04a1f38 100644 --- a/example/index.html +++ b/examples/demo/index.html @@ -290,7 +290,7 @@

Chat

- + diff --git a/example/styles.css b/examples/demo/styles.css similarity index 100% rename from example/styles.css rename to examples/demo/styles.css diff --git a/example/tsconfig.json b/examples/demo/tsconfig.json similarity index 93% rename from example/tsconfig.json rename to examples/demo/tsconfig.json index 36a57629cd..0c15fdd693 100644 --- a/example/tsconfig.json +++ b/examples/demo/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig", + "extends": "../../tsconfig", "compilerOptions": { "target": "ESNext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */, "module": "ESNext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, @@ -15,6 +15,6 @@ "moduleResolution": "node", "resolveJsonModule": true }, - "include": ["../src/**/*", "sample.ts"], + "include": ["../../src/**/*", "demo.ts"], "exclude": ["**/*.test.ts", "build/**/*"] } diff --git a/jest.config.cjs b/jest.config.cjs index 9ad6b93102..b56e073343 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -1,6 +1,6 @@ module.exports = { clearMocks: true, - modulePathIgnorePatterns: ['/dist/', '/example/'], + modulePathIgnorePatterns: ['/dist/', '/examples/'], preset: 'ts-jest', testEnvironment: 'jsdom', }; diff --git a/package.json b/package.json index 59624f6b60..b0ceddb9da 100644 --- a/package.json +++ b/package.json @@ -41,12 +41,12 @@ "build:worker:watch": "rollup --watch --config rollup.config.worker.js --bundleConfigAsCjs", "build-docs": "typedoc", "proto": "protoc --es_out src/proto --es_opt target=ts -I./protocol ./protocol/livekit_rtc.proto ./protocol/livekit_models.proto", - "sample": "vite example -c vite.config.mjs", + "examples:demo": "vite examples/demo -c vite.config.mjs", "lint": "eslint src", "test": "vitest run src", - "deploy": "gh-pages -d example/dist", - "format": "prettier --write src example/sample.ts", - "format:check": "prettier --check src", + "deploy": "gh-pages -d examples/demo/dist", + "format": "prettier --write src examples/**/*.ts", + "format:check": "prettier --check src examples/**/*.ts", "ci:publish": "pnpm build && pnpm compat && changeset publish", "downlevel-dts": "downlevel-dts ./dist/ ./dist/ts4.2 --to=4.2", "compat": "eslint --no-eslintrc --config ./.eslintrc.dist.cjs ./dist/livekit-client.umd.js", diff --git a/tsconfig.eslint.json b/tsconfig.eslint.json index 5612792b19..c5601825c7 100644 --- a/tsconfig.eslint.json +++ b/tsconfig.eslint.json @@ -3,7 +3,7 @@ "include": [ "src/**/*.ts", "src/**/*.js", - "example/**/*.ts", + "examples/**/*.ts", ".eslintrc.cjs", ".eslintrc.dist.cjs", "jest.config.js",