Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  6d13fcb4_52dc_bbbc_378e_c719f7883531["index.ts"]
  8db17b08_b9e5_db7e_cd39_46be76c6d5ad["../core/messages.js"]
  6d13fcb4_52dc_bbbc_378e_c719f7883531 --> 8db17b08_b9e5_db7e_cd39_46be76c6d5ad
  e62808d9_0c55_b3a9_00c0_ce588f164dab["../events/index.js"]
  6d13fcb4_52dc_bbbc_378e_c719f7883531 --> e62808d9_0c55_b3a9_00c0_ce588f164dab
  9323e55c_9236_cd3d_d0b3_e20df52a4e84["../flags.js"]
  6d13fcb4_52dc_bbbc_378e_c719f7883531 --> 9323e55c_9236_cd3d_d0b3_e20df52a4e84
  style 6d13fcb4_52dc_bbbc_378e_c719f7883531 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as msg from '../../core/messages.js';
import { telemetry } from '../../events/index.js';
import { createLoggerFromFlags, type Flags } from '../flags.js';

interface TelemetryOptions {
	flags: Flags;
}

export async function notify() {
	await telemetry.notify(() => {
		console.log(msg.telemetryNotice() + '\n');
		return true;
	});
}

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

Functions

Dependencies

  • ../core/messages.js
  • ../events/index.js
  • ../flags.js

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in index.ts?
index.ts defines 2 function(s): notify, update.
What does index.ts depend on?
index.ts imports 3 module(s): ../core/messages.js, ../events/index.js, ../flags.js.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/cli/telemetry/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/cli/telemetry).

Analyze Your Own Codebase

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

Try Supermodel Free