Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  d06f1dae_d2ec_dd68_b710_e9bdefa6984f["index.ts"]
  f68003f1_292f_ca44_03ce_21af87a33c7b["../core/util.js"]
  d06f1dae_d2ec_dd68_b710_e9bdefa6984f --> f68003f1_292f_ca44_03ce_21af87a33c7b
  9323e55c_9236_cd3d_d0b3_e20df52a4e84["../flags.js"]
  d06f1dae_d2ec_dd68_b710_e9bdefa6984f --> 9323e55c_9236_cd3d_d0b3_e20df52a4e84
  5f310fba_45ef_87f3_baa6_5e93f993468e["../../cli/install-package.js"]
  d06f1dae_d2ec_dd68_b710_e9bdefa6984f --> 5f310fba_45ef_87f3_baa6_5e93f993468e
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  d06f1dae_d2ec_dd68_b710_e9bdefa6984f --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  style d06f1dae_d2ec_dd68_b710_e9bdefa6984f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path';
import { ensureProcessNodeEnv } from '../../core/util.js';
import { createLoggerFromFlags, type Flags, flagsToAstroInlineConfig } from '../flags.js';
import { getPackage } from '../install-package.js';

export async function check(flags: Flags) {
	ensureProcessNodeEnv('production');
	const logger = createLoggerFromFlags(flags);
	const getPackageOpts = {
		skipAsk: !!flags.yes || !!flags.y,
		cwd: flags.root,
	};
	// @ts-ignore For some unknown reason, in CI TS isn't able to get the type here even though it works locally.
	const checkPackage = await getPackage<typeof import('@astrojs/check')>(
		'@astrojs/check',
		logger,
		getPackageOpts,
		['typescript'],
	);
	const typescript = await getPackage('typescript', logger, getPackageOpts);

	if (!checkPackage || !typescript) {
		logger.error(
			'check',
			'The `@astrojs/check` and `typescript` packages are required for this command to work. Please manually install them into your project and try again.',
		);
		return;
	}

	if (!flags.noSync && !flags.help) {
		// Run sync before check to make sure types are generated.
		// NOTE: In the future, `@astrojs/check` can expose a `before lint` hook so that this works during `astro check --watch` too.
		// For now, we run this once as usually `astro check --watch` is ran alongside `astro dev` which also calls `astro sync`.
		const { default: sync } = await import('../../core/sync/index.js');
		await sync(flagsToAstroInlineConfig(flags));
	}

	const { check: checker, parseArgsAsCheckConfig } = checkPackage;

	const config = parseArgsAsCheckConfig(process.argv);

	logger.info('check', `Getting diagnostics for Astro files in ${path.resolve(config.root)}...`);
	return await checker(config);
}

Domain

Subdomains

Functions

Dependencies

  • ../../cli/install-package.js
  • ../core/util.js
  • ../flags.js
  • node:path

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 1 function(s): check.
What does index.ts depend on?
index.ts imports 4 module(s): ../../cli/install-package.js, ../core/util.js, ../flags.js, node:path.
Where is index.ts in the architecture?
index.ts is located at packages/astro/src/cli/check/index.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/cli/check).

Analyze Your Own Codebase

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

Try Supermodel Free