Home / Function/ update() — astro Function Reference

update() — astro Function Reference

Architecture documentation for the update() function in index.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  659359f8_6c95_94b1_f71e_af3f7b4778f0["update()"]
  6d13fcb4_52dc_bbbc_378e_c719f7883531["index.ts"]
  659359f8_6c95_94b1_f71e_af3f7b4778f0 -->|defined in| 6d13fcb4_52dc_bbbc_378e_c719f7883531
  style 659359f8_6c95_94b1_f71e_af3f7b4778f0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/cli/telemetry/index.ts lines 16–52

export async function update(subcommand: string, { flags }: TelemetryOptions) {
	const isValid = ['enable', 'disable', 'reset'].includes(subcommand);
	const logger = createLoggerFromFlags(flags);

	if (flags.help || flags.h || !isValid) {
		msg.printHelp({
			commandName: 'astro telemetry',
			usage: '[command]',
			tables: {
				Commands: [
					['enable', 'Enable anonymous data collection.'],
					['disable', 'Disable anonymous data collection.'],
					['reset', 'Reset anonymous data collection settings.'],
				],
			},
		});
		return;
	}

	switch (subcommand) {
		case 'enable': {
			telemetry.setEnabled(true);
			logger.info('SKIP_FORMAT', msg.telemetryEnabled());
			return;
		}
		case 'disable': {
			telemetry.setEnabled(false);
			logger.info('SKIP_FORMAT', msg.telemetryDisabled());
			return;
		}
		case 'reset': {
			telemetry.clear();
			logger.info('SKIP_FORMAT', msg.telemetryReset());
			return;
		}
	}
}

Domain

Subdomains

Frequently Asked Questions

What does update() do?
update() is a function in the astro codebase, defined in packages/astro/src/cli/telemetry/index.ts.
Where is update() defined?
update() is defined in packages/astro/src/cli/telemetry/index.ts at line 16.

Analyze Your Own Codebase

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

Try Supermodel Free