Home / Function/ getProjectId() — astro Function Reference

getProjectId() — astro Function Reference

Architecture documentation for the getProjectId() function in project-info.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e0969f5b_2c7e_7882_c1aa_903356b2865a["getProjectId()"]
  5cf28cbb_df91_06e4_faa2_0ea2eb5a9a37["project-info.ts"]
  e0969f5b_2c7e_7882_c1aa_903356b2865a -->|defined in| 5cf28cbb_df91_06e4_faa2_0ea2eb5a9a37
  5215b308_4057_c2f7_cf00_2ed6f4cca06d["getProjectInfo()"]
  5215b308_4057_c2f7_cf00_2ed6f4cca06d -->|calls| e0969f5b_2c7e_7882_c1aa_903356b2865a
  5c2d8c4c_8ff6_7c02_7910_ae42a7028d3b["getProjectIdFromGit()"]
  e0969f5b_2c7e_7882_c1aa_903356b2865a -->|calls| 5c2d8c4c_8ff6_7c02_7910_ae42a7028d3b
  c268b7b3_22ee_9736_ce57_d7e206b70e9e["createAnonymousValue()"]
  e0969f5b_2c7e_7882_c1aa_903356b2865a -->|calls| c268b7b3_22ee_9736_ce57_d7e206b70e9e
  style e0969f5b_2c7e_7882_c1aa_903356b2865a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/telemetry/src/project-info.ts lines 83–105

function getProjectId(isCI: boolean): Pick<ProjectInfo, 'anonymousProjectId' | 'isGit'> {
	const projectIdFromGit = getProjectIdFromGit();
	if (projectIdFromGit) {
		return {
			isGit: true,
			anonymousProjectId: createAnonymousValue(projectIdFromGit),
		};
	}
	// If we're running in CI, the current working directory is not unique.
	// If the cwd is a single level deep (ex: '/app'), it's probably not unique.
	const cwd = process.cwd();
	const isCwdGeneric = (cwd.match(/[/|\\]/g) || []).length === 1;
	if (isCI || isCwdGeneric) {
		return {
			isGit: false,
			anonymousProjectId: undefined,
		};
	}
	return {
		isGit: false,
		anonymousProjectId: createAnonymousValue(cwd),
	};
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does getProjectId() do?
getProjectId() is a function in the astro codebase, defined in packages/telemetry/src/project-info.ts.
Where is getProjectId() defined?
getProjectId() is defined in packages/telemetry/src/project-info.ts at line 83.
What does getProjectId() call?
getProjectId() calls 2 function(s): createAnonymousValue, getProjectIdFromGit.
What calls getProjectId()?
getProjectId() is called by 1 function(s): getProjectInfo.

Analyze Your Own Codebase

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

Try Supermodel Free