Home / Function/ main() — astro Function Reference

main() — astro Function Reference

Architecture documentation for the main() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  b3937b9f_302e_361e_76bb_c3f8dacf79e6["main()"]
  535244c0_21f4_4656_3218_b7b776eeebd0["index.ts"]
  b3937b9f_302e_361e_76bb_c3f8dacf79e6 -->|defined in| 535244c0_21f4_4656_3218_b7b776eeebd0
  8d88d173_6576_a826_512e_4a120d885af7["exit()"]
  b3937b9f_302e_361e_76bb_c3f8dacf79e6 -->|calls| 8d88d173_6576_a826_512e_4a120d885af7
  style b3937b9f_302e_361e_76bb_c3f8dacf79e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/upgrade/src/index.ts lines 12–30

export async function main() {
	// NOTE: In the v7.x version of npm, the default behavior of `npm init` was changed
	// to no longer require `--` to pass args and instead pass `--` directly to us. This
	// broke our arg parser, since `--` is a special kind of flag. Filtering for `--` here
	// fixes the issue so that create-astro now works on all npm versions.
	const cleanArgv = process.argv.slice(2).filter((arg) => arg !== '--');
	const ctx = await getContext(cleanArgv);
	if (ctx.help) {
		help();
		return;
	}

	const steps = [verify, install];

	for (const step of steps) {
		await step(ctx);
	}
	process.exit(0);
}

Domain

Subdomains

Calls

Frequently Asked Questions

What does main() do?
main() is a function in the astro codebase, defined in packages/upgrade/src/index.ts.
Where is main() defined?
main() is defined in packages/upgrade/src/index.ts at line 12.
What does main() call?
main() calls 1 function(s): exit.

Analyze Your Own Codebase

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

Try Supermodel Free