UNPKG

@metamask/snaps-utils

Version:
22 lines 799 B
import { validate } from "@metamask/superstruct"; import { getStructFailureMessage } from "../../structs.mjs"; import { NpmSnapFileNames } from "../../types.mjs"; import { SnapManifestStruct } from "../validation.mjs"; /** * Verify the structure of snap.manifest.json. */ export const isSnapManifest = { severity: 'error', structureCheck(files, context) { if (!files.manifest) { return; } const [error] = validate(files.manifest.result, SnapManifestStruct); if (error) { for (const failure of error.failures()) { context.report(`"${NpmSnapFileNames.Manifest}" is invalid: ${getStructFailureMessage(SnapManifestStruct, failure, false)}`); } } }, }; //# sourceMappingURL=is-snap-manifest.mjs.map