Skip to content

FEATURE - Serve merged manifest.json via proxy in CF ADP preview mode #4528

@nikmace

Description

@nikmace

As a developer working on a CF ADP project,
I want to have the preview serve a dynamically built and merged manifest.json,
so that I see the latest manifest changes during preview without manually rebuilding

Description

Currently, when previewing CF ADP projects (identified by the cfBuildPath config property), the
manifest.json is served statically from the build output folder via Express serveStatic. This
means:

  1. The adp.proxy() middleware is never registered, so there is no interception of
    /manifest.json requests.
  2. Changes to the manifest are not reflected until a manual rebuild is performed.
  3. There is no mechanism to later plug in an API-based merged manifest (as exists for ABAP mode
    via LREP).

This feature registers the ADP proxy middleware before the static file server in CF mode, so
/manifest.json requests are intercepted, a fresh build is triggered (npm run build with
ADP_BUILDER_MODE=preview), and the latest manifest is served. All other requests continue to be
served from the dist folder. This also lays the groundwork for replacing the local build step
with a remote API call for merged manifests in the future.

Technical Design

  • @sap-ux/preview-middleware (src/base/flp.ts)
    • setupCfBuildMode() now registers adp.proxy before serveStatic, so the proxy intercepts
      /manifest.json and Component-preload.js while static files are still served from the build
      output.
    • @sap-ux/adp-tooling (src/preview/adp-preview.ts)
      • initCfBuildMode() initializes mergedDescriptor from the build path manifest so the
        descriptor getter works in CF mode.
      • sync() in CF mode triggers runBuild() with ADP_BUILDER_MODE=preview and re-reads the
        manifest from the build output.
      • proxy() in CF mode calls next() for non-manifest requests instead of attempting file-based
        redirects (which caused redirect loops when mounted at /).

Acceptance Criteria

GivenWhenThen format (https://martinfowler.com/bliki/GivenWhenThen.html)

Given I have a CF ADP project with cfBuildPath configured,
when I start the preview and request /manifest.json,
then the proxy intercepts the request, triggers a build, and serves the latest manifest from
the build output

Notes

Tasks

  • Unit Tests added
  • Test Cases defined

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions