Home / Function/ getRegistry() — astro Function Reference

getRegistry() — astro Function Reference

Architecture documentation for the getRegistry() function in messages.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  638a142e_6b28_ef9d_3872_0dbae7002b93["getRegistry()"]
  7e47cce3_632a_b102_4402_d13baf44fc8e["messages.ts"]
  638a142e_6b28_ef9d_3872_0dbae7002b93 -->|defined in| 7e47cce3_632a_b102_4402_d13baf44fc8e
  e2beb907_71eb_d2c8_8ee0_8c28d992659b["getVersion()"]
  e2beb907_71eb_d2c8_8ee0_8c28d992659b -->|calls| 638a142e_6b28_ef9d_3872_0dbae7002b93
  style 638a142e_6b28_ef9d_3872_0dbae7002b93 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/create-astro/src/messages.ts lines 13–25

async function getRegistry(packageManager: string): Promise<string> {
	if (_registry) return _registry;
	const fallback = 'https://registry.npmjs.org';
	try {
		const { stdout } = await shell(packageManager, ['config', 'get', 'registry']);
		_registry = stdout?.trim()?.replace(/\/$/, '') || fallback;
		// Detect cases where the shell command returned a non-URL (e.g. a warning)
		if (!new URL(_registry).host) _registry = fallback;
	} catch {
		_registry = fallback;
	}
	return _registry;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getRegistry() do?
getRegistry() is a function in the astro codebase, defined in packages/create-astro/src/messages.ts.
Where is getRegistry() defined?
getRegistry() is defined in packages/create-astro/src/messages.ts at line 13.
What calls getRegistry()?
getRegistry() is called by 1 function(s): getVersion.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free