getVersion() — astro Function Reference
Architecture documentation for the getVersion() function in messages.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD e2beb907_71eb_d2c8_8ee0_8c28d992659b["getVersion()"] 7e47cce3_632a_b102_4402_d13baf44fc8e["messages.ts"] e2beb907_71eb_d2c8_8ee0_8c28d992659b -->|defined in| 7e47cce3_632a_b102_4402_d13baf44fc8e 638a142e_6b28_ef9d_3872_0dbae7002b93["getRegistry()"] e2beb907_71eb_d2c8_8ee0_8c28d992659b -->|calls| 638a142e_6b28_ef9d_3872_0dbae7002b93 style e2beb907_71eb_d2c8_8ee0_8c28d992659b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/create-astro/src/messages.ts lines 54–75
export const getVersion = (
packageManager: string,
packageName: string,
packageTag = 'latest',
fallback = '',
) =>
new Promise<string>(async (resolve) => {
let registry = await getRegistry(packageManager);
const { version } = await fetch(`${registry}/${packageName}/${packageTag}`, {
redirect: 'follow',
signal: AbortSignal.timeout(10_000),
})
.then((res) => res.json())
.catch(() => {
const fallbackName = fallback || `'latest'`;
console.warn(
`Unable to fetch latest ${packageName} version from the npm registry. Using ${fallbackName} instead.`,
);
return { version: fallback };
});
return resolve(version);
});
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does getVersion() do?
getVersion() is a function in the astro codebase, defined in packages/create-astro/src/messages.ts.
Where is getVersion() defined?
getVersion() is defined in packages/create-astro/src/messages.ts at line 54.
What does getVersion() call?
getVersion() calls 1 function(s): getRegistry.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free