Home / Function/ removeEmptyDirs() — astro Function Reference

removeEmptyDirs() — astro Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  8224e543_3275_d61d_2baa_ca7822fea0f9["removeEmptyDirs()"]
  84a07ec6_4b25_7206_06c7_0879729882b9["index.ts"]
  8224e543_3275_d61d_2baa_ca7822fea0f9 -->|defined in| 84a07ec6_4b25_7206_06c7_0879729882b9
  style 8224e543_3275_d61d_2baa_ca7822fea0f9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/core/fs/index.ts lines 7–21

export function removeEmptyDirs(dir: string): void {
	if (!fs.statSync(dir).isDirectory()) return;
	let files = fs.readdirSync(dir);

	if (files.length > 0) {
		files.map((file) => {
			removeEmptyDirs(path.join(dir, file));
		});
		files = fs.readdirSync(dir);
	}

	if (files.length === 0) {
		fs.rmdirSync(dir);
	}
}

Domain

Subdomains

Frequently Asked Questions

What does removeEmptyDirs() do?
removeEmptyDirs() is a function in the astro codebase, defined in packages/astro/src/core/fs/index.ts.
Where is removeEmptyDirs() defined?
removeEmptyDirs() is defined in packages/astro/src/core/fs/index.ts at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free