@openfort/cli 0.1.0
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/bin.js +24 -0
- package/dist/chunk-SZO4OB6U.js +23 -0
- package/dist/cli.js +2886 -0
- package/package.json +30 -0
- package/src/bin.ts +25 -0
package/dist/bin.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CREDENTIALS_PATH
|
|
3
|
+
} from "./chunk-SZO4OB6U.js";
|
|
4
|
+
|
|
5
|
+
// src/bin.ts
|
|
6
|
+
import { existsSync, readFileSync } from "fs";
|
|
7
|
+
function loadEnvIntoProcess(filePath) {
|
|
8
|
+
if (!existsSync(filePath)) return;
|
|
9
|
+
const content = readFileSync(filePath, "utf-8");
|
|
10
|
+
for (const line of content.split("\n")) {
|
|
11
|
+
const trimmed = line.trim();
|
|
12
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
13
|
+
const eqIndex = trimmed.indexOf("=");
|
|
14
|
+
if (eqIndex === -1) continue;
|
|
15
|
+
const key = trimmed.slice(0, eqIndex).trim();
|
|
16
|
+
const value = trimmed.slice(eqIndex + 1).trim();
|
|
17
|
+
if (!process.env[key]) {
|
|
18
|
+
process.env[key] = value;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
loadEnvIntoProcess(CREDENTIALS_PATH);
|
|
23
|
+
var { default: cli } = await import("./cli.js");
|
|
24
|
+
cli.serve();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/config.ts
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
import { mkdirSync } from "fs";
|
|
5
|
+
function getConfigDir() {
|
|
6
|
+
if (process.env.XDG_CONFIG_HOME) {
|
|
7
|
+
return join(process.env.XDG_CONFIG_HOME, "openfort");
|
|
8
|
+
}
|
|
9
|
+
if (process.platform === "win32" && process.env.APPDATA) {
|
|
10
|
+
return join(process.env.APPDATA, "openfort");
|
|
11
|
+
}
|
|
12
|
+
return join(homedir(), ".config", "openfort");
|
|
13
|
+
}
|
|
14
|
+
var CONFIG_DIR = getConfigDir();
|
|
15
|
+
var CREDENTIALS_PATH = join(CONFIG_DIR, "credentials");
|
|
16
|
+
function ensureConfigDir() {
|
|
17
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
CREDENTIALS_PATH,
|
|
22
|
+
ensureConfigDir
|
|
23
|
+
};
|