[]previous and next page

parseManifest

Validates the parsed content of a manifest.json.

Validates the parsed content of a manifest.json.

Import#

ts
import { parseManifest } from "create-shadow-app";

Signature#

ts
function parseManifest(value: unknown, file: string): LocalManifest

Parameters#

Name Description
value Parsed JSON.
file Where it came from, for messages.

Returns#

The manifest with every entry checked.

Throws#

  • Error when the shape is wrong, a name is not a ShadowJS package or a path is not absolute.

Examples#

ts
parseManifest({ packages: [{ name: "@shadow-js/core", version: "1.0.0", tarball: "/pack/core.tgz" }] }, "manifest.json").packages.length; // 1
parseManifest({ packages: [] }, "manifest.json"); // throws: manifest.json is not a pack manifest: it lists no package.