Skip to content

dependabit / manifest/src / writeManifest

Function: writeManifest() ​

ts
function writeManifest(
   path, 
   manifest, 
   options?): Promise<{
  validationErrors?: string[];
}>;

Defined in: packages/manifest/src/manifest.ts:54

Serialises a manifest to pretty-printed JSON and writes it to disk.

Parameters ​

ParameterTypeDescription
pathstringDestination file path.
manifest{ dependencies: { accessMethod: "context7" | "arxiv" | "openapi" | "github-api" | "http"; auth?: { secretEnvVar?: string; type: "token" | "oauth" | "basic" | "none"; }; changeHistory: { detectedAt: string; falsePositive: boolean; issueNumber?: number; newVersion?: string; oldVersion?: string; severity: "breaking" | "major" | "minor"; }[]; currentStateHash: string; currentVersion?: string; description?: string; detectedAt: string; detectionConfidence: number; detectionMethod: | "llm-analysis" | "manual" | "package-json" | "requirements-txt" | "code-comment"; id: string; lastChanged?: string; lastChecked: string; monitoring?: { checkFrequency: "hourly" | "daily" | "weekly" | "monthly"; enabled: boolean; ignoreChanges: boolean; severityOverride?: "breaking" | "major" | "minor"; }; name: string; referencedIn: { context?: string; file: string; line?: number; }[]; type: | "reference-implementation" | "schema" | "documentation" | "research-paper" | "api-example" | "other"; url: string; }[]; generatedAt: string; generatedBy: { action: string; llmModel?: string; llmProvider: string; version: string; }; repository: { branch: string; commit: string; name: string; owner: string; }; statistics: { averageConfidence: number; byAccessMethod: Record<string, number>; byDetectionMethod: Record<string, number>; byType: Record<string, number>; falsePositiveRate?: number; totalDependencies: number; }; version: "1.0.0"; }Manifest object to write.
manifest.dependencies{ accessMethod: "context7" | "arxiv" | "openapi" | "github-api" | "http"; auth?: { secretEnvVar?: string; type: "token" | "oauth" | "basic" | "none"; }; changeHistory: { detectedAt: string; falsePositive: boolean; issueNumber?: number; newVersion?: string; oldVersion?: string; severity: "breaking" | "major" | "minor"; }[]; currentStateHash: string; currentVersion?: string; description?: string; detectedAt: string; detectionConfidence: number; detectionMethod: | "llm-analysis" | "manual" | "package-json" | "requirements-txt" | "code-comment"; id: string; lastChanged?: string; lastChecked: string; monitoring?: { checkFrequency: "hourly" | "daily" | "weekly" | "monthly"; enabled: boolean; ignoreChanges: boolean; severityOverride?: "breaking" | "major" | "minor"; }; name: string; referencedIn: { context?: string; file: string; line?: number; }[]; type: | "reference-implementation" | "schema" | "documentation" | "research-paper" | "api-example" | "other"; url: string; }[]-
manifest.generatedAt?string-
manifest.generatedBy?{ action: string; llmModel?: string; llmProvider: string; version: string; }-
manifest.generatedBy.action?string-
manifest.generatedBy.llmModel?string-
manifest.generatedBy.llmProvider?string-
manifest.generatedBy.version?string-
manifest.repository?{ branch: string; commit: string; name: string; owner: string; }-
manifest.repository.branch?string-
manifest.repository.commit?string-
manifest.repository.name?string-
manifest.repository.owner?string-
manifest.statistics?{ averageConfidence: number; byAccessMethod: Record<string, number>; byDetectionMethod: Record<string, number>; byType: Record<string, number>; falsePositiveRate?: number; totalDependencies: number; }-
manifest.statistics.averageConfidence?number-
manifest.statistics.byAccessMethod?Record<string, number>-
manifest.statistics.byDetectionMethod?Record<string, number>-
manifest.statistics.byType?Record<string, number>-
manifest.statistics.falsePositiveRate?number-
manifest.statistics.totalDependencies?number-
manifest.version?"1.0.0"-
options?{ strict?: boolean; }Optional write behaviour overrides.
options.strict?boolean-

Returns ​

Promise<{ validationErrors?: string[]; }>

An object that may contain validationErrors if the manifest has schema violations and strict is false.

Remarks ​

The directory is created recursively if it does not exist. When strict is false (the default) the file is written even if validation fails; validation errors are returned in the result so callers can surface them as warnings.

Throws ​

Only when options.strict is true and the manifest fails validation.

Never ​

  • Writing a manifest with strict: false can persist invalid data that later fails to parse. Prefer strict: true in production pipelines.

Released under the MIT License.