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
  ab380327_5f69_1119_792e_595b623d4cc2["main()"]
  92304efa_ee81_529f_e9c5_00f519ffb291["index.ts"]
  ab380327_5f69_1119_792e_595b623d4cc2 -->|defined in| 92304efa_ee81_529f_e9c5_00f519ffb291
  e82dda09_9dc3_cd0f_9513_260f253cba76["exit()"]
  ab380327_5f69_1119_792e_595b623d4cc2 -->|calls| e82dda09_9dc3_cd0f_9513_260f253cba76
  style ab380327_5f69_1119_792e_595b623d4cc2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/create-astro/src/index.ts lines 19–61

export async function main() {
	// Add some extra spacing from the noisy npm/pnpm init output
	// biome-ignore lint/suspicious/noConsole: allowed
	console.log('');
	// 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,
		intro,
		projectName,
		template,
		dependencies,

		// Steps which write to files need to go above git
		git,
	];

	for (const step of steps) {
		await step(ctx);
	}

	// biome-ignore lint/suspicious/noConsole: allowed
	console.log('');

	const labels = {
		start: 'Project initializing...',
		end: 'Project initialized!',
	};
	await tasks(labels, ctx.tasks);

	await next(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/create-astro/src/index.ts.
Where is main() defined?
main() is defined in packages/create-astro/src/index.ts at line 19.
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