Home / Function/ prepareExample() — astro Function Reference

prepareExample() — astro Function Reference

Architecture documentation for the prepareExample() function in check.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  640900ab_d36d_8a46_5d24_e4d6f85b27e6["prepareExample()"]
  6e63560f_8c71_c453_90bf_78fa760e9716["check.js"]
  640900ab_d36d_8a46_5d24_e4d6f85b27e6 -->|defined in| 6e63560f_8c71_c453_90bf_78fa760e9716
  cba20645_62bd_70c0_caff_f96cee1c8243["checkExamples()"]
  cba20645_62bd_70c0_caff_f96cee1c8243 -->|calls| 640900ab_d36d_8a46_5d24_e4d6f85b27e6
  style 640900ab_d36d_8a46_5d24_e4d6f85b27e6 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/smoke/check.js lines 71–86

function prepareExample(examplePath) {
	const tsconfigPath = path.join('./examples/', examplePath, 'tsconfig.json');
	if (!existsSync(tsconfigPath)) return
	
	const originalConfig = readFileSync(tsconfigPath, 'utf-8');
	const tsconfig = JSON.parse(toJson(originalConfig));

	// Swap to strictest config to make sure it also passes
	tsconfig.extends = 'astro/tsconfigs/strictest';
	tsconfig.compilerOptions ??= {}
	tsconfig.compilerOptions.types = tsconfig.compilerOptions.types ?? []; // Speeds up tests

	writeFileSync(tsconfigPath, JSON.stringify(tsconfig));

	return originalConfig;
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does prepareExample() do?
prepareExample() is a function in the astro codebase, defined in scripts/smoke/check.js.
Where is prepareExample() defined?
prepareExample() is defined in scripts/smoke/check.js at line 71.
What calls prepareExample()?
prepareExample() is called by 1 function(s): checkExamples.

Analyze Your Own Codebase

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

Try Supermodel Free