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
2 changes: 1 addition & 1 deletion .deploy/mta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ID: tutorials-ims
# Bump this on each release you deploy — it's the version shown by `cf mtas`
# and in the mtar filename (tutorials-ims_<version>.mtar). Deploy is manual:
# `cd .deploy && mbt build && cf deploy mta_archives/tutorials-ims_<version>.mtar -e ../deploy/<env>.mtaext -f`.
version: 1.38.0
version: 1.39.1

# Top-level parameters (overridable per-env via deploy/<env>.mtaext).
parameters:
Expand Down
31 changes: 30 additions & 1 deletion app/admin-shell/scripts/discover-admin-components.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,32 @@ function isFioriComponent(adminDir, folder) {
existsSync(join(webapp, 'manifest.json'))
}

// A preload-built component (the default for every discovered tile — see
// preload-components.cjs) is run through `ui5 build`, which needs the app's own
// `ui5.yaml`. copy-components.js gates the preload path on `existsSync(ui5.yaml)`
// and SILENTLY falls back to a raw cpSync when it's missing. Raw copy ships the
// unminified source with NO Component-preload.js, so at runtime UI5 resolves each
// declared lib as an individual module straight from the SAPUI5 CDN. For most
// tiles those libs are already loaded by the shell, so the gap is invisible; a
// freestyle OData-V4 tile (app/admin/health) is the first to depend on
// `sap/ui/model/odata/v4/library.js`, whose raw CDN fetch then fails with a
// ModuleError "script load error". Rather than let that degrade silently, fail
// the build the moment a non-excluded component lacks its ui5.yaml.
function hasUi5Yaml(adminDir, folder) {
return existsSync(join(adminDir, folder, 'ui5.yaml'))
}

/**
* @param {string} [adminDir] — root of the admin apps tree.
* @param {Set<string>} [preloadExclude] — folders intentionally kept on the
* raw-copy path; these are exempt from the ui5.yaml-presence guard. Defaults
* to empty (every tile is preload-built, so every tile needs its ui5.yaml).
* @returns {Array<{folder: string, appId: string, camelName: string}>}
* `folder` — the on-disk directory name under `app/admin/`.
* `appId` — the `sap.app.id` read from the app's own `webapp/manifest.json`.
* `camelName` — the last segment of `appId`, matching the folder's camelCase form.
*/
function discoverComponents(adminDir = ADMIN_DIR) {
function discoverComponents(adminDir = ADMIN_DIR, preloadExclude = new Set()) {
const entries = readdirSync(adminDir, { withFileTypes: true })
.filter(e => e.isDirectory())
.map(e => e.name)
Expand Down Expand Up @@ -70,6 +89,16 @@ function discoverComponents(adminDir = ADMIN_DIR) {
`expected "${expected}" (camelCase of folder name). ` +
`Fix either the folder name or the manifest id so the two agree.`)
}
if (!preloadExclude.has(folder) && !hasUi5Yaml(adminDir, folder)) {
throw new Error(
`app/admin/${folder}: missing ui5.yaml. Preload-built components need it ` +
`for \`ui5 build\` to emit a Component-preload.js; without it copy-components.js ` +
`falls back to a raw copy that ships NO preload, so UI5 lazy-loads each lib ` +
`from the CDN at runtime (freestyle OData-V4 tiles then fail with a ` +
`"script load error" ModuleError on sap/ui/model/odata/v4/library.js). ` +
`Add app/admin/${folder}/ui5.yaml (copy a sibling), or add "${folder}" to ` +
`PRELOAD_EXCLUDE in preload-components.cjs to intentionally ship it raw.`)
}
components.push({ folder, appId, camelName })
}

Expand Down
4 changes: 3 additions & 1 deletion app/admin-shell/scripts/preload-components.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ const { discoverComponents } = require('./discover-admin-components');
const PRELOAD_EXCLUDE = new Set([]);

function computePreloadComponents() {
const { components } = discoverComponents();
// Pass PRELOAD_EXCLUDE so discoverComponents' ui5.yaml-presence guard exempts
// exactly the folders we intentionally keep on the raw-copy path.
const { components } = discoverComponents(undefined, PRELOAD_EXCLUDE);
return new Set(
components
.map(c => c.folder)
Expand Down
13 changes: 13 additions & 0 deletions app/admin/health/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "sap.tutorials.admin.health",
"version": "0.0.1",
"private": true,
"description": "Health - Admin UI",
"scripts": {
"start": "fiori run --open index.html",
"build": "ui5 build --clean-dest"
},
"devDependencies": {
"@ui5/cli": "^4.0.0"
}
}
10 changes: 10 additions & 0 deletions app/admin/health/ui5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
specVersion: "4.0"
metadata:
name: sap.tutorials.admin.health
type: application
framework:
name: SAPUI5
version: "1.148.12"
libraries:
- name: sap.m
- name: sap.ui.core
3 changes: 1 addition & 2 deletions app/admin/health/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
"minUI5Version": "1.148.0",
"libs": {
"sap.m": {},
"sap.ui.core": {},
"sap.ui.model.odata.v4": {}
"sap.ui.core": {}
}
},
"models": {
Expand Down
Loading
Loading