Home / Function/ run() — astro Function Reference

run() — astro Function Reference

Architecture documentation for the run() function in server-stress-default.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  9be6db29_c5de_10a0_03a7_b5bed9657099["run()"]
  44e95c87_8548_73a2_119f_c6e58f06975c["server-stress-default.js"]
  9be6db29_c5de_10a0_03a7_b5bed9657099 -->|defined in| 44e95c87_8548_73a2_119f_c6e58f06975c
  style 9be6db29_c5de_10a0_03a7_b5bed9657099 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

benchmark/make-project/server-stress-default.js lines 7–62

export async function run(projectDir) {
	await fs.rm(projectDir, { recursive: true, force: true });
	await fs.mkdir(new URL('./src/pages', projectDir), { recursive: true });
	await fs.mkdir(new URL('./src/components', projectDir), { recursive: true });

	await fs.writeFile(
		new URL('./src/pages/index.astro', projectDir),
		`\
---
import Paragraph from '../components/Paragraph.astro'
const content = "${loremIpsum}"
---

<html lang="en">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width" />
		<meta name="generator" content={Astro.generator} />
		<title>Astro</title>
	</head>
	<body>
		<h1>Astro</h1>
		<div>
			${Array.from({ length: 100 })
				.map(() => '<p>{content}</p>')
				.join('\n')}
		</div>
		<div>
			${Array.from({ length: 50 })
				.map((_, i) => '<Paragraph num={' + i + '} str={content} />')
				.join('\n')}
		</div>
	</body>
</html>`,
		'utf-8',
	);

	await fs.writeFile(
		new URL('./src/components/Paragraph.astro', projectDir),
		`<div>{Astro.props.num} {Astro.props.str}</div>`,
		'utf-8',
	);

	await fs.writeFile(
		new URL('./astro.config.js', projectDir),
		`\
import { defineConfig } from 'astro/config';
import nodejs from '@astrojs/node';

export default defineConfig({
	output: 'server',
	adapter: nodejs({ mode: 'standalone' }),
});`,
		'utf-8',
	);
}

Subdomains

Frequently Asked Questions

What does run() do?
run() is a function in the astro codebase, defined in benchmark/make-project/server-stress-default.js.
Where is run() defined?
run() is defined in benchmark/make-project/server-stress-default.js at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free