Feat/Add Fragment Generation Support#4864
Conversation
- Add Fragment interface with name, folder, and content properties - Add generateFragment(basePath, fragment, fs) function - Reuses same template and logic as generateCustomColumn - Does NOT modify manifest.json (fragment-only generation) - Export Fragment type and generateFragment function from main index - Uses getDefaultFragmentContent() for sample <Text> content - Follows same pattern as other fe-fpm-writer generators
- Move Fragment interface from column/index.ts to column/types.ts - Follow same pattern as other types (CustomTableColumn, CustomAction, etc.) - Update imports and exports accordingly
🦋 Changeset detectedLatest commit: 002d653 The changes in this PR will be included in the next version bump. This PR includes changesets to release 96 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 |
SummaryThe following content is AI-generated and provides a summary of the pull request: Add Standalone Fragment Generation Capability to
|
There was a problem hiding this comment.
The PR introduces a generateFragment function and associated types. Three issues were identified: (1) fragment.name is not validated, allowing empty strings or path-traversal values to produce malformed/unsafe file paths; (2) createIdGenerator performs an expensive async filesystem scan unconditionally even when fragment.content is already provided by the caller; (3) when the target fragment file already exists, the function silently returns a no-op with no error or signal to the caller. Additionally, no unit tests for generateFragment appear to be included in this PR, which falls below the project's 80% coverage requirement per AGENTS.md.
|
| '@sap-ux/fe-fpm-writer': minor | ||
| '@sap-ux/fe-fpm-cli': patch | ||
| '@sap-ux/odata-cli': patch | ||
| '@sap-ux/generator-simple-fe': patch | ||
| '@sap-ux-private/ui-prompting-examples': patch | ||
| '@sap-ux/abap-deploy-config-inquirer': patch | ||
| '@sap-ux/abap-deploy-config-sub-generator': patch | ||
| '@sap-ux/abap-deploy-config-writer': patch | ||
| '@sap-ux/adp-flp-config-sub-generator': patch | ||
| '@sap-ux/adp-tooling': patch | ||
| '@sap-ux/annotation-generator': patch | ||
| '@sap-ux/app-config-writer': patch | ||
| '@sap-ux/axios-extension': patch | ||
| '@sap-ux/backend-proxy-middleware': patch | ||
| '@sap-ux/backend-proxy-middleware-cf': patch | ||
| '@sap-ux/btp-utils': patch | ||
| '@sap-ux/cap-config-writer': patch | ||
| '@sap-ux/cds-annotation-parser': patch | ||
| '@sap-ux/cds-odata-annotation-converter': patch | ||
| '@sap-ux/cf-deploy-config-inquirer': patch | ||
| '@sap-ux/cf-deploy-config-sub-generator': patch | ||
| '@sap-ux/cf-deploy-config-writer': patch | ||
| '@sap-ux/control-property-editor': patch | ||
| '@sap-ux-private/control-property-editor-common': patch | ||
| '@sap-ux/create': patch | ||
| '@sap-ux/deploy-config-generator-shared': patch | ||
| '@sap-ux/deploy-config-sub-generator': patch | ||
| '@sap-ux/deploy-tooling': patch | ||
| '@sap-ux/environment-check': patch | ||
| '@sap-ux/eslint-plugin-fiori-tools': patch | ||
| '@sap-ux/feature-toggle': patch | ||
| '@sap-ux/fiori-annotation-api': patch | ||
| '@sap-ux/fiori-app-sub-generator': patch | ||
| '@sap-ux/fiori-docs-embeddings': patch | ||
| '@sap-ux/fiori-elements-writer': patch | ||
| '@sap-ux/fiori-freestyle-writer': patch | ||
| '@sap-ux/fiori-generator-shared': patch | ||
| '@sap-ux/fiori-mcp-server': patch | ||
| '@sap-ux/fiori-tools-settings': patch | ||
| '@sap-ux/flp-config-inquirer': patch | ||
| '@sap-ux/flp-config-sub-generator': patch | ||
| '@sap-ux/generator-adp': patch | ||
| '@sap-ux/generator-odata-downloader': patch | ||
| '@sap-ux/guided-answers-helper': patch | ||
| '@sap-ux/i18n': patch | ||
| '@sap-ux/inquirer-common': patch | ||
| '@sap-ux/jest-environment-ui5': patch | ||
| '@sap-ux/jest-file-matchers': patch | ||
| '@sap-ux/jest-runner-puppeteer': patch | ||
| '@sap-ux/launch-config': patch | ||
| '@sap-ux/logger': patch | ||
| '@sap-ux/mockserver-config-writer': patch | ||
| '@sap-ux/nodejs-utils': patch | ||
| '@sap-ux/odata-annotation-core': patch | ||
| '@sap-ux/odata-annotation-core-types': patch | ||
| '@sap-ux/odata-entity-model': patch | ||
| '@sap-ux/odata-service-inquirer': patch | ||
| '@sap-ux/odata-service-writer': patch | ||
| '@sap-ux/odata-vocabularies': patch | ||
| '@sap-ux-private/playwright': patch | ||
| '@sap-ux/preview-middleware': patch | ||
| '@sap-ux-private/preview-middleware-client': patch | ||
| '@sap-ux/project-access': patch | ||
| '@sap-ux/project-input-validator': patch | ||
| '@sap-ux/project-integrity': patch | ||
| '@sap-ux/reload-middleware': patch | ||
| '@sap-ux/repo-app-import-sub-generator': patch | ||
| 'sap-ux-sap-systems-ext': patch | ||
| '@sap-ux/sap-systems-ext-types': patch | ||
| '@sap-ux/sap-systems-ext-webapp': patch | ||
| '@sap-ux/serve-static-middleware': patch | ||
| '@sap-ux/store': patch | ||
| '@sap-ux/system-access': patch | ||
| '@sap-ux/telemetry': patch | ||
| '@sap-ux/text-document-utils': patch | ||
| '@sap-ux/ui-components': patch | ||
| '@sap-ux/ui-prompting': patch | ||
| '@sap-ux/ui-service-inquirer': patch | ||
| '@sap-ux/ui-service-sub-generator': patch | ||
| '@sap-ux/ui5-application-inquirer': patch | ||
| '@sap-ux/ui5-application-writer': patch | ||
| '@sap-ux/ui5-config': patch | ||
| '@sap-ux/ui5-info': patch | ||
| '@sap-ux/ui5-library-inquirer': patch | ||
| '@sap-ux/ui5-library-reference-inquirer': patch | ||
| '@sap-ux/ui5-library-reference-sub-generator': patch | ||
| '@sap-ux/ui5-library-reference-writer': patch | ||
| '@sap-ux/ui5-library-sub-generator': patch | ||
| '@sap-ux/ui5-library-writer': patch | ||
| '@sap-ux/ui5-proxy-middleware': patch | ||
| '@sap-ux/ui5-test-writer': patch | ||
| '@sap-ux/xml-odata-annotation-converter': patch | ||
| '@sap-ux/yaml': patch | ||
| 'test-project': patch | ||
| '@sap-ux-private/adaptation-editor-tests': patch | ||
| '@sap-ux/types': patch |
There was a problem hiding this comment.
Changes are only done in fe-fmp-writer. Dependencies will be handled by the workspace links
| '@sap-ux/fe-fpm-writer': minor | |
| '@sap-ux/fe-fpm-cli': patch | |
| '@sap-ux/odata-cli': patch | |
| '@sap-ux/generator-simple-fe': patch | |
| '@sap-ux-private/ui-prompting-examples': patch | |
| '@sap-ux/abap-deploy-config-inquirer': patch | |
| '@sap-ux/abap-deploy-config-sub-generator': patch | |
| '@sap-ux/abap-deploy-config-writer': patch | |
| '@sap-ux/adp-flp-config-sub-generator': patch | |
| '@sap-ux/adp-tooling': patch | |
| '@sap-ux/annotation-generator': patch | |
| '@sap-ux/app-config-writer': patch | |
| '@sap-ux/axios-extension': patch | |
| '@sap-ux/backend-proxy-middleware': patch | |
| '@sap-ux/backend-proxy-middleware-cf': patch | |
| '@sap-ux/btp-utils': patch | |
| '@sap-ux/cap-config-writer': patch | |
| '@sap-ux/cds-annotation-parser': patch | |
| '@sap-ux/cds-odata-annotation-converter': patch | |
| '@sap-ux/cf-deploy-config-inquirer': patch | |
| '@sap-ux/cf-deploy-config-sub-generator': patch | |
| '@sap-ux/cf-deploy-config-writer': patch | |
| '@sap-ux/control-property-editor': patch | |
| '@sap-ux-private/control-property-editor-common': patch | |
| '@sap-ux/create': patch | |
| '@sap-ux/deploy-config-generator-shared': patch | |
| '@sap-ux/deploy-config-sub-generator': patch | |
| '@sap-ux/deploy-tooling': patch | |
| '@sap-ux/environment-check': patch | |
| '@sap-ux/eslint-plugin-fiori-tools': patch | |
| '@sap-ux/feature-toggle': patch | |
| '@sap-ux/fiori-annotation-api': patch | |
| '@sap-ux/fiori-app-sub-generator': patch | |
| '@sap-ux/fiori-docs-embeddings': patch | |
| '@sap-ux/fiori-elements-writer': patch | |
| '@sap-ux/fiori-freestyle-writer': patch | |
| '@sap-ux/fiori-generator-shared': patch | |
| '@sap-ux/fiori-mcp-server': patch | |
| '@sap-ux/fiori-tools-settings': patch | |
| '@sap-ux/flp-config-inquirer': patch | |
| '@sap-ux/flp-config-sub-generator': patch | |
| '@sap-ux/generator-adp': patch | |
| '@sap-ux/generator-odata-downloader': patch | |
| '@sap-ux/guided-answers-helper': patch | |
| '@sap-ux/i18n': patch | |
| '@sap-ux/inquirer-common': patch | |
| '@sap-ux/jest-environment-ui5': patch | |
| '@sap-ux/jest-file-matchers': patch | |
| '@sap-ux/jest-runner-puppeteer': patch | |
| '@sap-ux/launch-config': patch | |
| '@sap-ux/logger': patch | |
| '@sap-ux/mockserver-config-writer': patch | |
| '@sap-ux/nodejs-utils': patch | |
| '@sap-ux/odata-annotation-core': patch | |
| '@sap-ux/odata-annotation-core-types': patch | |
| '@sap-ux/odata-entity-model': patch | |
| '@sap-ux/odata-service-inquirer': patch | |
| '@sap-ux/odata-service-writer': patch | |
| '@sap-ux/odata-vocabularies': patch | |
| '@sap-ux-private/playwright': patch | |
| '@sap-ux/preview-middleware': patch | |
| '@sap-ux-private/preview-middleware-client': patch | |
| '@sap-ux/project-access': patch | |
| '@sap-ux/project-input-validator': patch | |
| '@sap-ux/project-integrity': patch | |
| '@sap-ux/reload-middleware': patch | |
| '@sap-ux/repo-app-import-sub-generator': patch | |
| 'sap-ux-sap-systems-ext': patch | |
| '@sap-ux/sap-systems-ext-types': patch | |
| '@sap-ux/sap-systems-ext-webapp': patch | |
| '@sap-ux/serve-static-middleware': patch | |
| '@sap-ux/store': patch | |
| '@sap-ux/system-access': patch | |
| '@sap-ux/telemetry': patch | |
| '@sap-ux/text-document-utils': patch | |
| '@sap-ux/ui-components': patch | |
| '@sap-ux/ui-prompting': patch | |
| '@sap-ux/ui-service-inquirer': patch | |
| '@sap-ux/ui-service-sub-generator': patch | |
| '@sap-ux/ui5-application-inquirer': patch | |
| '@sap-ux/ui5-application-writer': patch | |
| '@sap-ux/ui5-config': patch | |
| '@sap-ux/ui5-info': patch | |
| '@sap-ux/ui5-library-inquirer': patch | |
| '@sap-ux/ui5-library-reference-inquirer': patch | |
| '@sap-ux/ui5-library-reference-sub-generator': patch | |
| '@sap-ux/ui5-library-reference-writer': patch | |
| '@sap-ux/ui5-library-sub-generator': patch | |
| '@sap-ux/ui5-library-writer': patch | |
| '@sap-ux/ui5-proxy-middleware': patch | |
| '@sap-ux/ui5-test-writer': patch | |
| '@sap-ux/xml-odata-annotation-converter': patch | |
| '@sap-ux/yaml': patch | |
| 'test-project': patch | |
| '@sap-ux-private/adaptation-editor-tests': patch | |
| '@sap-ux/types': patch | |
| '@sap-ux/fe-fpm-writer': minor |
| /** | ||
| * Fragment generation configuration. | ||
| */ | ||
| export interface Fragment { |
There was a problem hiding this comment.
The Fragment interface is placed in column/types.ts, but it has no conceptual relationship to columns - it's a general concept. This could live in a dedicated fragment/types.ts or common/types.ts.
| }); | ||
|
|
||
| test('generate fragment with default options', async () => { | ||
| const { generateFragment } = await import('../../src/index.js'); |
There was a problem hiding this comment.
Tests import generateFragment via dynamic await import('../../src/index.js') inside each test body - this is inconsistent with how the rest of the test file imports. Other tests in the file use static imports at the top. The dynamic imports here appear unnecessary.
| const { path: manifestPath } = await getManifest(basePath, fs); | ||
|
|
||
| // Calculate path for fragment | ||
| const folder = fragment.folder || 'ext/fragment'; |
There was a problem hiding this comment.
The folder parameter is used directly in join() with no sanitization. A caller passing folder: '../../../etc' would write outside the project.
| * @param {Editor} [fs] - the mem-fs editor instance | ||
| * @returns {Promise<Editor>} the updated mem-fs editor instance | ||
| */ | ||
| export async function generateFragment(basePath: string, fragment: Fragment, fs?: Editor): Promise<Editor> { |
There was a problem hiding this comment.
Why is this nested under /column? It's not just fragments for table columns, right? Then it should be e.g. in /fragment or /common



Summary
Add standalone fragment generation capability to fe-fpm-writer and specification packages for use in table columns and other UI customizations.
Changes
open-ux-tools (feat/generate-fragment-function)
generateFragment()function infe-fpm-writer/src/column/index.tsFragmentinterface infe-fpm-writer/src/column/types.tsfollowing existing type patternsspecification (integration branch)
CustomExtensionType.Fragmentenum value inpackages/types/src/apiTypes.tsFragmenttype from@sap-ux/fe-fpm-writergenerateFragmentinfpmWriterMapinpackages/specification/src/api.tsAPI
Notes
.fragment.xmlfiles without modifying manifest.json