Home / Function/ getConfigDir() — astro Function Reference

getConfigDir() — astro Function Reference

Architecture documentation for the getConfigDir() function in config.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  16716b51_3b85_6ec0_0ea1_d31e57659196["getConfigDir()"]
  5b90aac1_20dd_dfa0_03a8_c2a798e9dc65["config.ts"]
  16716b51_3b85_6ec0_0ea1_d31e57659196 -->|defined in| 5b90aac1_20dd_dfa0_03a8_c2a798e9dc65
  2dc89cbf_0106_10a9_1a8e_e4ad9c3f9c3a["constructor()"]
  2dc89cbf_0106_10a9_1a8e_e4ad9c3f9c3a -->|calls| 16716b51_3b85_6ec0_0ea1_d31e57659196
  style 16716b51_3b85_6ec0_0ea1_d31e57659196 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/telemetry/src/config.ts lines 13–33

function getConfigDir(name: string) {
	const homedir = os.homedir();
	const macos = () => path.join(homedir, 'Library', 'Preferences', name);
	const win = () => {
		const { APPDATA = path.join(homedir, 'AppData', 'Roaming') } = process.env;
		return path.join(APPDATA, name, 'Config');
	};
	const linux = () => {
		const { XDG_CONFIG_HOME = path.join(homedir, '.config') } = process.env;
		return path.join(XDG_CONFIG_HOME, name);
	};
	// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check
	switch (process.platform) {
		case 'darwin':
			return macos();
		case 'win32':
			return win();
		default:
			return linux();
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getConfigDir() do?
getConfigDir() is a function in the astro codebase, defined in packages/telemetry/src/config.ts.
Where is getConfigDir() defined?
getConfigDir() is defined in packages/telemetry/src/config.ts at line 13.
What calls getConfigDir()?
getConfigDir() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free