getContext() — astro Function Reference
Architecture documentation for the getContext() function in context.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD df07cdeb_75ba_9642_2b65_5219a00c25e0["getContext()"] 4b7851d8_a04b_b68f_e63e_37c4acd250af["context.ts"] df07cdeb_75ba_9642_2b65_5219a00c25e0 -->|defined in| 4b7851d8_a04b_b68f_e63e_37c4acd250af style df07cdeb_75ba_9642_2b65_5219a00c25e0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/upgrade/src/actions/context.ts lines 30–60
export async function getContext(argv: string[]): Promise<Context> {
const flags = arg(
{
'--dry-run': Boolean,
'--help': Boolean,
'-h': '--help',
},
{ argv, permissive: true },
);
const packageManager = (await detect({
// Include the `install-metadata` strategy to have the package manager that's
// used for installation take precedence
strategies: ['install-metadata', 'lockfile', 'packageManager-field'],
})) ?? { agent: 'npm', name: 'npm' };
const { _: [version = 'latest'] = [], '--help': help = false, '--dry-run': dryRun } = flags;
return {
help,
prompt,
packageManager,
packages: [],
cwd: new URL(pathToFileURL(process.cwd()) + '/'),
dryRun,
version,
exit(code) {
process.exit(code);
},
} satisfies Context;
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does getContext() do?
getContext() is a function in the astro codebase, defined in packages/upgrade/src/actions/context.ts.
Where is getContext() defined?
getContext() is defined in packages/upgrade/src/actions/context.ts at line 30.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free