Home / File/ verify.ts — astro Source File

verify.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 6 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  9eee6473_b978_8f37_044a_b59898b0a6b1["verify.ts"]
  0d2ed6a4_ba13_53b9_91e8_1ccbdcaac22b["../messages.js"]
  9eee6473_b978_8f37_044a_b59898b0a6b1 --> 0d2ed6a4_ba13_53b9_91e8_1ccbdcaac22b
  6d4ff623_63ed_2360_85a7_197d38173f66["./actions/context.js"]
  9eee6473_b978_8f37_044a_b59898b0a6b1 --> 6d4ff623_63ed_2360_85a7_197d38173f66
  417cee1f_f6ce_984a_2c18_ee3bdfba04f3["./actions/template.js"]
  9eee6473_b978_8f37_044a_b59898b0a6b1 --> 417cee1f_f6ce_984a_2c18_ee3bdfba04f3
  d75457f1_c905_87d9_5df9_ce5ad96e7abd["promises"]
  9eee6473_b978_8f37_044a_b59898b0a6b1 --> d75457f1_c905_87d9_5df9_ce5ad96e7abd
  44da03af_fba3_824c_9c9c_2685d1d33d31["cli-kit"]
  9eee6473_b978_8f37_044a_b59898b0a6b1 --> 44da03af_fba3_824c_9c9c_2685d1d33d31
  9102ecaa_9fd5_d51e_8099_abc23a789fc9["giget-core"]
  9eee6473_b978_8f37_044a_b59898b0a6b1 --> 9102ecaa_9fd5_d51e_8099_abc23a789fc9
  style 9eee6473_b978_8f37_044a_b59898b0a6b1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import dns from 'node:dns/promises';
import { color } from '@astrojs/cli-kit';
import { verifyTemplate } from '@bluwy/giget-core';
import { bannerAbort, error, info, log } from '../messages.js';
import type { Context } from './context.js';
import { getTemplateTarget } from './template.js';

export async function verify(
	ctx: Pick<Context, 'version' | 'dryRun' | 'template' | 'ref' | 'exit'>,
) {
	if (!ctx.dryRun) {
		const online = await isOnline();
		if (!online) {
			bannerAbort();
			log('');
			error('error', `Unable to connect to the internet.`);
			ctx.exit(1);
		}
	}

	if (ctx.template) {
		const target = getTemplateTarget(ctx.template, ctx.ref);
		const ok = await verifyTemplate(target);
		if (!ok) {
			bannerAbort();
			log('');
			error('error', `Template ${color.reset(ctx.template)} ${color.dim('could not be found!')}`);
			await info('check', 'https://astro.build/examples');
			ctx.exit(1);
		}
	}
}

function isOnline(): Promise<boolean> {
	return dns.lookup('github.com').then(
		() => true,
		() => false,
	);
}

Domain

Subdomains

Functions

Dependencies

  • ../messages.js
  • ./actions/context.js
  • ./actions/template.js
  • cli-kit
  • giget-core
  • promises

Frequently Asked Questions

What does verify.ts do?
verify.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 verify.ts?
verify.ts defines 2 function(s): isOnline, verify.
What does verify.ts depend on?
verify.ts imports 6 module(s): ../messages.js, ./actions/context.js, ./actions/template.js, cli-kit, giget-core, promises.
Where is verify.ts in the architecture?
verify.ts is located at packages/create-astro/src/actions/verify.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/create-astro/src/actions).

Analyze Your Own Codebase

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

Try Supermodel Free