Skip to content
This repository was archived by the owner on Aug 19, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
Build:
strategy:
matrix:
node_version: ["20.19.0"]
node_version: [20, 24]
os: ["macos-latest", "windows-latest"]

runs-on: ${{ matrix.os }}
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@

# Change Log

## 1.8.1

### ✨ Update

- Updated validation to update schemas from https://schemas.elgato.com.

## 1.8.0

### ✨ New
Expand Down
125 changes: 40 additions & 85 deletions package-lock.json

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"build": "wireit",
"build:bin": "wireit",
"build:exports": "wireit",
"dev": "npm run build --watch",
"dev:bin": "npm run build:bin --watch",
"dev:exports": "npm run build:exports --watch",
"dev": "wireit",
"dev:bin": "wireit",
"dev:exports": "wireit",
"lint": "eslint --max-warnings 0",
"lint:fix": "prettier \"./src/**/*.ts\" --write",
"preversion": "npm run lint",
Expand Down Expand Up @@ -66,6 +66,24 @@
"typecheck"
]
},
"dev": {
"command": "npm run build",
"env": {
"WIREIT_WATCH": "true"
}
},
"dev:bin": {
"command": "npm run build:bin",
"env": {
"WIREIT_WATCH": "true"
}
},
"dev:exports": {
"command": "npm run build:exports",
"env": {
"WIREIT_WATCH": "true"
}
},
"typecheck": {
"command": "tsc --noEmit",
"files": [
Expand Down Expand Up @@ -111,8 +129,7 @@
"lodash": "^4.17.21",
"log-symbols": "^7.0.0",
"rage-edit": "^1.2.0",
"semver": "^7.6.3",
"tar": "^7.5.3"
"semver": "^7.6.3"
},
"devDependencies": {
"@elgato/eslint-config": "^0.3.2",
Expand All @@ -129,6 +146,6 @@
"tslib": "^2.8.1",
"tsup": "^8.5.1",
"typescript": "^5.7.3",
"wireit": "^0.14.12"
"wireit": "^0.14.13"
}
}
10 changes: 1 addition & 9 deletions rolldown.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineConfig } from "rolldown";

const isWatching = !!(process.env.npm_config_watch || process.env.ROLLUP_WATCH);
const isWatching = !!process.env.WIREIT_WATCH;

const banner = `#!/usr/bin/env node

Expand All @@ -11,13 +11,6 @@ const banner = `#!/usr/bin/env node
* @copyright Copyright (c) Corsair Memory Inc.
*/`;

// Ignore @elgato/schema to enable auto-update.
const external = [
"@elgato/schemas",
"@elgato/schemas/streamdeck/plugins/",
"@elgato/schemas/streamdeck/plugins/json",
];

/**
* CLI bundling.
*/
Expand All @@ -29,7 +22,6 @@ export default defineConfig({
sourcemap: isWatching,
minify: !isWatching,
},
external,
platform: "node",
resolve: {
conditionNames: ["node"],
Expand Down
22 changes: 9 additions & 13 deletions src/commands/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { resolve } from "node:path";
import { command } from "../common/command";
import { StdoutError } from "../common/stdout";
import { store } from "../common/storage";
import { packageManager } from "../package-manager";
import { validatePlugin } from "../validation/plugin";
import { getJsonSchemas } from "../validation/plugin/schemas";

/**
* Key within the store for the value that records the last update check.
Expand Down Expand Up @@ -42,22 +42,18 @@ export const validate = command<ValidateOptions>(async (options, stdout) => {
fail();
}

// Determine whether the schemas should be updated.
if (canUpdateCheck(options)) {
const update = await packageManager.checkUpdate("@elgato/schemas");
if (update) {
await stdout.spin("Updating validation rules", async () => {
await packageManager.install(update);
stdout.info(`Validation rules updated`);
});
}
const updateCheck = canUpdateCheck(options);

// Validate the plugin and write the output (ignoring success if we should be quiet).
const result = await validatePlugin({
path: resolve(options.path),
schemas: await getJsonSchemas({ updateCheck }),
});

// Log the update check.
if (updateCheck) {
store.set(LAST_UPDATE_CHECK_STORE_KEY, new Date());
}

// Validate the plugin and write the output (ignoring success if we should be quiet).
const result = await validatePlugin(resolve(options.path));
if (result.hasErrors() || result.hasWarnings() || !options.quietSuccess) {
result.writeTo(stdout);
}
Expand Down
19 changes: 14 additions & 5 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,27 @@ export function updateConfig(updater: (config: object, defaultConfig: Config) =>
}

/**
* Gets the path to the local configuration file.
* @returns Configuration file path.
* Gets the path to the local directory that is responsible for storing files.
* @returns The directory path.
*/
export function getFilePath(): string {
export function getFileStoreDir(): string {
if (platform() === "win32") {
const appData = process.env.APPDATA ?? join(homedir(), "AppData/Roaming");
return join(appData, "Elgato/MakerCLI/config.json");
return join(appData, "Elgato/MakerCLI/");
} else {
return join(homedir(), ".config/com.elgato/maker-cli/config.json");
return join(homedir(), ".config/com.elgato/maker-cli/");
}
}

/**
* Gets the path to the local configuration file.
* @returns Configuration file path.
*/
export function getFilePath(): string {
const fileStoreDir = getFileStoreDir();
return join(fileStoreDir, "config.json");
}

/**
* Exits the current process due to an invalid set of configuration.
* @param message Error message.
Expand Down
16 changes: 15 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import chalk from "chalk";

import { validatePlugin } from "./validation/plugin";
import { getJsonSchemas } from "./validation/plugin/schemas";
import type { ValidationResult } from "./validation/result";

export {
ValidationLevel,
type FileValidationResult,
Expand All @@ -8,6 +12,16 @@ export {
type ValidationResult,
} from "./validation";

export { validatePlugin as validateStreamDeckPlugin } from "./validation/plugin";
/**
* Validates the Stream Deck plugin as the specified {@link path}.
* @param path Path to the plugin.
* @returns The validation result.
*/
export async function validateStreamDeckPlugin(path: string): Promise<ValidationResult> {
return validatePlugin({
path,
schemas: await getJsonSchemas({ updateCheck: true }),
});
}

chalk.level = 0;
Loading
Loading