Home / Function/ getTemplateTarget() — astro Function Reference

getTemplateTarget() — astro Function Reference

Architecture documentation for the getTemplateTarget() function in template.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  f663c14e_a34e_e8db_e978_7ac40aef9737["getTemplateTarget()"]
  33b7e98e_3257_427a_5948_5ab38c474d26["template.ts"]
  f663c14e_a34e_e8db_e978_7ac40aef9737 -->|defined in| 33b7e98e_3257_427a_5948_5ab38c474d26
  0fddab5d_7945_0e3f_5243_8599487fed07["copyTemplate()"]
  0fddab5d_7945_0e3f_5243_8599487fed07 -->|calls| f663c14e_a34e_e8db_e978_7ac40aef9737
  style f663c14e_a34e_e8db_e978_7ac40aef9737 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/create-astro/src/actions/template.ts lines 113–133

export function getTemplateTarget(tmpl: string, ref = 'latest') {
	// Handle Starlight templates
	if (tmpl.startsWith('starlight')) {
		const [, starter = 'basics'] = tmpl.split('/');
		return `github:withastro/starlight/examples/${starter}`;
	}

	// Handle third-party templates
	const isThirdParty = tmpl.includes('/');
	if (isThirdParty) return tmpl;

	// Handle Astro templates
	if (ref === 'latest') {
		// `latest` ref is specially handled to route to a branch specifically
		// to allow faster downloads. Otherwise giget has to download the entire
		// repo and only copy a sub directory
		return `github:withastro/astro#examples/${tmpl}`;
	} else {
		return `github:withastro/astro/examples/${tmpl}#${ref}`;
	}
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getTemplateTarget() do?
getTemplateTarget() is a function in the astro codebase, defined in packages/create-astro/src/actions/template.ts.
Where is getTemplateTarget() defined?
getTemplateTarget() is defined in packages/create-astro/src/actions/template.ts at line 113.
What calls getTemplateTarget()?
getTemplateTarget() is called by 1 function(s): copyTemplate.

Analyze Your Own Codebase

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

Try Supermodel Free