@resourcexjs/cli 2.10.0 → 2.12.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/index.js CHANGED
@@ -14963,6 +14963,7 @@ import { mkdir, readdir as readdir3, stat as stat3, unlink, writeFile } from "fs
14963
14963
  import { join as join3 } from "path";
14964
14964
  import { mkdir as mkdir2, readdir as readdir22, readFile as readFile3, rm, stat as stat22, unlink as unlink2, writeFile as writeFile2 } from "fs/promises";
14965
14965
  import { join as join22 } from "path";
14966
+ import { existsSync, readFileSync } from "fs";
14966
14967
  import { homedir } from "os";
14967
14968
  import { join as join32 } from "path";
14968
14969
 
@@ -15200,12 +15201,33 @@ class NodeProvider {
15200
15201
  createSourceLoader(_config) {
15201
15202
  return new FolderSourceLoader;
15202
15203
  }
15204
+ getDefaults(config2) {
15205
+ const envRegistry = process.env.RESOURCEX_REGISTRY;
15206
+ if (envRegistry) {
15207
+ return { registry: envRegistry };
15208
+ }
15209
+ const basePath = config2.path ?? DEFAULT_BASE_PATH;
15210
+ const configPath = join32(basePath, "config.json");
15211
+ try {
15212
+ if (existsSync(configPath)) {
15213
+ const raw = JSON.parse(readFileSync(configPath, "utf-8"));
15214
+ if (raw.registries) {
15215
+ const defaultEntry = raw.registries.find((r3) => r3.default);
15216
+ if (defaultEntry?.url)
15217
+ return { registry: defaultEntry.url };
15218
+ }
15219
+ if (raw.registry)
15220
+ return { registry: raw.registry };
15221
+ }
15222
+ } catch {}
15223
+ return {};
15224
+ }
15203
15225
  }
15204
15226
  var LOCAL_DIR = "_local", LATEST_FILE = ".latest", DEFAULT_BASE_PATH;
15205
15227
  var init_dist2 = __esm(() => {
15206
15228
  init_dist();
15207
15229
  init_dist();
15208
- DEFAULT_BASE_PATH = `${homedir()}/.resourcex`;
15230
+ DEFAULT_BASE_PATH = `${homedir()}/.deepractice/resourcex`;
15209
15231
  });
15210
15232
 
15211
15233
  // ../../node_modules/.bun/@hono+node-server@1.19.9+115df24086ffac64/node_modules/@hono/node-server/dist/index.mjs
@@ -17142,7 +17164,7 @@ import { createResourceX, setProvider } from "resourcexjs";
17142
17164
  // src/lib/paths.ts
17143
17165
  import { homedir as homedir2 } from "os";
17144
17166
  import { join as join5 } from "path";
17145
- var RX_HOME = process.env.RX_HOME || join5(homedir2(), ".resourcex");
17167
+ var RX_HOME = process.env.RESOURCEX_HOME || process.env.RX_HOME || join5(homedir2(), ".deepractice", "resourcex");
17146
17168
  var PATHS = {
17147
17169
  root: RX_HOME,
17148
17170
  config: join5(RX_HOME, "config.json"),
@@ -17164,7 +17186,7 @@ async function getConfig() {
17164
17186
  fileConfig.registries = [{ name: "default", url: fileConfig.registry, default: true }];
17165
17187
  delete fileConfig.registry;
17166
17188
  }
17167
- const envRegistry = process.env.RX_REGISTRY;
17189
+ const envRegistry = process.env.RESOURCEX_REGISTRY ?? process.env.RX_REGISTRY;
17168
17190
  let registry2;
17169
17191
  if (envRegistry !== undefined) {
17170
17192
  registry2 = envRegistry || undefined;
@@ -17877,4 +17899,4 @@ var main = defineCommand({
17877
17899
  });
17878
17900
  runMain(main);
17879
17901
 
17880
- //# debugId=1CE1059D7A48473B64756E2164756E21
17902
+ //# debugId=090B79A8A40BC9F264756E2164756E21