feat(fe-fpm-writer): update page building block for new aggregations#4781
feat(fe-fpm-writer): update page building block for new aggregations#4781eouin wants to merge 64 commits into
Conversation
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: (37 commits) chore: apply latest changesets feat(ui5-test-writer): Generate tests for Actions on the Object Page (#4632) chore: apply latest changesets fix(deploy-tooling): skip ATO prefix enforcement for on-premise systems (#4687) chore: apply latest changesets chore: bump used versions in adaptation project for Cloud Foundry (#4685) chore: apply latest changesets fix: Add margins to panel horizontal borders to distinguish them from splitter borders (#4682) chore: apply latest changesets fix(ci): upgrade pnpm to 11.1.2 to enable native OIDC trusted publishing (#4689) chore: apply latest changesets Feat(eslint-fiori-tools-plugin): Add data field in header facet rule check support for cds annotations (#4660) chore: apply latest changesets feat(odata-service-inquirer): 37088 output tab link (#4612) chore: apply latest changesets skip test harness files when virtual preview endpoints are enabled #4657 (#4671) fix(ci): exchange GitHub OIDC token for npm granular access token before publish (#4686) fix(ci): add provenance=true to .npmrc to enable pnpm OIDC trusted publishing (#4684) chore: apply latest changesets fix(ci): remove registry-url from release job setup-node to fix OIDC publish (#4683) ...
🦋 Changeset detectedLatest commit: 9b1a9f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
The PR introduces a "full" template mode for the Page building block, adding 7 aggregation fragments, a controller template, and a new appendPageBBAggregation API. Several correctness issues were found: the TypeScript detection heuristic in applyPageControllerTemplate relies on a pre-existing .controller.ts file rather than a project-level signal (e.g. tsconfig.json), leading to always generating JS controllers in fresh projects; appendPageBBAggregation assigns the same uniqueId to every child element in the parsed fragment when multiple elements are present; the bare sap.m element names in items.xml (IconTabBar, etc.) will not be namespace-resolved when sap.m uses a prefix rather than the default namespace; and _nsMap is accessed on a potentially-null firstChild without a null guard. Additionally, the aggregations field on Page should be narrowed from Record<string, string> to Partial<Record<PageAggregationName, string>> for compile-time safety.
There was a problem hiding this comment.
Pull request overview
This PR extends the fe-fpm-writer Page building block to support a new “full” page template option that generates a populated macros:Page with standard aggregations and optional controller stubs, and updates tests/snapshots and prompt translations accordingly.
Changes:
- Add a
templateTypeprompt for Page building block generation (“Basic” vs “Full”). - Implement full Page template generation: insert 7 canonical aggregations (with ordering + IDs) and optionally copy controller stubs.
- Update unit tests and Jest snapshots to reflect the new prompt and Page generation behavior.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/fe-fpm-writer/test/unit/prompts/snapshots/prompts.test.ts.snap | Updates prompt snapshots to include the new Page templateType question. |
| packages/fe-fpm-writer/test/unit/building-block.test.ts | Adds unit tests for full/basic Page template generation, controller creation, and appendPageBBAggregation. |
| packages/fe-fpm-writer/templates/building-block/page/View.xml | Adds showFooter="true" when Page templateType is full. |
| packages/fe-fpm-writer/templates/building-block/page/titleContent.xml | New template fragment for titleContent aggregation. |
| packages/fe-fpm-writer/templates/building-block/page/navigationActions.xml | New template fragment for navigationActions aggregation. |
| packages/fe-fpm-writer/templates/building-block/page/items.xml | New template fragment for items aggregation (sample content). |
| packages/fe-fpm-writer/templates/building-block/page/headerContent.xml | New template fragment for headerContent aggregation. |
| packages/fe-fpm-writer/templates/building-block/page/footer.xml | New template fragment for footer aggregation. |
| packages/fe-fpm-writer/templates/building-block/page/Controller.ts | New TS controller stub template for full Page generation. |
| packages/fe-fpm-writer/templates/building-block/page/Controller.js | New JS controller stub template for full Page generation. |
| packages/fe-fpm-writer/templates/building-block/page/breadcrumbs.xml | New template fragment for breadcrumbs aggregation. |
| packages/fe-fpm-writer/templates/building-block/page/actions.xml | New template fragment for actions aggregation. |
| packages/fe-fpm-writer/src/prompts/translations/i18n.ts | Adds i18n strings for the new Page templateType prompt and choices. |
| packages/fe-fpm-writer/src/index.ts | Exposes new Page-related types/constants and exports new helper APIs. |
| packages/fe-fpm-writer/src/building-block/types.ts | Adds templateType and aggregations to the Page building block type and defines PageTemplateType + constants. |
| packages/fe-fpm-writer/src/building-block/prompts/questions/page.ts | Adds the templateType list prompt for the Page building block. |
| packages/fe-fpm-writer/src/building-block/index.ts | Implements full Page aggregation insertion, ordering, controller template copying, and appendPageBBAggregation helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: chore: apply latest changesets bundle mcp server and replace @xenova/transformers with @huggingface/transformers (#4663)
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: chore: apply latest changesets fix(fiori-mcp-server): download ONNX model at runtime to reduce tgz below npm 100 MB limit (#4782)
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: feat(eslint-plugin-fiori-tools): lint flex change files (#4706) Converting the ADP int test to ESM (#4764) chore(workflows): apply OSPO GitHub hardening controls (OIDC + environments) (#4763) chore: apply latest changesets fix(fiori-mcp-server): exclude Windows GPU DLLs to reduce tgz below npm publish limit (#4783)
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: chore: apply latest changesets Fix: CDS multiple service targets in the same file, pointers bug fix (#4796)
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: chore: apply latest changesets fix(telemetry): console.time/timeEnd warning (#4727)
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: (76 commits) chore: apply latest changesets fix(preview-middleware): remove LocalStorageConnector only for ADP (#4794) chore: apply latest changesets feat(preview-middleware): enhance OPA5 pattern for journey collection (#4778) chore: apply latest changesets Fix(preview-middleware): add min ui5 validation to card generator (#4812) chore: apply latest changesets Create breezy-doodles-cut.md (#4834) chore: apply latest changesets fix: (Adaptation Editor) FL Variant changes do not appear in the unsaved changes list (history panel). (#4766) fix: Missing info text for existing SAP Fiori launchpad configuration in ADP (#4808) chore: apply latest changesets fix: Regression in manifest path resolution after recent fix (#4826) chore: apply latest changesets fix(eslint-plugin-fiori-tools): bundle @babel/* to fix conflicts with ui5-tooling-transpile (#4829) Create opa5_docu.md (#4827) chore: apply latest changesets fix: Feature toggle not read on first generator run after ESM migration (#4816) chore: apply latest changesets fix(ui5-test-writer): use js for FPM tests (#4825) ...
…om:SAP/open-ux-tools into feat/38189/update-page-bb-new-aggregations * 'feat/38189/update-page-bb-new-aggregations' of github.com:SAP/open-ux-tools: (26 commits) fix after comments fix after comments fix after comments fix after comments Linting auto fix commit fix after comments fix after comments fix after comments Linting auto fix commit fix after comments fix after comments fix after comments Linting auto fix commit fix after comments fix after comments Create short-planets-prove.md fix after comments fix after comments fix after comments fix after comments ...
|
…om:SAP/open-ux-tools into feat/38189/update-page-bb-new-aggregations * 'feat/38189/update-page-bb-new-aggregations' of github.com:SAP/open-ux-tools: Linting auto fix commit
…pdate-page-bb-new-aggregations * 'main' of github.com:SAP/open-ux-tools: chore: improve changeset (#4730)



feat(fe-fpm-writer): Update Page Building Block with Full Template & Aggregations Support
New Features
✨ Extended the Page building block with a new
templateTypeoption (basic|full). Whenfullis selected, the writer automatically:breadcrumbs,navigationActions,titleContent,actions,headerContent,items,footer) as child elements of the<macros:Page>nodeshowFooter="true"to the page elementA new exported function
appendPageBBAggregationallows incrementally adding a single aggregation to an existing<macros:Page>element, with automatic ID generation, deduplication, canonical ordering, and template comment handling.Changes
building-block/index.ts: AddedappendPageAggregations,sortPageAggregationChildren,appendPageBBAggregation(exported), andapplyPageControllerTemplatefunctions. ExportedPAGE_AGGREGATIONSconstant andPageAggregationNametype. Wired full-template logic intogenerateBuildingBlock.building-block/types.ts: AddedtemplateTypeandaggregationsfields to thePageinterface. DefinedPAGE_TEMPLATE_TYPE_FULL,PAGE_TEMPLATE_TYPE_BASICconstants andPageTemplateTypetype.building-block/prompts/questions/page.ts: Added atemplateTypelist prompt (Basic/Full) as the first question in the Page building block prompts.src/index.ts: ExportedPAGE_TEMPLATE_TYPE_FULL,PAGE_TEMPLATE_TYPE_BASIC,PageTemplateType,appendPageBBAggregation,PAGE_AGGREGATIONS, andPageAggregationName.prompts/translations/i18n.ts: AddedtemplateTypetranslations (Page Layout,Basic,Full).templates/building-block/page/View.xml: Conditionally rendersshowFooter="true"forfulltemplate type.templates/building-block/page/Controller.js&Controller.ts: New controller stub templates with event handler skeletons.templates/building-block/page/*.xml(7 new files): EJS templates for each of the 7 page aggregations.test/unit/building-block.test.ts: Added tests for full template generation (aggregations, JS/TS controller detection, basic template exclusion) andappendPageBBAggregationbehavior.test/unit/prompts/__snapshots__/prompts.test.ts.snap: Updated snapshots to include the newtemplateTypeprompt.PR Bot Information
Version:
1.22.0issue_comment.edited4db26047-585a-430e-a183-901d3998dc50