@tokenbuddy/tokenbuddy 1.0.37 → 1.0.39

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.
@@ -0,0 +1,10 @@
1
+ export declare const TB_WORKDIR_ENV = "TB_WORKDIR";
2
+ export declare const DEFAULT_TOKENBUDDY_WORKDIR_RELATIVE: string;
3
+ export interface TokenBuddyWorkdirOptions {
4
+ env?: NodeJS.ProcessEnv;
5
+ homeDir?: string;
6
+ }
7
+ export declare function defaultTokenBuddyWorkdir(homeDir?: string): string;
8
+ export declare function resolveTokenBuddyWorkdir(options?: TokenBuddyWorkdirOptions): string;
9
+ export declare function resolveTokenBuddyWorkdirPath(relativePath: string, options?: TokenBuddyWorkdirOptions): string;
10
+ //# sourceMappingURL=workdir.d.ts.map
@@ -0,0 +1,26 @@
1
+ import * as os from "os";
2
+ import * as path from "path";
3
+ export const TB_WORKDIR_ENV = "TB_WORKDIR";
4
+ export const DEFAULT_TOKENBUDDY_WORKDIR_RELATIVE = path.join(".config", "tokenbuddy");
5
+ function expandHome(input, homeDir) {
6
+ if (input === "~") {
7
+ return homeDir;
8
+ }
9
+ if (input.startsWith("~/")) {
10
+ return path.join(homeDir, input.slice(2));
11
+ }
12
+ return input;
13
+ }
14
+ export function defaultTokenBuddyWorkdir(homeDir = os.homedir()) {
15
+ return path.join(homeDir, DEFAULT_TOKENBUDDY_WORKDIR_RELATIVE);
16
+ }
17
+ export function resolveTokenBuddyWorkdir(options = {}) {
18
+ const env = options.env || process.env;
19
+ const homeDir = options.homeDir || os.homedir();
20
+ const raw = env[TB_WORKDIR_ENV] || defaultTokenBuddyWorkdir(homeDir);
21
+ return path.resolve(expandHome(raw, homeDir));
22
+ }
23
+ export function resolveTokenBuddyWorkdirPath(relativePath, options = {}) {
24
+ return path.join(resolveTokenBuddyWorkdir(options), relativePath);
25
+ }
26
+ //# sourceMappingURL=workdir.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenbuddy/tokenbuddy",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "TokenBuddy Client CLI and Daemon",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@clack/prompts": "^0.7.0",
31
- "@tokenbuddy/contracts": "^1.0.37",
31
+ "@tokenbuddy/contracts": "^1.0.39",
32
32
  "@tokenbuddy/logging": "^1.0.0",
33
33
  "cli-table3": "^0.6.4",
34
34
  "commander": "^12.0.0",