Docs

proa generate

Generate components, layouts, and data modules.

Open Markdown

The generator commands write files into an existing Proa project. By default, they locate the nearest parent directory that contains both Cargo.toml and src/. Pass --root when running from outside the project tree.

Components

proa generate component pricing/feature-row --children --recipe

This creates module entries under src/components and writes either a single component file or a component folder.

FlagBehavior
--folderUse components/<name>/mod.rs plus a sibling implementation file.
--recipeGenerate recipe.rs and a folder layout.
--childrenAdd generic children support.
--no-testOmit the generated render test.
--root <DIR>Use an explicit project root.
--dry-run [text|json]Print the plan without writing.
--forceOverwrite generated files.

Names can include folders. pricing/feature-row becomes src/components/pricing/feature_row.rs or a folder-backed component when --folder or --recipe is used.

Layouts

proa generate layout marketing-shell --section
proa generate layout root-document --document
FlagBehavior
--sectionGenerate a section-level wrapper.
--documentGenerate a full document shell.
--root <DIR>Use an explicit project root.
--dry-run [text|json]Print the plan without writing.
--forceOverwrite generated files.

--document and --section cannot be combined.

Data Modules

proa generate data pricing-plans

Data modules are written under src/static_data and registered in the nearest module file.

Module Updates

Generators append missing pub mod ...; lines to parent mod.rs files. Existing matching lines are left in place, so repeated dry runs and repeated generation do not duplicate module exports.

Safety Workflow

Use this pattern when generating into a project with local edits:

proa generate component pricing/feature-row --children --recipe --dry-run
proa generate component pricing/feature-row --children --recipe
cargo fmt --all
cargo test

Only use --force when you intend to replace generated files.

Search

Type at least 2 characters