Home / File/ server-stress-default.js — astro Source File

server-stress-default.js — astro Source File

Architecture documentation for server-stress-default.js, a javascript file in the astro codebase. 2 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  44e95c87_8548_73a2_119f_c6e58f06975c["server-stress-default.js"]
  2ec933b1_5eb0_6df7_64be_172f9299459c["_util.js"]
  44e95c87_8548_73a2_119f_c6e58f06975c --> 2ec933b1_5eb0_6df7_64be_172f9299459c
  5d6d1861_a18d_b246_cd94_08889ab7e74c["promises"]
  44e95c87_8548_73a2_119f_c6e58f06975c --> 5d6d1861_a18d_b246_cd94_08889ab7e74c
  style 44e95c87_8548_73a2_119f_c6e58f06975c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs/promises';
import { loremIpsum } from './_util.js';

/**
 * @param {URL} projectDir
 */
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

Functions

Dependencies

Frequently Asked Questions

What does server-stress-default.js do?
server-stress-default.js is a source file in the astro codebase, written in javascript. It belongs to the PerformanceBenchmarking domain, ProjectGenerator subdomain.
What functions are defined in server-stress-default.js?
server-stress-default.js defines 1 function(s): run.
What does server-stress-default.js depend on?
server-stress-default.js imports 2 module(s): _util.js, promises.
Where is server-stress-default.js in the architecture?
server-stress-default.js is located at benchmark/make-project/server-stress-default.js (domain: PerformanceBenchmarking, subdomain: ProjectGenerator, directory: benchmark/make-project).

Analyze Your Own Codebase

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

Try Supermodel Free