@glasshome/widget-cli 0.4.4 → 0.4.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/widget-cli",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "CLI for creating and managing GlassHome widgets",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,14 +17,14 @@
17
17
  ],
18
18
  "devDependencies": {
19
19
  "@types/bun": "latest",
20
- "@types/semver": "^7.0.0",
21
- "vite-plugin-solid": "^2.11.0"
20
+ "@types/semver": "^7.0.0"
22
21
  },
23
22
  "dependencies": {
24
23
  "@clack/prompts": "^0.10.0",
25
24
  "@glasshome/widget-sdk": "0.2.3",
26
25
  "open": "^11.0.0",
27
- "semver": "^7.6.0"
26
+ "semver": "^7.6.0",
27
+ "vite-plugin-solid": "^2.11.0"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
@@ -15,11 +15,10 @@ export function scaffoldWidget(
15
15
  cwd: string,
16
16
  opts: {
17
17
  widgetName: string;
18
- tag: string;
19
18
  description: string;
20
19
  },
21
20
  ): void {
22
- const { widgetName, tag, description } = opts;
21
+ const { widgetName, description } = opts;
23
22
  const widgetDir = resolve(cwd, "src", widgetName);
24
23
 
25
24
  if (existsSync(widgetDir)) {
@@ -34,13 +33,11 @@ export function scaffoldWidget(
34
33
  // Read index.tsx template from the template directory
35
34
  const templateDir = resolve(import.meta.dir, "../../template");
36
35
  let srcContent = readFileSync(resolve(templateDir, "src/index.tsx.template"), "utf-8");
37
- srcContent = srcContent.replace(/WIDGET_TAG/g, tag);
38
36
  srcContent = srcContent.replace(/WIDGET_NAME/g, displayName);
39
37
  writeFileSync(resolve(widgetDir, "index.tsx"), srcContent);
40
38
 
41
39
  // Generate manifest.json
42
40
  const manifest = {
43
- tag,
44
41
  name: displayName,
45
42
  description: widgetDescription,
46
43
  minSize: { w: 1, h: 1 },
@@ -55,7 +52,6 @@ export function scaffoldWidget(
55
52
  /** Interactive prompts for widget details. Returns null if cancelled. */
56
53
  export async function promptWidgetDetails(defaults?: { widgetName?: string }): Promise<{
57
54
  widgetName: string;
58
- tag: string;
59
55
  description: string;
60
56
  } | null> {
61
57
  const widgetName = await text({
@@ -75,23 +71,6 @@ export async function promptWidgetDetails(defaults?: { widgetName?: string }): P
75
71
  return null;
76
72
  }
77
73
 
78
- const tag = await text({
79
- message: "Custom element tag",
80
- placeholder: `glasshome-${widgetName}`,
81
- defaultValue: `glasshome-${widgetName}`,
82
- validate(value) {
83
- if (!value) return "Tag is required";
84
- if (!/^[a-z]/.test(value)) return "Tag must start with a lowercase letter";
85
- if (!value.includes("-")) return "Custom element tags must contain a hyphen";
86
- if (!/^[a-z][a-z0-9]*(-[a-z0-9]+)+$/.test(value))
87
- return "Tag must be lowercase alphanumeric with hyphens (e.g. glasshome-my-widget)";
88
- },
89
- });
90
- if (isCancel(tag)) {
91
- cancel("Operation cancelled.");
92
- return null;
93
- }
94
-
95
74
  const description = await text({
96
75
  message: "Description (optional)",
97
76
  placeholder: "A GlassHome dashboard widget",
@@ -104,7 +83,6 @@ export async function promptWidgetDetails(defaults?: { widgetName?: string }): P
104
83
 
105
84
  return {
106
85
  widgetName: widgetName as string,
107
- tag: tag as string,
108
86
  description: description as string,
109
87
  };
110
88
  }
@@ -35,7 +35,7 @@ This creates `src/{widget-name}/index.tsx` and `src/{widget-name}/manifest.json`
35
35
  Connect your widgets to a running GlassHome instance:
36
36
 
37
37
  ```bash
38
- bun widget connect http://<dashboard-api-host>:3333
38
+ bun widget connect http://homeassistant.local:3123
39
39
  ```
40
40
 
41
41
  This builds all widgets, serves them on your LAN IP, registers them with the dashboard, and watches for file changes. Widgets hot-reload as you edit.
@@ -56,7 +56,7 @@ PROJECT_NAME/
56
56
  Each widget subdirectory contains:
57
57
 
58
58
  - **`index.tsx`** — SolidJS component + `defineWidget()` registration
59
- - **`manifest.json`** — metadata (tag, name, type, size, version)
59
+ - **`manifest.json`** — metadata (name, description, size, version)
60
60
 
61
61
  ## CLI commands
62
62
 
@@ -27,7 +27,6 @@ const WIDGET_NAMEWidget: Component<{ config: WidgetConfig }> = (props) => {
27
27
 
28
28
  export default defineWidget<WidgetConfig>({
29
29
  manifest: {
30
- tag: "WIDGET_TAG",
31
30
  name: "WIDGET_NAME",
32
31
  minSize: { w: 1, h: 1 },
33
32
  maxSize: { w: 4, h: 4 },