fix: scope Gitea registry to @mosaic packages only (#374)
This commit was merged in pull request #374.
This commit is contained in:
@@ -211,10 +211,23 @@ const GITEA_REGISTRY = 'https://git.mosaicstack.dev/api/packages/mosaic/npm/';
|
||||
|
||||
export function installGatewayPackage(): void {
|
||||
console.log('Installing @mosaic/gateway from Gitea registry...');
|
||||
execSync(`npm install -g @mosaic/gateway@latest --registry=${GITEA_REGISTRY}`, {
|
||||
stdio: 'inherit',
|
||||
timeout: 120_000,
|
||||
});
|
||||
// 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 {
|
||||
|
||||
Reference in New Issue
Block a user