Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/app/z2ui5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "z2ui5",
"version": "1.0.0",
"private": true,
"description": "abap2UI5 UI5 frontend — html5 module built and deployed to the SAP BTP HTML5 application repository by the mta.yaml `abap2UI5` module",
"scripts": {
"build:cf": "ui5 build --clean-dest --dest dist && node -e \"require('fs').copyFileSync('xs-app.json','dist/xs-app.json')\""
},
"devDependencies": {
"@ui5/cli": "^4.0.0"
}
}
8 changes: 8 additions & 0 deletions src/app/z2ui5/ui5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
specVersion: "3.0"
metadata:
name: z2ui5
type: application
# The UI5 runtime is loaded at request time from the `ui5` destination
# (https://ui5.sap.com, see mta.yaml + xs-app.json), so the build only
# bundles the app's own code (Component-preload) — no framework libraries
# are resolved or self-contained here.
24 changes: 24 additions & 0 deletions src/app/z2ui5/xs-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"routes": [
{
"source": "^/resources/(.*)$",
"target": "/resources/$1",
"destination": "ui5",
"authenticationType": "none"
},
{
"source": "^/test-resources/(.*)$",
"target": "/test-resources/$1",
"destination": "ui5",
"authenticationType": "none"
},
{
"source": "^(.*)$",
"target": "$1",
"service": "html5-apps-repo-rt",
"authenticationType": "xsuaa"
}
]
}
23 changes: 23 additions & 0 deletions test/assemble-cap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,29 @@ describe("assemble-cap happy path", () => {
expect(lock.packages["node_modules/express"].version).toBe("5.0.0");
});

test("html5 module scaffolding in src/app/z2ui5 survives the webapp overlay", () => {
root = makeFixture();
// the deployable html5 module (mta.yaml `abap2UI5`, path app/z2ui5)
// ships its build scaffolding as a sibling of webapp/. The overlay must
// replace only app/z2ui5/webapp, never the scaffolding next to it.
writeJson(path.join(root, "src", "app", "z2ui5", "package.json"), {
name: "z2ui5",
scripts: { "build:cf": "ui5 build --clean-dest --dest dist" },
});
write(path.join(root, "src", "app", "z2ui5", "ui5.yaml"), "type: application\n");
write(path.join(root, "src", "app", "z2ui5", "xs-app.json"), "{}\n");

expect(runAssemble(root).status).toBe(0);

const z2ui5 = path.join(root, "run", "output", "cap2UI5", "app", "z2ui5");
// scaffolding preserved verbatim …
expect(readJson(path.join(z2ui5, "package.json")).scripts["build:cf"]).toBeDefined();
expect(fs.existsSync(path.join(z2ui5, "ui5.yaml"))).toBe(true);
expect(fs.existsSync(path.join(z2ui5, "xs-app.json"))).toBe(true);
// … and the webapp is still overlaid from the core right beside it
expect(fs.existsSync(path.join(z2ui5, "webapp", "Component.js"))).toBe(true);
});

test("is idempotent — a second run succeeds and produces the same lock", () => {
root = makeFixture();
expect(runAssemble(root).status).toBe(0);
Expand Down