Home / Function/ sortPackages() — astro Function Reference

sortPackages() — astro Function Reference

Architecture documentation for the sortPackages() function in install.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  331f66e3_5185_30b0_13d6_d83c0f3332d4["sortPackages()"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90["install.ts"]
  331f66e3_5185_30b0_13d6_d83c0f3332d4 -->|defined in| d4f6ce6d_9b1b_5434_0914_2c212e0aee90
  style 331f66e3_5185_30b0_13d6_d83c0f3332d4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/upgrade/src/actions/install.ts lines 109–117

function sortPackages(a: PackageInfo, b: PackageInfo): number {
	if (a.isMajor && !b.isMajor) return 1;
	if (b.isMajor && !a.isMajor) return -1;
	if (a.name === 'astro') return -1;
	if (b.name === 'astro') return 1;
	if (a.name.startsWith('@astrojs') && !b.name.startsWith('@astrojs')) return -1;
	if (b.name.startsWith('@astrojs') && !a.name.startsWith('@astrojs')) return 1;
	return a.name.localeCompare(b.name);
}

Domain

Subdomains

Frequently Asked Questions

What does sortPackages() do?
sortPackages() is a function in the astro codebase, defined in packages/upgrade/src/actions/install.ts.
Where is sortPackages() defined?
sortPackages() is defined in packages/upgrade/src/actions/install.ts at line 109.

Analyze Your Own Codebase

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

Try Supermodel Free