@numericoach/gskills-admin-cli 0.1.9 → 0.1.10

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.
@@ -177,9 +177,11 @@ var loginWithGSkills = async (input) => {
177
177
  const startUrl = new URL("/api/cli/auth/start", baseUrl);
178
178
  startUrl.searchParams.set("redirect_uri", redirectUri);
179
179
  startUrl.searchParams.set("state", state);
180
- await openUrl(startUrl.toString());
181
- process.stderr.write(`Opened ${startUrl.toString()}
180
+ const opened = await openUrl(startUrl.toString());
181
+ if (opened) {
182
+ process.stderr.write(`Opened ${startUrl.toString()}
182
183
  `);
184
+ }
183
185
  });
184
186
  if (callback.state !== state) {
185
187
  throw new CliError("GSkills auth state mismatch", 403);
@@ -285,13 +287,15 @@ var normalizeBaseUrl = (value) => {
285
287
  return url.toString().replace(/\/$/, "");
286
288
  };
287
289
  var openUrl = async (url) => {
288
- const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
289
- const args = process.platform === "win32" ? ["/c", "start", "", url] : [url];
290
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "powershell.exe" : "xdg-open";
291
+ const args = process.platform === "win32" ? ["-NoProfile", "-NonInteractive", "-Command", "Start-Process -FilePath $args[0]", url] : [url];
290
292
  try {
291
293
  await execFileAsync(command, args);
294
+ return true;
292
295
  } catch {
293
296
  process.stderr.write(`Could not open browser automatically. Use ${url}
294
297
  `);
298
+ return false;
295
299
  }
296
300
  };
297
301
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@numericoach/gskills-admin-cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Admin-only CLI for GSkills super-admin operations.",