@todoforai/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.
- package/dist/todoai.js +13 -3
- package/package.json +1 -1
package/dist/todoai.js
CHANGED
|
@@ -43740,8 +43740,17 @@ class ScopedConfig {
|
|
|
43740
43740
|
// src/credentials.ts
|
|
43741
43741
|
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
43742
43742
|
import { dirname as dirname2, join as join2 } from "path";
|
|
43743
|
-
import { homedir as homedir2 } from "os";
|
|
43744
|
-
|
|
43743
|
+
import { homedir as homedir2, platform as platform2 } from "os";
|
|
43744
|
+
function credentialsPath2() {
|
|
43745
|
+
const sys = platform2();
|
|
43746
|
+
if (sys === "win32")
|
|
43747
|
+
return join2(homedir2(), "AppData", "Roaming", "todoforai", "credentials.json");
|
|
43748
|
+
if (sys === "darwin")
|
|
43749
|
+
return join2(homedir2(), "Library", "Application Support", "todoforai", "credentials.json");
|
|
43750
|
+
const xdg = process.env.XDG_CONFIG_HOME || join2(homedir2(), ".config");
|
|
43751
|
+
return join2(xdg, "todoforai", "credentials.json");
|
|
43752
|
+
}
|
|
43753
|
+
var CREDENTIALS_PATH2 = credentialsPath2();
|
|
43745
43754
|
function read() {
|
|
43746
43755
|
if (!existsSync2(CREDENTIALS_PATH2))
|
|
43747
43756
|
return {};
|
|
@@ -43752,7 +43761,8 @@ function read() {
|
|
|
43752
43761
|
}
|
|
43753
43762
|
}
|
|
43754
43763
|
function readCredential(apiUrl) {
|
|
43755
|
-
|
|
43764
|
+
const v = read()[apiUrl];
|
|
43765
|
+
return typeof v === "string" ? v : "";
|
|
43756
43766
|
}
|
|
43757
43767
|
function writeCredential(apiUrl, apiKey) {
|
|
43758
43768
|
const data = read();
|