install() — astro Function Reference
Architecture documentation for the install() function in install.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 39ce6eb0_d5e5_44df_8a2f_689d819ba902["install()"] d4f6ce6d_9b1b_5434_0914_2c212e0aee90["install.ts"] 39ce6eb0_d5e5_44df_8a2f_689d819ba902 -->|defined in| d4f6ce6d_9b1b_5434_0914_2c212e0aee90 d696fad9_a3d4_3525_97fd_7ee935f31087["filterPackages()"] 39ce6eb0_d5e5_44df_8a2f_689d819ba902 -->|calls| d696fad9_a3d4_3525_97fd_7ee935f31087 8ead6057_5859_6216_20f8_df5dd46a876a["runInstallCommand()"] 39ce6eb0_d5e5_44df_8a2f_689d819ba902 -->|calls| 8ead6057_5859_6216_20f8_df5dd46a876a style 39ce6eb0_d5e5_44df_8a2f_689d819ba902 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/upgrade/src/actions/install.ts lines 26–86
export async function install(
ctx: Pick<
Context,
'version' | 'packages' | 'packageManager' | 'prompt' | 'dryRun' | 'exit' | 'cwd'
>,
shellFn: typeof shell = shell,
) {
await banner();
newline();
const { current, dependencies, devDependencies } = filterPackages(ctx);
const toInstall = [...dependencies, ...devDependencies].sort(sortPackages);
for (const packageInfo of current.sort(sortPackages)) {
const tag = /^\d/.test(packageInfo.targetVersion)
? packageInfo.targetVersion
: packageInfo.targetVersion.slice(1);
await info(`${packageInfo.name}`, `is up to date on`, `v${tag}`);
await sleep(random(50, 150));
}
if (toInstall.length === 0 && !ctx.dryRun) {
newline();
await success(random(celebrations), random(done));
return;
}
const majors: PackageInfo[] = [];
for (const packageInfo of toInstall) {
const word = ctx.dryRun ? 'can' : 'will';
await upgrade(packageInfo, `${word} be updated`);
if (packageInfo.isMajor) {
majors.push(packageInfo);
}
}
if (majors.length > 0) {
const { proceed } = await ctx.prompt({
name: 'proceed',
type: 'confirm',
label: title('wait'),
message: `${pluralize(
['One package has', 'Some packages have'],
majors.length,
)} breaking changes. Continue?`,
initial: true,
});
if (!proceed) {
return ctx.exit(0);
}
newline();
await warn('check', `Be sure to follow the ${pluralize('CHANGELOG', majors.length)}.`);
for (const pkg of majors.sort(sortPackages)) {
await changelog(pkg.name, pkg.changelogTitle!, pkg.changelogURL!);
}
}
newline();
if (ctx.dryRun) {
await info('--dry-run', `Skipping dependency installation`);
} else {
await runInstallCommand(ctx, dependencies, devDependencies, shellFn);
}
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does install() do?
install() is a function in the astro codebase, defined in packages/upgrade/src/actions/install.ts.
Where is install() defined?
install() is defined in packages/upgrade/src/actions/install.ts at line 26.
What does install() call?
install() calls 2 function(s): filterPackages, runInstallCommand.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free