@axium/client 0.6.0 → 0.7.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.
@@ -1,4 +1,5 @@
1
1
  export declare const configDir: string;
2
+ export declare const cacheDir: string;
2
3
  export declare function session(): {
3
4
  id: string;
4
5
  userId: string;
@@ -1,15 +1,17 @@
1
1
  import * as io from '@axium/core/node/io';
2
2
  import { loadPlugin } from '@axium/core/node/plugins';
3
- import { mkdirSync, readFileSync } from 'node:fs';
3
+ import { mkdirSync } from 'node:fs';
4
4
  import { homedir } from 'node:os';
5
5
  import { join } from 'node:path/posix';
6
6
  import * as z from 'zod';
7
+ import { ClientConfig, config } from '../config.js';
7
8
  import { fetchAPI, setPrefix, setToken } from '../requests.js';
8
9
  import { getCurrentSession } from '../user.js';
9
- import { ClientConfig, config } from '../config.js';
10
- export const configDir = join(homedir(), '.config/axium');
10
+ export const configDir = join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), 'axium');
11
11
  mkdirSync(configDir, { recursive: true });
12
12
  const axcConfig = join(configDir, 'config.json');
13
+ export const cacheDir = join(process.env.XDG_CACHE_HOME || join(homedir(), '.cache'), 'axium');
14
+ mkdirSync(cacheDir, { recursive: true });
13
15
  export function session() {
14
16
  if (!config.token)
15
17
  io.exit('Not logged in.', 4);
@@ -19,7 +21,7 @@ export function session() {
19
21
  }
20
22
  export async function loadConfig(safe) {
21
23
  try {
22
- Object.assign(config, ClientConfig.parse(JSON.parse(readFileSync(axcConfig, 'utf-8'))));
24
+ Object.assign(config, io.readJSON(axcConfig, ClientConfig));
23
25
  if (config.server)
24
26
  setPrefix(config.server);
25
27
  if (config.token)
package/dist/cli/index.js CHANGED
@@ -93,7 +93,7 @@ try {
93
93
  const opt = action.optsWithGlobals();
94
94
  if (!config.token)
95
95
  return;
96
- if (!opt.cacheOnly)
96
+ if (!opt.cacheOnly && action.name() != 'login')
97
97
  await updateCache(opt.refreshSession);
98
98
  });
99
99
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/client",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "author": "James Prevett <jp@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -40,7 +40,7 @@
40
40
  "build": "tsc"
41
41
  },
42
42
  "peerDependencies": {
43
- "@axium/core": ">=0.9.0",
43
+ "@axium/core": ">=0.10.0",
44
44
  "utilium": "^2.3.8",
45
45
  "zod": "^4.0.5",
46
46
  "svelte": "^5.36.0"