equinor / equinor/fusion-framework

Fusion Framework - Router Manifest Generation

Open
#3,719 0 comments 0 reactions 1 assignee Claimed by @odinr View on GitHub
✨ improvement
Dominant language
TypeScript
Stars
10
Forks
10
Avg merge
19h 40m
Merged PRs (30d)
150

Description

# Phase 3: Manifest Generation & CLI Integration

**Parent Objective**: #3716
**Related User Story**: #3715

## Objective

Implement route metadata extraction and integrate it with existing app and portal manifest generation commands, ensuring routes are included in build manifests for static analysis and tooling.

## Tasks

6. **Create Route Manifest Generator** - Implement `extractRouteMetadata()` function to extract route metadata from `RouteNode[]`
- Implement `extractRouteMetadata()` function
- Extract route metadata from `RouteNode[]` recursively
- Generate manifest structure: `{ path, description, params, search, children? }`
- Ensure no file paths or component references in manifest
- Support routes defined in multiple files
- Handle routes with dynamic segments, optional segments, and query parameters

7. **Integrate with App Manifest Generation** - Update `AppBuildManifest` and `createAppManifestFromPackage()` to include optional `routes` field
- Update `AppBuildManifest` type in `packages/modules/app/src/types.ts` to include optional `routes` field
- Update `createAppManifestFromPackage()` to extract routes from app config
- Integrate route extraction into `ffc app manifest` command
- Ensure routes field is optional (backward compatible)

8. **Integrate with Portal Manifest Generation** - Update `PortalManifestBuildSchema` to include optional `routes` field
- Update `PortalManifestBuildSchema` in `packages/cli/src/lib/portal/portal-manifest.schema.ts` to include optional `routes` field
- Integrate route extraction into `ffc portal manifest` command
- Ensure routes field is optional (backward compatible)

9. **Add Route Validation** - Implement validation and error reporting for route schemas
- Implement route schema validation
- Validate enum values, parameter types
- Report errors with file locations and clear messages
- Handle invalid route definitions gracefully

## Deliverables

- `extractRouteMetadata()` function that extracts route metadata from `RouteNode[]`
- Updated `AppBuildManifest` type with optional `routes` field
- Updated `PortalManifestBuildSchema` with optional `routes` field
- Route extraction integrated into `ffc app manifest` and `ffc portal manifest` commands
- Route validation and error reporting

## Acceptance Criteria

- Route metadata is extracted during existing `ffc app manifest` and `ffc portal manifest` commands
- Routes are added to `AppBuildManifest` and `PortalManifestBuildSchema` as optional `routes` field
- Route extraction runs during build process (before bundling) as part of manifest generation
- Route extraction does not require app execution or DOM environment
- CLI validates route schemas and reports errors with file locations during manifest generation
- Routes in manifest can be consumed by documentation tools, SSG tools, and other build-time tools
- Routes field is optional - apps without routes still generate valid manifests
- The manifest contains **only**: `path`, `description`, `params`, `search` — **no file paths, no component references**
- No runtime cost: manifest is generated **before** bundling (static analysis only)

## Estimated Timeline

**Phase 3**: 2-3 days

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.