From 80f8448a6f097eb4f7e704b886b1f2d5e143745f Mon Sep 17 00:00:00 2001 From: Jarvis Date: Sat, 4 Apr 2026 13:58:50 -0500 Subject: [PATCH] fix: gateway install uses Gitea registry instead of npmjs - Switch all @mosaicstack/gateway refs to @mosaic/gateway - Install from Gitea registry (git.mosaicstack.dev) - Remove duplicate entry resolution (was checking both package names) - Bump @mosaic/mosaic and @mosaic/cli to 0.0.12 Co-Authored-By: Claude Opus 4.6 --- packages/cli/package.json | 2 +- packages/cli/src/commands/gateway/daemon.ts | 28 +++++++------------- packages/cli/src/commands/gateway/install.ts | 2 +- packages/mosaic/package.json | 2 +- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 8364880..9007a9f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@mosaic/cli", - "version": "0.0.11", + "version": "0.0.12", "repository": { "type": "git", "url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git", diff --git a/packages/cli/src/commands/gateway/daemon.ts b/packages/cli/src/commands/gateway/daemon.ts index b716ce6..4c61c73 100644 --- a/packages/cli/src/commands/gateway/daemon.ts +++ b/packages/cli/src/commands/gateway/daemon.ts @@ -91,24 +91,14 @@ export function resolveGatewayEntry(): string { return meta.entryPoint; } - // Try to resolve from globally installed @mosaicstack/gateway - try { - const req = createRequire(import.meta.url); - const pkgPath = req.resolve('@mosaicstack/gateway/package.json'); - const mainEntry = join(resolve(pkgPath, '..'), 'dist', 'main.js'); - if (existsSync(mainEntry)) return mainEntry; - } catch { - // Not installed globally via @mosaicstack - } - - // Try @mosaic/gateway (workspace / dev) + // Try to resolve from globally installed @mosaic/gateway try { const req = createRequire(import.meta.url); const pkgPath = req.resolve('@mosaic/gateway/package.json'); const mainEntry = join(resolve(pkgPath, '..'), 'dist', 'main.js'); if (existsSync(mainEntry)) return mainEntry; } catch { - // Not available + // Not installed globally } throw new Error('Cannot find gateway entry point. Run `mosaic gateway install` first.'); @@ -217,9 +207,11 @@ function sleep(ms: number): Promise { // ─── npm install helper ───────────────────────────────────────────────────── +const GITEA_REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/'; + export function installGatewayPackage(): void { - console.log('Installing @mosaicstack/gateway...'); - execSync('npm install -g @mosaicstack/gateway@latest', { + console.log('Installing @mosaic/gateway from Gitea registry...'); + execSync(`npm install -g @mosaic/gateway@latest --registry=${GITEA_REGISTRY}`, { stdio: 'inherit', timeout: 120_000, }); @@ -227,7 +219,7 @@ export function installGatewayPackage(): void { export function uninstallGatewayPackage(): void { try { - execSync('npm uninstall -g @mosaicstack/gateway', { + execSync('npm uninstall -g @mosaic/gateway', { stdio: 'inherit', timeout: 60_000, }); @@ -238,15 +230,15 @@ export function uninstallGatewayPackage(): void { export function getInstalledGatewayVersion(): string | null { try { - const output = execSync('npm ls -g @mosaicstack/gateway --json --depth=0', { + const output = execSync('npm ls -g @mosaic/gateway --json --depth=0', { encoding: 'utf-8', timeout: 15_000, stdio: ['pipe', 'pipe', 'pipe'], }); const data = JSON.parse(output) as { - dependencies?: { '@mosaicstack/gateway'?: { version?: string } }; + dependencies?: { '@mosaic/gateway'?: { version?: string } }; }; - return data.dependencies?.['@mosaicstack/gateway']?.version ?? null; + return data.dependencies?.['@mosaic/gateway']?.version ?? null; } catch { return null; } diff --git a/packages/cli/src/commands/gateway/install.ts b/packages/cli/src/commands/gateway/install.ts index a3cdc1c..f4ede72 100644 --- a/packages/cli/src/commands/gateway/install.ts +++ b/packages/cli/src/commands/gateway/install.ts @@ -142,7 +142,7 @@ async function doInstall(rl: ReturnType, opts: InstallOp entryPoint = resolveGatewayEntry(); } catch { console.error('Error: Gateway package not found after install.'); - console.error('Check that @mosaicstack/gateway installed correctly.'); + console.error('Check that @mosaic/gateway installed correctly.'); return; } diff --git a/packages/mosaic/package.json b/packages/mosaic/package.json index 0e88e8a..d3f9aab 100644 --- a/packages/mosaic/package.json +++ b/packages/mosaic/package.json @@ -1,6 +1,6 @@ { "name": "@mosaic/mosaic", - "version": "0.0.11", + "version": "0.0.12", "repository": { "type": "git", "url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",