Add BSP build, validation, and round-trip conversion tools#3
Open
oblomov-dev wants to merge 10 commits intomainfrom
Open
Add BSP build, validation, and round-trip conversion tools#3oblomov-dev wants to merge 10 commits intomainfrom
oblomov-dev wants to merge 10 commits intomainfrom
Conversation
- Workflow `.github/workflows/build-bsp.yml` runs `ui5 build` then converts the output into an abapGit-compatible BSP layout, uploaded as artifact - `scripts/build-bsp.mjs` implements the conversion: filename encoding (`/` -> `_-` in pagenames, `/` -> `#` in BSP/package names), subfolder layout with `FOLDER_LOGIC=FULL`, MIMETYPE/IS_START_PAGE for index.html, alphabetical PAGES sorting, manifest.json odata patching - Encoding rules verified against the abapGit WAPA serializer source
scripts/validate-bsp.mjs checks the generated layout against the abapGit WAPA invariants: - .abapgit.xml present with required fields - package folder + package.devc.xml present - WAPA header ATTRIBUTES complete (APPLNAME, APPLCLAS, APPLEXT, ...) - per-page: PAGEKEY = upper(PAGENAME), file exists at encoded name, exactly one of PAGETYPE/MIMETYPE, APPLNAME matches header - PAGES sorted alphabetically (matches abapGit serializer) - at most one IS_START_PAGE; index.html must be the start page - no duplicate PAGEKEYs, no orphan files in package folder - manifest.json valid JSON with patched odata URI The workflow now runs the validator after the converter (hard fail) and abaplint on the result for an additional XML/structural check (non-blocking, warnings only).
scripts/bsp-to-ui5.mjs reads a generated/cloned BSP repo, locates the *.wapa.xml index, and reconstructs the original webapp/ folder by walking the PAGES list (PAGENAME holds the original path). Auto-discovers STARTING_FOLDER from .abapgit.xml and finds the WAPA file under it, so the same script works for any BSP repo regardless of package layout (flat or subfolder, with or without namespace). Optional --odata flag rewrites manifest.json dataSource URIs (useful when round-tripping back from a SAP backend to a CAP/local one).
- New `.github/workflows/restore-ui5.yml`: workflow_dispatch that runs scripts/bsp-to-ui5.mjs against any BSP directory in the checked-out repo and uploads the reconstructed webapp as artifact. - Update `.github/workflows/build-bsp.yml` to round-trip the freshly built BSP back to UI5 form and diff against the original ui5-build output. Catches lossy encoding / decoding regressions immediately. manifest.json is excluded from the byte-diff because it is re-serialized by JSON.stringify on both directions; the converter's semantic check on manifest.json is covered by validate-bsp.
- scripts/ui5-to-bsp.mjs (renamed from build-bsp.mjs, content unchanged) - scripts/validate-ui5.mjs (new): checks manifest.json, Component.js, rootView resolution, view->controller wiring, css resources - workflows updated to use the new script name and run validate-ui5 on both the source webapp (build) and the restored webapp (build + restore round-trip)
Both workflows now expose: - source_dir (default: input) - result_dir (default: output) build-bsp.yml: source_dir is the UI5 app directory (was 'app_v2_new'), result_dir is the BSP output directory (was hardcoded 'result'). restore-ui5.yml: source_dir replaces bsp_dir (was 'result'), result_dir replaces out_dir (was 'webapp_restored'). Generic defaults make the workflows reusable across repositories.
- Add layout entry for scripts/ - Add "BSP conversion scripts" section with per-script usage, flags table, customer-namespace example, and a round-trip verification recipe - All four scripts are documented for direct manual use with `node`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add three Node.js scripts and two GitHub Actions workflows to support building UI5 applications into abapGit-compatible BSP (Business Server Page) repositories and converting them back to UI5 webapp format.
Key Changes
Scripts
scripts/build-bsp.mjs: Converts UI5 build output (dist/) into an abapGit BSP layout with proper WAPA (Web Application) XML structure. Handles:.abapgit.xml,package.devc.xml, and*.wapa.xmlmetadata filesscripts/validate-bsp.mjs: Validates a generated BSP layout against abapGit WAPA invariants:.abapgit.xmlstructure and required fieldsscripts/bsp-to-ui5.mjs: Reverse converter that reconstructs the original UI5 webapp directory from a BSP repository:GitHub Actions Workflows
.github/workflows/build-bsp.yml: Orchestrates the full build pipeline:npm run build.github/workflows/restore-ui5.yml: Standalone workflow to restore UI5 webapp from an existing BSP repository with optional OData URI rewritingNotable Implementation Details
_-/NS/NAME→#ns#namein filenames (lowercase), but APPLNAME in XML preserves uppercase/NAMESPACE/NAME) and non-namespaced (Z***) BSP application nameshttps://claude.ai/code/session_01SX6tjxKQXgdD5oJZWheWB3