runCommand() — astro Function Reference
Architecture documentation for the runCommand() function in index.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 25e670b0_baf7_d1c0_92b6_8e24a4a2266b["runCommand()"] 77e94539_cbbc_447e_0bb6_d3977c1fa5b1["index.ts"] 25e670b0_baf7_d1c0_92b6_8e24a4a2266b -->|defined in| 77e94539_cbbc_447e_0bb6_d3977c1fa5b1 7bca0dcc_def0_4a57_f212_a606fe44f550["cli()"] 7bca0dcc_def0_4a57_f212_a606fe44f550 -->|calls| 25e670b0_baf7_d1c0_92b6_8e24a4a2266b style 25e670b0_baf7_d1c0_92b6_8e24a4a2266b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/cli/index.ts lines 53–270
async function runCommand(cmd: string, flags: yargs.Arguments) {
const [
{ createLoggerFromFlags },
{ piccoloreTextStyler: textStyler },
{ BuildTimeAstroVersionProvider },
{ LoggerHelpDisplay },
{ CliCommandRunner },
] = await Promise.all([
import('./flags.js'),
import('./infra/piccolore-text-styler.js'),
import('./infra/build-time-astro-version-provider.js'),
import('./infra/logger-help-display.js'),
import('./infra/cli-command-runner.js'),
]);
const logger = createLoggerFromFlags(flags);
const astroVersionProvider = new BuildTimeAstroVersionProvider();
const helpDisplay = new LoggerHelpDisplay({
logger,
flags,
textStyler,
astroVersionProvider,
});
const runner = new CliCommandRunner({ helpDisplay });
// These commands can run directly without parsing the user config.
switch (cmd) {
/** Display --help flag */
case 'help': {
const { DEFAULT_HELP_PAYLOAD } = await import('./help/index.js');
helpDisplay.show(DEFAULT_HELP_PAYLOAD);
return;
}
/** Display --version flag */
case 'version': {
const { formatVersion } = await import('./utils/format-version.js');
logger.info(
'SKIP_FORMAT',
formatVersion({ name: 'astro', textStyler, astroVersionProvider }),
);
return;
}
case 'info': {
const [
{ ProcessOperatingSystemProvider },
{ CliAstroConfigResolver },
{ ProcessPackageManagerUserAgentProvider },
{ ProcessNodeVersionProvider },
{ CliDebugInfoProvider },
{ TinyexecCommandExecutor },
{ getPackageManager },
{ StyledDebugInfoFormatter },
{ PromptsPrompt },
{ CliClipboard },
{ PassthroughTextStyler },
{ infoCommand },
] = await Promise.all([
import('./infra/process-operating-system-provider.js'),
import('./info/infra/cli-astro-config-resolver.js'),
import('./info/infra/process-package-manager-user-agent-provider.js'),
import('./info/infra/process-node-version-provider.js'),
import('./info/infra/cli-debug-info-provider.js'),
import('./infra/tinyexec-command-executor.js'),
import('./info/core/get-package-manager.js'),
import('./info/infra/styled-debug-info-formatter.js'),
import('./info/infra/prompts-prompt.js'),
import('./info/infra/cli-clipboard.js'),
import('./infra/passthrough-text-styler.js'),
import('./info/core/info.js'),
]);
const operatingSystemProvider = new ProcessOperatingSystemProvider();
const astroConfigResolver = new CliAstroConfigResolver({ flags });
const commandExecutor = new TinyexecCommandExecutor();
const packageManagerUserAgentProvider = new ProcessPackageManagerUserAgentProvider();
const nodeVersionProvider = new ProcessNodeVersionProvider();
const debugInfoProvider = new CliDebugInfoProvider({
config: await astroConfigResolver.resolve(),
astroVersionProvider,
operatingSystemProvider,
packageManager: await getPackageManager({
packageManagerUserAgentProvider,
commandExecutor,
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does runCommand() do?
runCommand() is a function in the astro codebase, defined in packages/astro/src/cli/index.ts.
Where is runCommand() defined?
runCommand() is defined in packages/astro/src/cli/index.ts at line 53.
What calls runCommand()?
runCommand() is called by 1 function(s): cli.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free