feat: enable auto-update of JSON schemas from https://schemas.elgato.com - #76
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Stream Deck plugin validation flow to load JSON schemas from https://schemas.elgato.com with a local cache fallback, while bundling @elgato/schemas for default schemas and removing the prior “local package manager” update mechanism.
Changes:
- Introduces a schema store that can resolve schemas from bundled defaults, local cache, and remote (
schemas.elgato.com) with version comparison. - Refactors plugin validation to accept schemas via options (instead of dynamic importing schemas inside validation).
- Simplifies packaging by bundling
@elgato/schemasand removingtar(and schema auto-update via npm install).
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/validation/plugin/schemas.ts | Adds getJsonSchemas to load plugin schemas via schemaStore with optional update checks. |
| src/validation/plugin/plugin.ts | Refactors plugin context creation to accept schemas via PluginValidationOptions. |
| src/validation/plugin/options.ts | Introduces PluginValidationOptions (path + schemas). |
| src/validation/plugin/index.ts | Updates validatePlugin to accept PluginValidationOptions. |
| src/json/store.ts | Adds schema caching + remote fetch logic with version-based selection. |
| src/index.ts | Keeps public validateStreamDeckPlugin(path) API, always performing update checks when called programmatically. |
| src/config.ts | Splits config file path logic by introducing getFileStoreDir(). |
| src/commands/validate.ts | Switches CLI validation to fetch schemas via getJsonSchemas instead of npm-based updating. |
| src/package-manager.ts | Removes package update/install logic, retaining only CLI version reporting. |
| rolldown.config.ts | Bundles @elgato/schemas by removing it from external. |
| package.json | Removes tar dependency. |
| package-lock.json | Lockfile updates reflecting removal of tar and related transitive deps. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.
Suppressed comments (3)
src/json/store.ts:96
- Directory creation is outside the best-effort cache-write
tryblock. If the config directory cannot be created (for example, under a read-only home directory), this rejection escapesschemaStore.getand prevents validation even though a usable remote schema was already loaded. Keepmkdirinside the same error boundary aswriteFile.
if (!existsSync(filePath)) {
await mkdir(dirname(filePath), { recursive: true });
src/json/store.ts:118
- This remote update check has no finite timeout, and the programmatic validation API invokes it on every call. A stalled schema service can therefore delay or hang validation instead of falling back to the cached/bundled schema as intended. Add an abort timeout (with the existing catch handling the fallback).
const res = await fetch(url);
src/validation/plugin/schemas.ts:24
- The two schema loads are independent, but these inline
awaits serialize both cache reads and remote requests. Because the public API now checks remotely on every call, validation pays the sum of both request latencies; start both operations together withPromise.all.
export async function getJsonSchemas({ updateCheck }: Options): Promise<PluginJsonSchemas> {
return {
layout: await schemaStore.get({
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@elgato/schemasin the bundling.tardependency.