Skip to content

Commit 7387031

Browse files
committed
refactor: update devRegistry handling to accept a URI instead of a boolean flag
1 parent 38045cc commit 7387031

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

packages/project/src/registry.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import * as z from "zod";
99
import { getRequestJson, JaculusRequestError, Logger, RequestFunction } from "@jaculus/common";
1010

1111
export const DefaultRegistryUrl = ["https://registry.jaculus.org"];
12-
export const DevRegistryUrl = "http://127.0.0.1:3737";
1312

1413
/**
1514
*
@@ -80,12 +79,12 @@ export class Registry {
8079
registryUri: string[] | undefined,
8180
public getRequest: RequestFunction,
8281
logger: Logger,
83-
devRegistry?: boolean
82+
devRegistry?: string
8483
) {
8584
this.registryUri = registryUri || DefaultRegistryUrl;
8685
this.logger = logger;
8786
if (devRegistry) {
88-
this.registryUri.unshift(DevRegistryUrl);
87+
this.registryUri.unshift(devRegistry);
8988
}
9089
}
9190

packages/tools/src/commands/lib-install.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@ import { uriRequest } from "../util.js";
44
import path from "path";
55
import { loadPackageJson, splitLibraryNameVersion } from "@jaculus/project/package";
66
import { Project } from "@jaculus/project";
7-
import { DevRegistryUrl, Registry } from "@jaculus/project/registry";
7+
import { Registry } from "@jaculus/project/registry";
88
import { logger } from "../logger.js";
99

1010
const cmd = new Command("Install Jaculus libraries base on project's package.json", {
1111
action: async (options: Record<string, string | boolean>, args: Record<string, string>) => {
1212
const libraryName = args["library"] as string;
13-
const devRegistry = options["dev-registry"] as boolean;
13+
const devRegistry = options["dev-registry"] as string | undefined;
1414
const projectPath = process.cwd();
1515

1616
const pkg = await loadPackageJson(fs, path.join(projectPath, "package.json"));
1717
const project = new Project(fs, projectPath, logger);
18+
19+
console.log("Using registry:", devRegistry);
20+
1821
const registry = new Registry(pkg.jaculus?.registry, uriRequest, logger, devRegistry);
1922

2023
const { name, version } = splitLibraryNameVersion(libraryName);
@@ -34,8 +37,8 @@ const cmd = new Command("Install Jaculus libraries base on project's package.jso
3437
),
3538
],
3639
options: {
37-
"dev-registry": new Opt(`Try to use ${DevRegistryUrl} for library installation`, {
38-
isFlag: true,
40+
"dev-registry": new Opt(`Force to use development registry (provided URI)`, {
41+
required: false,
3942
}),
4043
},
4144
chainable: true,

0 commit comments

Comments
 (0)