@glasshome/widget-cli 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/validate.ts +19 -8
package/package.json
CHANGED
package/src/commands/validate.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { log, spinner } from "@clack/prompts";
|
|
4
|
-
import { WidgetManifestSchema } from "@glasshome/widget-sdk/schemas";
|
|
5
4
|
import {
|
|
6
5
|
discoverWidgets,
|
|
7
6
|
formatBytes,
|
|
@@ -23,13 +22,25 @@ function validateManifest(manifest: WidgetManifest): ValidationResult {
|
|
|
23
22
|
const errors: string[] = [];
|
|
24
23
|
const warnings: string[] = [];
|
|
25
24
|
|
|
26
|
-
//
|
|
27
|
-
|
|
28
|
-
if (!
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
// Required fields
|
|
26
|
+
if (!manifest.tag) errors.push("Missing required field: tag");
|
|
27
|
+
if (!manifest.name) errors.push("Missing required field: name");
|
|
28
|
+
if (!manifest.sdkVersion) errors.push("Missing required field: sdkVersion");
|
|
29
|
+
|
|
30
|
+
// Size validation
|
|
31
|
+
if (
|
|
32
|
+
!manifest.minSize ||
|
|
33
|
+
typeof manifest.minSize.w !== "number" ||
|
|
34
|
+
typeof manifest.minSize.h !== "number"
|
|
35
|
+
) {
|
|
36
|
+
errors.push("minSize must be an object with numeric w and h properties");
|
|
37
|
+
}
|
|
38
|
+
if (
|
|
39
|
+
!manifest.maxSize ||
|
|
40
|
+
typeof manifest.maxSize.w !== "number" ||
|
|
41
|
+
typeof manifest.maxSize.h !== "number"
|
|
42
|
+
) {
|
|
43
|
+
errors.push("maxSize must be an object with numeric w and h properties");
|
|
33
44
|
}
|
|
34
45
|
|
|
35
46
|
// Tag format (stricter than schema — enforces kebab-case with at least one hyphen)
|