Collection of schemas, and TypeScript 声明,支持Stream Deck SDK文件的创建和验证.
npm install @elgato/schemas
流出地标
插件
声明
用于定义 Stream Deck 插件的 Manific JSON 文件 .
// TypeScript type.
import { type Manifest } from "@elgato/schemas/streamdeck/plugins";
// Schema as an object, using import attributes.
import manifest from "@elgato/schemas/streamdeck/plugins/manifest.json" with { type: "json" };
https://schemas.elgato.com/streamdeck/plugins/manifest.json
版式
布局 JSON 文件定义了 Stream Deck +, Stream Deck + XL 和 Stream Deck Neo 上的动作布局.
// TypeScript type.
import { type Layout } from "@elgato/schemas/streamdeck/plugins";
// Schema as an object, using import attributes.
import layout from "@elgato/schemas/streamdeck/plugins/layout.json" with { type: "json" };
https://schemas.elgato.com/streamdeck/plugins/layout.json
使用量
Schemas可以直接在JSON文件中被引用,提供intellisense和验证,使用 $schema 属性,例如:
{
"$schema": "https://schemas.elgato.com/streamdeck/plugins/manifest.json",
"Name": "Wave Link",
"Version": "1.9.0.0",
"Author": "Elgato",
// ...
}
关键词
自定义关键字在提供的计划中也可以被直接导入来帮助构建验证符,例如: Ajv。请注意,自定义的关键词定义只登记关键词,不会提供验证.
import { keywordDefinitions } from "@elgato/schemas";
import Ajv from "ajv";
// add the "filePath" keyword (excluding validation)
ajv.addKeyword(keywordDefinitions.filePath);
