@analytiics/manifest
v0.5.0
Published
Schema, validator, and TypeScript codegen for the analytics.yaml tracking manifest.
Maintainers
Readme
@analytiics/manifest
Schema, validator, and TypeScript codegen for the analytics.yaml tracking
manifest.
Most people want @analytiics/cli,
which wraps this. Use this package directly to build tooling of your own —
a lint rule, an editor plugin, a CI check.
import { parseManifest, generateTypeScript, manifestHash } from "@analytiics/manifest";
const result = parseManifest(readFileSync("analytics.yaml", "utf8"));
if (!result.ok) {
console.error(result.errors.join("\n"));
process.exit(1);
}
const source = generateTypeScript(result.manifest);
const fingerprint = manifestHash(result.manifest);parseManifest returns a discriminated union rather than throwing, with errors
addressed to whoever has to fix them (events.$bad: names starting with $ are
reserved for built-in events) instead of a raw schema path dump.
manifestHash fingerprints the manifest's meaning, not its formatting — a
reformat doesn't read as drift, but a changed description does. It's what a CI
check compares to detect a manifest that moved without regenerating.
