Home / File/ install.ts — astro Source File

install.ts — astro Source File

Architecture documentation for install.ts, a typescript file in the astro codebase. 9 imports, 0 dependents.

File typescript CoreAstro RoutingSystem 9 imports 5 functions

Entity Profile

Dependency Diagram

graph LR
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90["install.ts"]
  73414401_e2bb_915f_9b7e_7876ce05c609["./messages.js"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> 73414401_e2bb_915f_9b7e_7876ce05c609
  c7b46054_ae5f_7503_1e47_74f63740b601["./shell.js"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> c7b46054_ae5f_7503_1e47_74f63740b601
  a92de0dc_dbd8_66cd_eaac_504972b46b30["./actions/context.js"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> a92de0dc_dbd8_66cd_eaac_504972b46b30
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  44da03af_fba3_824c_9c9c_2685d1d33d31["cli-kit"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> 44da03af_fba3_824c_9c9c_2685d1d33d31
  3b35366d_8979_cafe_57a9_c7ee6fd913bc["utils"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> 3b35366d_8979_cafe_57a9_c7ee6fd913bc
  61b635e2_549a_1d06_be03_2c8dced634c4["package-manager-detector"]
  d4f6ce6d_9b1b_5434_0914_2c212e0aee90 --> 61b635e2_549a_1d06_be03_2c8dced634c4
  style d4f6ce6d_9b1b_5434_0914_2c212e0aee90 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { color, say } from '@astrojs/cli-kit';
import { random, sleep } from '@astrojs/cli-kit/utils';
import { resolveCommand } from 'package-manager-detector';
import {
	banner,
	bye,
	celebrations,
	changelog,
	done,
	error,
	info,
	newline,
	pluralize,
	spinner,
	success,
	title,
	upgrade,
	warn,
} from '../messages.js';
import { shell } from '../shell.js';
import type { Context, PackageInfo } from './context.js';

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',
// ... (152 more lines)

Domain

Subdomains

Dependencies

  • ./actions/context.js
  • ./messages.js
  • ./shell.js
  • cli-kit
  • node:fs
  • node:path
  • node:url
  • package-manager-detector
  • utils

Frequently Asked Questions

What does install.ts do?
install.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in install.ts?
install.ts defines 5 function(s): ensureYarnLock, filterPackages, install, runInstallCommand, sortPackages.
What does install.ts depend on?
install.ts imports 9 module(s): ./actions/context.js, ./messages.js, ./shell.js, cli-kit, node:fs, node:path, node:url, package-manager-detector, and 1 more.
Where is install.ts in the architecture?
install.ts is located at packages/upgrade/src/actions/install.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/upgrade/src/actions).

Analyze Your Own Codebase

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

Try Supermodel Free