@resourcexjs/cli 2.11.0 → 2.13.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 +69 -5
- package/dist/index.js.map +4 -4
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -14963,9 +14963,9 @@ 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
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
14967
14967
|
import { homedir } from "os";
|
|
14968
|
-
import { join as join32 } from "path";
|
|
14968
|
+
import { dirname, join as join32 } from "path";
|
|
14969
14969
|
|
|
14970
14970
|
class FileSystemRXAStore {
|
|
14971
14971
|
basePath;
|
|
@@ -15222,12 +15222,76 @@ class NodeProvider {
|
|
|
15222
15222
|
} catch {}
|
|
15223
15223
|
return {};
|
|
15224
15224
|
}
|
|
15225
|
+
configPath(config2) {
|
|
15226
|
+
const basePath = config2.path ?? DEFAULT_BASE_PATH;
|
|
15227
|
+
return join32(basePath, "config.json");
|
|
15228
|
+
}
|
|
15229
|
+
readConfig(config2) {
|
|
15230
|
+
const configPath = this.configPath(config2);
|
|
15231
|
+
try {
|
|
15232
|
+
if (existsSync(configPath)) {
|
|
15233
|
+
const raw = JSON.parse(readFileSync(configPath, "utf-8"));
|
|
15234
|
+
if (raw.registry && !raw.registries) {
|
|
15235
|
+
raw.registries = [{ name: "default", url: raw.registry, default: true }];
|
|
15236
|
+
delete raw.registry;
|
|
15237
|
+
}
|
|
15238
|
+
return raw;
|
|
15239
|
+
}
|
|
15240
|
+
} catch {}
|
|
15241
|
+
return {};
|
|
15242
|
+
}
|
|
15243
|
+
writeConfig(config2, data) {
|
|
15244
|
+
const configPath = this.configPath(config2);
|
|
15245
|
+
mkdirSync(dirname(configPath), { recursive: true });
|
|
15246
|
+
writeFileSync(configPath, JSON.stringify(data, null, 2));
|
|
15247
|
+
}
|
|
15248
|
+
getRegistries(config2) {
|
|
15249
|
+
return this.readConfig(config2).registries ?? [];
|
|
15250
|
+
}
|
|
15251
|
+
addRegistry(config2, name, url2, setDefault) {
|
|
15252
|
+
const data = this.readConfig(config2);
|
|
15253
|
+
const registries = data.registries ?? [];
|
|
15254
|
+
if (registries.some((r3) => r3.name === name)) {
|
|
15255
|
+
throw new Error(`Registry "${name}" already exists`);
|
|
15256
|
+
}
|
|
15257
|
+
const isDefault = setDefault || registries.length === 0;
|
|
15258
|
+
if (isDefault) {
|
|
15259
|
+
for (const r3 of registries)
|
|
15260
|
+
r3.default = false;
|
|
15261
|
+
}
|
|
15262
|
+
registries.push({ name, url: url2, default: isDefault });
|
|
15263
|
+
data.registries = registries;
|
|
15264
|
+
this.writeConfig(config2, data);
|
|
15265
|
+
}
|
|
15266
|
+
removeRegistry(config2, name) {
|
|
15267
|
+
const data = this.readConfig(config2);
|
|
15268
|
+
const registries = data.registries ?? [];
|
|
15269
|
+
const idx = registries.findIndex((r3) => r3.name === name);
|
|
15270
|
+
if (idx === -1) {
|
|
15271
|
+
throw new Error(`Registry "${name}" not found`);
|
|
15272
|
+
}
|
|
15273
|
+
registries.splice(idx, 1);
|
|
15274
|
+
data.registries = registries;
|
|
15275
|
+
this.writeConfig(config2, data);
|
|
15276
|
+
}
|
|
15277
|
+
setDefaultRegistry(config2, name) {
|
|
15278
|
+
const data = this.readConfig(config2);
|
|
15279
|
+
const registries = data.registries ?? [];
|
|
15280
|
+
const entry = registries.find((r3) => r3.name === name);
|
|
15281
|
+
if (!entry) {
|
|
15282
|
+
throw new Error(`Registry "${name}" not found`);
|
|
15283
|
+
}
|
|
15284
|
+
for (const r3 of registries)
|
|
15285
|
+
r3.default = r3.name === name;
|
|
15286
|
+
data.registries = registries;
|
|
15287
|
+
this.writeConfig(config2, data);
|
|
15288
|
+
}
|
|
15225
15289
|
}
|
|
15226
15290
|
var LOCAL_DIR = "_local", LATEST_FILE = ".latest", DEFAULT_BASE_PATH;
|
|
15227
15291
|
var init_dist2 = __esm(() => {
|
|
15228
15292
|
init_dist();
|
|
15229
15293
|
init_dist();
|
|
15230
|
-
DEFAULT_BASE_PATH = `${homedir()}/.resourcex`;
|
|
15294
|
+
DEFAULT_BASE_PATH = `${homedir()}/.deepractice/resourcex`;
|
|
15231
15295
|
});
|
|
15232
15296
|
|
|
15233
15297
|
// ../../node_modules/.bun/@hono+node-server@1.19.9+115df24086ffac64/node_modules/@hono/node-server/dist/index.mjs
|
|
@@ -17164,7 +17228,7 @@ import { createResourceX, setProvider } from "resourcexjs";
|
|
|
17164
17228
|
// src/lib/paths.ts
|
|
17165
17229
|
import { homedir as homedir2 } from "os";
|
|
17166
17230
|
import { join as join5 } from "path";
|
|
17167
|
-
var RX_HOME = process.env.RESOURCEX_HOME || process.env.RX_HOME || join5(homedir2(), ".resourcex");
|
|
17231
|
+
var RX_HOME = process.env.RESOURCEX_HOME || process.env.RX_HOME || join5(homedir2(), ".deepractice", "resourcex");
|
|
17168
17232
|
var PATHS = {
|
|
17169
17233
|
root: RX_HOME,
|
|
17170
17234
|
config: join5(RX_HOME, "config.json"),
|
|
@@ -17899,4 +17963,4 @@ var main = defineCommand({
|
|
|
17899
17963
|
});
|
|
17900
17964
|
runMain(main);
|
|
17901
17965
|
|
|
17902
|
-
//# debugId=
|
|
17966
|
+
//# debugId=EFB446D3FE16011164756E2164756E21
|