nemonicon-cli 0.1.1 → 0.1.2
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/dist/index.js +7 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ function loadPartialConfig() {
|
|
|
28
28
|
if (envToken) {
|
|
29
29
|
return {
|
|
30
30
|
token: envToken,
|
|
31
|
-
apiUrl: envUrl ?? "https://
|
|
31
|
+
apiUrl: envUrl ?? "https://app.nemonicon.com",
|
|
32
32
|
protectionBypass: process.env.NEMONICON_PROTECTION_BYPASS || void 0,
|
|
33
33
|
authMethod: "static"
|
|
34
34
|
};
|
|
@@ -705,7 +705,7 @@ Run \`nemonicon login\` to sign in again.`
|
|
|
705
705
|
|
|
706
706
|
// src/commands/auth.ts
|
|
707
707
|
import { createInterface } from "readline";
|
|
708
|
-
var DEFAULT_API_URL = "https://
|
|
708
|
+
var DEFAULT_API_URL = "https://app.nemonicon.com";
|
|
709
709
|
function prompt(question, defaultValue) {
|
|
710
710
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
711
711
|
const suffix = defaultValue ? ` (${defaultValue})` : "";
|
|
@@ -753,7 +753,7 @@ Config was saved to ~/.nemonicon/config.json \u2014 you can edit it manually.`
|
|
|
753
753
|
// src/commands/login.ts
|
|
754
754
|
import { Command as Command2 } from "commander";
|
|
755
755
|
import { createInterface as createInterface2 } from "readline";
|
|
756
|
-
var DEFAULT_API_URL2 = "https://
|
|
756
|
+
var DEFAULT_API_URL2 = "https://app.nemonicon.com";
|
|
757
757
|
function prompt2(question, defaultValue) {
|
|
758
758
|
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
759
759
|
const suffix = defaultValue ? ` (${defaultValue})` : "";
|
|
@@ -781,9 +781,10 @@ var loginCommand = new Command2("login").description(
|
|
|
781
781
|
}
|
|
782
782
|
apiUrl = apiUrl.replace(/\/+$/, "");
|
|
783
783
|
const protectionBypass = options.protectionBypass ?? existing?.protectionBypass;
|
|
784
|
+
const apiUrlChanged = existing?.apiUrl !== void 0 && existing.apiUrl.replace(/\/+$/, "") !== apiUrl;
|
|
784
785
|
console.log(`Discovering OAuth endpoints at ${apiUrl}...`);
|
|
785
786
|
const endpoints = await discoverEndpoints(apiUrl, protectionBypass);
|
|
786
|
-
let clientId = existing?.clientId;
|
|
787
|
+
let clientId = apiUrlChanged ? void 0 : existing?.clientId;
|
|
787
788
|
if (!clientId) {
|
|
788
789
|
console.log("Registering CLI as an OAuth client...");
|
|
789
790
|
clientId = await registerClient(
|
|
@@ -794,8 +795,8 @@ var loginCommand = new Command2("login").description(
|
|
|
794
795
|
apiUrl,
|
|
795
796
|
clientId,
|
|
796
797
|
protectionBypass,
|
|
797
|
-
|
|
798
|
-
|
|
798
|
+
...!apiUrlChanged && existing?.token ? { token: existing.token } : {},
|
|
799
|
+
...!apiUrlChanged && existing?.authMethod ? { authMethod: existing.authMethod } : {}
|
|
799
800
|
};
|
|
800
801
|
saveConfig(next);
|
|
801
802
|
}
|