Home / File/ system-info.ts — astro Source File

system-info.ts — astro Source File

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

File typescript CoreAstro RoutingSystem 4 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  cb29abf3_2786_047a_1a19_d59b21c4ab43["system-info.ts"]
  b326953c_dc9d_ec9e_dc34_4beead549f6e["node:os"]
  cb29abf3_2786_047a_1a19_d59b21c4ab43 --> b326953c_dc9d_ec9e_dc34_4beead549f6e
  65300f14_7198_278b_9340_6e56b02fc2ea["ci-info"]
  cb29abf3_2786_047a_1a19_d59b21c4ab43 --> 65300f14_7198_278b_9340_6e56b02fc2ea
  2865a4c8_c836_282c_7fdf_677b9dfc4cc9["is-docker"]
  cb29abf3_2786_047a_1a19_d59b21c4ab43 --> 2865a4c8_c836_282c_7fdf_677b9dfc4cc9
  b7ac319a_41a3_dc6c_f907_8d5b3e6f42f5["is-wsl"]
  cb29abf3_2786_047a_1a19_d59b21c4ab43 --> b7ac319a_41a3_dc6c_f907_8d5b3e6f42f5
  style cb29abf3_2786_047a_1a19_d59b21c4ab43 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import os from 'node:os';
import { name as ciName, isCI } from 'ci-info';
import isDocker from 'is-docker';
import isWSL from 'is-wsl';

/**
 * Astro Telemetry -- System Info
 *
 * To better understand our telemetry insights, Astro collects the following anonymous information
 * about the system that it runs on. This helps us prioritize fixes and new features based on a
 * better understanding of our real-world system requirements.
 *
 * ~~~
 *
 * Q: Can this system info be traced back to me?
 *
 * A: No personally identifiable information is contained in the system info that we collect. It could
 * be possible for someone with direct access to your machine to collect this information themselves
 * and then attempt to match it all together with our collected telemetry data, however most users'
 * systems are probably not uniquely identifiable via their system info alone.
 *
 * ~~~
 *
 * Q: I don't want Astro to collect system info. How can I disable it?
 *
 * A: You can disable telemetry completely at any time by running `astro telemetry disable`. There is
 * currently no way to disable this otherwise while keeping the rest of telemetry enabled.
 */

export type SystemInfo = {
	systemPlatform: NodeJS.Platform;
	systemRelease: string;
	systemArchitecture: string;
	astroVersion: string;
	nodeVersion: string;
	viteVersion: string;
	cpuCount: number;
	cpuModel: string | null;
	cpuSpeed: number | null;
	memoryInMb: number;
	isDocker: boolean;
	isTTY: boolean;
	isWSL: boolean;
	isCI: boolean;
	ciName: string | null;
};

let meta: SystemInfo | undefined;

export function getSystemInfo(versions: { viteVersion: string; astroVersion: string }): SystemInfo {
	if (meta) {
		return meta;
	}

	const cpus = os.cpus() || [];

	return {
		// Version information
		nodeVersion: process.version.replace(/^v?/, ''),
		viteVersion: versions.viteVersion,
		astroVersion: versions.astroVersion,
		// Software information
		systemPlatform: os.platform(),
		systemRelease: os.release(),
		systemArchitecture: os.arch(),
		// Machine information
		cpuCount: cpus.length,
		cpuModel: cpus.length ? cpus[0].model : null,
		cpuSpeed: cpus.length ? cpus[0].speed : null,
		memoryInMb: Math.trunc(os.totalmem() / Math.pow(1024, 2)),
		// Environment information
		isDocker: isDocker(),
		isTTY: process.stdout.isTTY,
		isWSL,
		isCI,
		ciName,
	};
}

Domain

Subdomains

Functions

Types

Dependencies

  • ci-info
  • is-docker
  • is-wsl
  • node:os

Frequently Asked Questions

What does system-info.ts do?
system-info.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 system-info.ts?
system-info.ts defines 1 function(s): getSystemInfo.
What does system-info.ts depend on?
system-info.ts imports 4 module(s): ci-info, is-docker, is-wsl, node:os.
Where is system-info.ts in the architecture?
system-info.ts is located at packages/telemetry/src/system-info.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/telemetry/src).

Analyze Your Own Codebase

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

Try Supermodel Free