@custom-elements-manifest/analyzer generates Custom Elements Manifest data from web-component source files, avoiding the tedious and error-prone work of writing manifests manually. The generated file records component tag names, attributes, properties, slots, CSS custom properties, and CSS parts for use by documentation and developer tools. section 10.0 section 1.5
npm install -D @custom-elements-manifest/analyzer
Install the analyzer as a development dependency before adding generation scripts. section 10.1
A typical project workflow is:
- Add `cem analyze` and `cem analyze --watch` scripts to package.json. section 10.1
- Run the command to create `custom-elements.json` in the project root, and regenerate it whenever a component API changes. section 10.1
- Limit analysis with `globs` and omit irrelevant paths with `exclude`; node_modules is excluded automatically. section 10.1
- Enable library support for FAST, Lit, or Stencil through configuration, and add a plugin when a library is not natively supported. section 10.1
A focused project configuration
A project whose components live under src can configure `globs: ["src/**/*.{js,ts}"]` and exclude Storybook directories such as `stories` and `storybook-static`. A project combining FAST, Lit, and Stencil can enable those integrations, while another library can be connected through a package-specific plugin. section 10.1
