Skip to content

Commit

Permalink
Move example app into a demo folder (#1280)
Browse files Browse the repository at this point in the history
* Move example app into a demo folder

* Move example app into a demo folder
  • Loading branch information
bcherry authored Oct 9, 2024
1 parent ee7ddcf commit 58c1369
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ docs/

pkg/
bin/
example/build/
examples/**/build/
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
bin
docs
protocol
example
examples
node_modules
tsconfig.json
test
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 4 additions & 4 deletions example/sample.ts → examples/demo/demo.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -8,7 +8,7 @@ import type {
SimulationScenario,
VideoCaptureOptions,
VideoCodec,
} from '../src/index';
} from '../../src/index';
import {
ConnectionQuality,
ConnectionState,
Expand All @@ -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 $ = <T extends HTMLElement>(id: string) => document.getElementById(id) as T;

Expand Down
2 changes: 1 addition & 1 deletion example/index.html → examples/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ <h3>Chat</h3>
<textarea id="log"></textarea>
</div>
</div>
<script src="./sample.ts" type="module"></script>
<script src="./demo.ts" type="module"></script>
<!-- for icons -->
<script src="https://kit.fontawesome.com/7c1c4c7e9c.js" crossorigin="anonymous"></script>
</body>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions example/tsconfig.json → examples/demo/tsconfig.json
Original file line number Diff line number Diff line change
@@ -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'. */,
Expand All @@ -15,6 +15,6 @@
"moduleResolution": "node",
"resolveJsonModule": true
},
"include": ["../src/**/*", "sample.ts"],
"include": ["../../src/**/*", "demo.ts"],
"exclude": ["**/*.test.ts", "build/**/*"]
}
2 changes: 1 addition & 1 deletion jest.config.cjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
clearMocks: true,
modulePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/example/'],
modulePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/examples/'],
preset: 'ts-jest',
testEnvironment: 'jsdom',
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.eslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"include": [
"src/**/*.ts",
"src/**/*.js",
"example/**/*.ts",
"examples/**/*.ts",
".eslintrc.cjs",
".eslintrc.dist.cjs",
"jest.config.js",
Expand Down

0 comments on commit 58c1369

Please sign in to comment.