@glasshome/widget-cli 0.2.0 → 0.2.1

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/bin/cli.ts CHANGED
@@ -26,7 +26,7 @@ Commands:
26
26
  build Build all widgets (per-widget, self-contained bundles)
27
27
  connect <url> Connect to a running dashboard for live testing
28
28
  validate [name] Validate all widgets or a specific one
29
- publish Build all widgets and publish to Hub
29
+ publish [hub-url] Build all widgets and publish to Hub
30
30
  login [hub-url] Authenticate with GlassHome Hub
31
31
  info [name] Show widget metadata and bundle info
32
32
  upgrade Upgrade @glasshome/widget-sdk to latest version
@@ -130,8 +130,9 @@ switch (effectiveCommand) {
130
130
  }
131
131
 
132
132
  case "publish": {
133
+ const hubUrlArg = args[0];
133
134
  const { runPublish } = await import("../src/commands/publish");
134
- await runPublish(resolveWidgetDir());
135
+ await runPublish(resolveWidgetDir(), hubUrlArg);
135
136
  outro("Done");
136
137
  break;
137
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glasshome/widget-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "CLI for creating and managing GlassHome widgets",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,7 +14,7 @@ import {
14
14
  } from "../utils/manifest";
15
15
  import { runLogin } from "./login";
16
16
 
17
- export async function runPublish(cwd: string): Promise<void> {
17
+ export async function runPublish(cwd: string, hubUrlOverride?: string): Promise<void> {
18
18
  // Step 1: Validate all widgets
19
19
  log.info("Running validation...");
20
20
  const { runValidate } = await import("./validate");
@@ -33,7 +33,7 @@ export async function runPublish(cwd: string): Promise<void> {
33
33
  const bump = await select({
34
34
  message: `Current version: ${currentVersion}. Bump version?`,
35
35
  options: [
36
- { value: "keep", label: `Keep ${currentVersion}` },
36
+ { value: "keep", label: `Keep ${currentVersion}`, hint: "fails if already published" },
37
37
  {
38
38
  value: "patch",
39
39
  label: `Patch (${semver.inc(currentVersion, "patch")})`,
@@ -100,7 +100,8 @@ export async function runPublish(cwd: string): Promise<void> {
100
100
  }
101
101
 
102
102
  // Step 6: Authenticate with Hub
103
- const hubUrl = getHubUrl();
103
+ const hubUrl = hubUrlOverride ?? getHubUrl();
104
+ log.info(`Hub: ${hubUrl}`);
104
105
  let token = await getToken(hubUrl);
105
106
 
106
107
  if (!token) {
package/src/utils/auth.ts CHANGED
@@ -87,7 +87,12 @@ export function clearToken(): void {
87
87
  }
88
88
 
89
89
  export function getHubUrl(): string {
90
- return getStoredAuth()?.hubUrl ?? "https://glasshome.app";
90
+ const stored = getStoredAuth()?.hubUrl;
91
+ // Ignore localhost URLs from local dev sessions
92
+ if (stored && !stored.includes("localhost") && !stored.includes("127.0.0.1")) {
93
+ return stored;
94
+ }
95
+ return "https://glasshome.app";
91
96
  }
92
97
 
93
98
  export function getScope(): string | null {