Compare commits

...

3 Commits

Author SHA1 Message Date
Jarvis
6e26623cbe fix: scope Gitea registry to @mosaic packages only during gateway install
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
The --registry flag overrides all package resolution, causing npm to
look for third-party deps (e.g. @anthropic-ai/sdk) on Gitea. Fix by
writing a scoped .npmrc that routes only @mosaic/* to Gitea while
letting everything else resolve from npmjs normally.

Bump to 0.0.13.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 14:05:47 -05:00
7560c7dee7 fix: gateway install uses Gitea registry instead of npmjs (#373)
Some checks failed
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/publish Pipeline failed
2026-04-04 18:59:40 +00:00
982a0e8f83 chore: bump @mosaic/mosaic and @mosaic/cli to 0.0.11 (#372)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/push/publish Pipeline was successful
2026-04-04 18:47:03 +00:00
4 changed files with 29 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@mosaic/cli",
"version": "0.0.10",
"version": "0.0.13",
"repository": {
"type": "git",
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",

View File

@@ -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,17 +207,32 @@ function sleep(ms: number): Promise<void> {
// ─── 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', {
stdio: 'inherit',
timeout: 120_000,
});
console.log('Installing @mosaic/gateway from Gitea registry...');
// Scope only @mosaic packages to Gitea; all other deps resolve from npmjs normally
const npmrcContent = `@mosaic:registry=${GITEA_REGISTRY}\n`;
const tmpNpmrc = join(GATEWAY_HOME, '.npmrc');
ensureDirs();
writeFileSync(tmpNpmrc, npmrcContent);
try {
execSync(`npm install -g @mosaic/gateway@latest --userconfig=${tmpNpmrc}`, {
stdio: 'inherit',
timeout: 120_000,
});
} finally {
try {
unlinkSync(tmpNpmrc);
} catch {
// Ignore cleanup failure
}
}
}
export function uninstallGatewayPackage(): void {
try {
execSync('npm uninstall -g @mosaicstack/gateway', {
execSync('npm uninstall -g @mosaic/gateway', {
stdio: 'inherit',
timeout: 60_000,
});
@@ -238,15 +243,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;
}

View File

@@ -142,7 +142,7 @@ async function doInstall(rl: ReturnType<typeof createInterface>, 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;
}

View File

@@ -1,6 +1,6 @@
{
"name": "@mosaic/mosaic",
"version": "0.0.10",
"version": "0.0.13",
"repository": {
"type": "git",
"url": "https://git.mosaicstack.dev/mosaic/mosaic-stack.git",