@glasshome/widget-cli 0.4.12 → 0.4.13
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 +3 -1
- package/package.json +1 -1
- package/src/commands/connect.ts +10 -1
package/bin/cli.ts
CHANGED
|
@@ -25,6 +25,7 @@ Commands:
|
|
|
25
25
|
add Add a new widget to the project
|
|
26
26
|
build Build all widgets (per-widget, self-contained bundles)
|
|
27
27
|
connect <url> Connect to a running dashboard for live testing
|
|
28
|
+
--re-auth discards stored credentials and re-runs device approval
|
|
28
29
|
validate [name] Validate all widgets or a specific one
|
|
29
30
|
publish [hub-url] Build and publish a widget to Hub
|
|
30
31
|
login [hub-url] Authenticate with GlassHome Hub
|
|
@@ -60,6 +61,7 @@ const { values: flags, positionals } = parseArgs({
|
|
|
60
61
|
name: { type: "string" },
|
|
61
62
|
bump: { type: "string" },
|
|
62
63
|
scope: { type: "string" },
|
|
64
|
+
"re-auth": { type: "boolean" },
|
|
63
65
|
help: { type: "boolean", short: "h" },
|
|
64
66
|
},
|
|
65
67
|
allowPositionals: true,
|
|
@@ -119,7 +121,7 @@ switch (effectiveCommand) {
|
|
|
119
121
|
process.exit(1);
|
|
120
122
|
}
|
|
121
123
|
const { runConnect } = await import("../src/commands/connect");
|
|
122
|
-
await runConnect(url, resolveWidgetDir());
|
|
124
|
+
await runConnect(url, resolveWidgetDir(), { reAuth: flags["re-auth"] === true });
|
|
123
125
|
break;
|
|
124
126
|
}
|
|
125
127
|
|
package/package.json
CHANGED
package/src/commands/connect.ts
CHANGED
|
@@ -87,7 +87,11 @@ async function uploadAllWidgets(apiUrl: string, distDir: string, token: string):
|
|
|
87
87
|
return slugs;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
export async function runConnect(
|
|
90
|
+
export async function runConnect(
|
|
91
|
+
apiUrl: string,
|
|
92
|
+
cwd: string,
|
|
93
|
+
opts: { reAuth?: boolean } = {},
|
|
94
|
+
): Promise<void> {
|
|
91
95
|
const distDir = resolve(cwd, "dist");
|
|
92
96
|
const solid = (await import("vite-plugin-solid")).default;
|
|
93
97
|
const buildOpts = { srcDir: "src", outDir: "dist", plugins: [solid()] };
|
|
@@ -119,6 +123,11 @@ export async function runConnect(apiUrl: string, cwd: string): Promise<void> {
|
|
|
119
123
|
const host = extractHost(api);
|
|
120
124
|
let token = "";
|
|
121
125
|
|
|
126
|
+
if (opts.reAuth) {
|
|
127
|
+
clearHostToken(host);
|
|
128
|
+
log.info("Discarded stored credentials (--re-auth).");
|
|
129
|
+
}
|
|
130
|
+
|
|
122
131
|
// Validate stored token before using it
|
|
123
132
|
const existingToken = getHostToken(host);
|
|
124
133
|
if (existingToken) {
|