Move the SDK demo to sdk-target-based-on-call-view-model

The `sdk/` directory is about to become the MatrixRTC SDK package, so the
demo that lives there — one bundle of Element Call's CallViewModel for a plain
page or widget — moves aside, unchanged. It keeps building under a script and
vite config of its own, `pnpm build:sdk-target-based-on-call-view-model`, into
its own `dist` rather than the repository root's, and no longer copies the
developer's config.json out of `public`. Its README says which script to run
and where the output lands.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Timo K.
2026-10-01 16:57:21 +02:00
co-authored by Claude Fable 5.1
parent 3ad778e7e8
commit b0dd1c742f
10 changed files with 46 additions and 38 deletions
+2 -1
View File
@@ -72,7 +72,8 @@ Code that builds in only one is a bug.
- `build:full` — standalone app, also widget mode.
- `build:embedded` — `@element-hq/element-call-embedded`.
- `build:sdk` — SDK library, entry `sdk/main.ts`.
- `build:sdk-target-based-on-call-view-model` — the SDK demo, one bundle of the
`CallViewModel`; entry `sdk-target-based-on-call-view-model/main.ts`.
- `build:component` — `@element-hq/element-call-component`, sources in `component/`
(its own pnpm project; run pnpm from the repo root). Host API is in the README;
`pnpm lint:externals` rejects an import of a `react` / `react-dom` /
+1 -1
View File
@@ -12,7 +12,7 @@ export default {
config: [
"vite.config.ts",
"vite-embedded.config.ts",
"vite-sdk.config.ts",
"vite-sdk-target-based-on-call-view-model.config.ts",
"vite-component.config.ts",
"vite-component-dev.config.ts",
],
+1 -3
View File
@@ -14,9 +14,7 @@
"build:embedded": "pnpm build:full --config vite-embedded.config.js",
"build:embedded:production": "pnpm build:embedded",
"build:embedded:development": "pnpm build:embedded --mode development",
"build:sdk:development": "pnpm build:sdk --mode development",
"build:sdk": "pnpm build:full --config vite-sdk.config.js",
"build:sdk:production": "pnpm build:sdk",
"build:sdk-target-based-on-call-view-model": "pnpm build:full --config vite-sdk-target-based-on-call-view-model.config.js",
"build:component": "pnpm build:component:js && pnpm build:component:types",
"build:component:js": "pnpm build:full --config vite-component.config.js",
"build:component:types": "tsc -p component/tsconfig.build.json",
@@ -1,4 +1,8 @@
# SDK mode (EXPERIMENTAL)
# SDK mode (EXPERIMENTAL, superseded)
> Superseded by the `sdk/` package (`@element-hq/matrixrtc-sdk`) and its harness in
> `sdk/dev`; see `sdk-plan.md`. This folder still builds, with its own script, until
> that package can do what this does.
EC can be build in sdk mode. This will result in a compiled js file that can be imported in very simple webapps.
@@ -14,12 +18,13 @@ To get started run
```
pnpm install
pnpm build:sdk
pnpm build:sdk-target-based-on-call-view-model
```
in the repository root.
in the repository root. (`pnpm build:sdk` builds the `sdk/` package instead.)
It will create a `dist` folder containing the compiled js file.
It will create `sdk-target-based-on-call-view-model/dist` containing the compiled js
file, `matrixrtc-sdk.js`.
This file needs to be hosted. Locally (via `npx serve -l 81234 --cors`) or on a remote server.
+1 -1
View File
@@ -53,7 +53,7 @@
"./src/**/*.ts",
"./src/**/*.tsx",
"./playwright/**/*.ts",
"./sdk/**/*.ts",
"./sdk-target-based-on-call-view-model/**/*.ts",
"./component/**/*.ts",
"./component/**/*.tsx"
],
@@ -0,0 +1,32 @@
/*
Copyright 2025 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { defineConfig } from "vite";
import nodePolyfills from "vite-plugin-node-stdlib-browser";
// Config for the SDK demo that predates the sdk/ package: a single bundle of
// Element Call's CallViewModel for a plain web page or widget. Kept building
// until the harness in sdk/dev replaces it (see sdk-plan.md).
export default defineConfig(() => ({
worker: { format: "es" as const },
// Relative URLs, so the bundle can be hosted under any path
base: "./",
// Otherwise the developer's own config.json in `public` is copied into the output
publicDir: false,
build: {
outDir: "sdk-target-based-on-call-view-model/dist",
sourcemap: true,
manifest: true,
lib: {
formats: ["es" as const],
entry: "./sdk-target-based-on-call-view-model/main.ts",
name: "MatrixrtcSdk",
fileName: "matrixrtc-sdk",
},
},
plugins: [nodePolyfills()],
}));
-28
View File
@@ -1,28 +0,0 @@
/*
Copyright 2025 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE in the repository root for full details.
*/
import { defineConfig, mergeConfig } from "vite";
import nodePolyfills from "vite-plugin-node-stdlib-browser";
const base = "./";
// Config for embedded deployments (possibly hosted under a non-root path)
export default defineConfig(() => ({
worker: { format: "es" as const },
base, // Use relative URLs to allow the app to be hosted under any path
build: {
sourcemap: true,
manifest: true,
lib: {
formats: ["es" as const],
entry: "./sdk/main.ts",
name: "MatrixrtcSdk",
fileName: "matrixrtc-sdk",
},
},
plugins: [nodePolyfills()],
}));