@lukoweb/apitogo 0.1.112 → 0.1.113

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.
Files changed (2) hide show
  1. package/dist/cli/cli.js +23 -2
  2. package/package.json +1 -1
package/dist/cli/cli.js CHANGED
@@ -5801,7 +5801,7 @@ import {
5801
5801
  // package.json
5802
5802
  var package_default = {
5803
5803
  name: "@lukoweb/apitogo",
5804
- version: "0.1.112",
5804
+ version: "0.1.113",
5805
5805
  type: "module",
5806
5806
  sideEffects: [
5807
5807
  "**/*.css",
@@ -21883,6 +21883,7 @@ var init_default = {
21883
21883
  };
21884
21884
 
21885
21885
  // src/cli/login/handler.ts
21886
+ import readline from "node:readline/promises";
21886
21887
  import open from "open";
21887
21888
 
21888
21889
  // src/cli/platform/device-auth.ts
@@ -21926,6 +21927,17 @@ async function pollDeviceToken(apiUrl, deviceCode) {
21926
21927
  function sleep4(ms) {
21927
21928
  return new Promise((resolve) => setTimeout(resolve, ms));
21928
21929
  }
21930
+ async function waitForEnter(promptText) {
21931
+ const rl = readline.createInterface({
21932
+ input: process.stdin,
21933
+ output: process.stdout
21934
+ });
21935
+ try {
21936
+ await rl.question(promptText);
21937
+ } finally {
21938
+ rl.close();
21939
+ }
21940
+ }
21929
21941
  function resolveLoginApiUrl() {
21930
21942
  return (process.env.APITOGO_API_URL?.trim() || DEFAULT_API_URL).replace(
21931
21943
  /\/+$/,
@@ -21941,11 +21953,20 @@ async function login() {
21941
21953
  const device = await requestDeviceCode(apiUrl);
21942
21954
  printDiagnosticsToConsole(`Your login code: ${device.userCode}`);
21943
21955
  printDiagnosticsToConsole(
21944
- `If your browser doesn't open, visit ${device.verificationUri} and enter code ${device.userCode}`
21956
+ "We'll open your browser to confirm this code and sign in. Come back to this terminal once you're done."
21945
21957
  );
21958
+ await waitForEnter("Press Enter to open your browser...");
21959
+ let openedBrowser = true;
21946
21960
  try {
21947
21961
  await open(device.verificationUriComplete);
21948
21962
  } catch {
21963
+ openedBrowser = false;
21964
+ }
21965
+ if (!openedBrowser) {
21966
+ printDiagnosticsToConsole(
21967
+ `Couldn't open your browser automatically. Visit this link to continue:
21968
+ ${device.verificationUriComplete}`
21969
+ );
21949
21970
  }
21950
21971
  const deadline = Date.now() + device.expiresIn * 1e3;
21951
21972
  const intervalMs = Math.max(1, device.interval) * 1e3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.112",
3
+ "version": "0.1.113",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",