dependencies() — astro Function Reference
Architecture documentation for the dependencies() function in dependencies.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD cc689499_9606_7a8e_588b_53c80795c124["dependencies()"] ed06fbb8_fa50_eed4_1fe7_4e2bd1cca13a["dependencies.ts"] cc689499_9606_7a8e_588b_53c80795c124 -->|defined in| ed06fbb8_fa50_eed4_1fe7_4e2bd1cca13a 96ccebd5_b806_99e1_935a_9774dfab1eed["install()"] cc689499_9606_7a8e_588b_53c80795c124 -->|calls| 96ccebd5_b806_99e1_935a_9774dfab1eed 764fd32a_377f_5c75_5b38_ba0c44a31213["astroAdd()"] cc689499_9606_7a8e_588b_53c80795c124 -->|calls| 764fd32a_377f_5c75_5b38_ba0c44a31213 style cc689499_9606_7a8e_588b_53c80795c124 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/create-astro/src/actions/dependencies.ts lines 9–84
export async function dependencies(
ctx: Pick<
Context,
'install' | 'yes' | 'prompt' | 'packageManager' | 'cwd' | 'dryRun' | 'tasks' | 'add'
>,
) {
let deps = ctx.install ?? ctx.yes;
if (deps === undefined) {
({ deps } = await ctx.prompt({
name: 'deps',
type: 'confirm',
label: title('deps'),
message: `Install dependencies?`,
hint: 'recommended',
initial: true,
}));
ctx.install = deps;
}
ctx.add = ctx.add?.reduce<string[]>((acc, item) => acc.concat(item.split(',')), []);
if (ctx.add) {
for (const addValue of ctx.add) {
// Validate package name to prevent command injection attacks
assertValidPackageName(addValue);
}
}
if (ctx.dryRun) {
await info(
'--dry-run',
`Skipping dependency installation${ctx.add ? ` and adding ${ctx.add.join(', ')}` : ''}`,
);
} else if (deps) {
ctx.tasks.push({
pending: 'Dependencies',
start: `Dependencies installing with ${ctx.packageManager}...`,
end: 'Dependencies installed',
onError: (e) => {
error('error', e);
error(
'error',
`Dependencies failed to install, please run ${color.bold(
ctx.packageManager + ' install',
)} to install them manually after setup.`,
);
},
while: () => install({ packageManager: ctx.packageManager, cwd: ctx.cwd }),
});
let add = ctx.add;
if (add) {
ctx.tasks.push({
pending: 'Integrations',
start: `Adding integrations with astro add`,
end: 'Integrations added',
onError: (e) => {
error('error', e);
error(
'error',
`Failed to add integrations, please run ${color.bold(
`astro add ${add.join(' ')}`,
)} to install them manually after setup.`,
);
},
while: () =>
astroAdd({ integrations: add, packageManager: ctx.packageManager, cwd: ctx.cwd }),
});
}
} else {
await info(
ctx.yes === false ? 'deps [skip]' : 'No problem!',
'Remember to install dependencies after setup.',
);
}
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does dependencies() do?
dependencies() is a function in the astro codebase, defined in packages/create-astro/src/actions/dependencies.ts.
Where is dependencies() defined?
dependencies() is defined in packages/create-astro/src/actions/dependencies.ts at line 9.
What does dependencies() call?
dependencies() calls 2 function(s): astroAdd, install.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free