Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
sap-btp-html5-repo【部署与运维】SAP BTP HTML5 Application Repository — deploy and host SAPUI5/Fiori/HTML5 apps on BTP, app router configuration, versioning, integration with Launchpad Service. Use when deploying Fiori/UI5 apps to BTP, configuring app router for HTML5 apps, or managing UI5 app lifecycle.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
name: sap-btp-html5-repo description: SAP BTP HTML5 Application Repository — deploy and host SAPUI5/Fiori/HTML5 apps on BTP, app router configuration, versioning, integration with Launchpad Service. Use when deploying Fiori/UI5 apps to BTP, configuring app router for HTML5 apps, or managing UI5 app lifecycle. trigger:
Host and serve SAPUI5/Fiori/HTML5 applications on SAP BTP — managed app hosting with built-in app router and Launchpad integration.
cf login)dist/ folder)mbt and @sap/html5-deployercf create-service html5-apps-repo app-host my-repo
cf create-service-key my-repo my-key
{
"welcomeFile": "/index.html",
"authenticationMethod": "route",
"routes": [
{
"source": "^/sap/opu/odata/(.*)quot;,
"target": "/sap/opu/odata/$1",
"destination": "S4HANA_BACKEND",
"csrfProtection": true,
"authenticationType": "xsuaa"
},
{
"source": "^/(.*)quot;,
"target": "$1",
"localDir": "webapp",
"authenticationType": "xsuaa"
}
]
}
Key fields: source (regex match), destination (CF destination name), localDir (static file path), authenticationType (xsuaa or none).
cd my-fiori-app
npm install
npm run build
npx @sap/html5-deployer deploy \
--service-instance my-repo \
--source ./dist \
--app-name com.myorg.myapp
App becomes available at:
https://<launchpad>.launchpad.cfapps.<region>.hana.ondemand.com/sites#myapp
# mta.yaml
modules:
- name: my-fiori-app
type: html5
path: app
requires:
- name: my-repo
- name: my-xsuaa
- name: s4hana-destination
parameters:
app-name: com.myorg.myapp
resources:
- name: my-repo
type: org.cloudfoundry.managed-service
parameters:
service: html5-apps-repo
service-plan: app-host
mbt build
cf deploy mta_archives/my-fiori-app_1.0.0.mtar
# Deploy a specific version
npx @sap/html5-deployer deploy --app-version 2.1.0
# List all versions of an app
cf html5-list --app-name com.myorg.myapp
# Rollback to a previous version
cf html5-rollback --app-name com.myorg.myapp --version 2.0.0
Create → Upload → Deploy → Test → Promote (Dev → Prod)
↑ ↓
└────────── Update (new version) ──────────────┘
Pitfall: App name rejected on deploy
com.<org>.<appname> — lowercase, dotted, globally unique.cf html5-list before deploying.Pitfall: App not visible in Launchpad
sap.app crossNavigation config in manifest.json.crossNavigation.inbounds to manifest.json. Ensure the Launchpad Service subscription exists and the app is assigned to the same subaccount.Pitfall: CORS errors when calling backend OData
xs-app.json destination. Do not call the backend directly from the browser.Pitfall: Deploy fails with "file too large"
node_modules/, test/, and source maps from the dist folder. Use .cfignore or build config to strip dev assets.Pitfall: Stale assets served after redeploy
Component-ab12cd.js) in the UI5 build config. This forces cache busting on version change.# 1. Verify service instance
cf services | grep my-repo
# 2. Verify app was deployed
cf html5-list --app-name com.myorg.myapp
# → Should list deployed versions
# 3. Test app router serves the app
curl "https://my-approuter.cfapps.<region>.hana.ondemand.com/index.html"
# → Should return HTML (redirect to login if auth required)
# 4. Verify OData destination works through app router
curl "https://my-approuter.cfapps.<region>.hana.ondemand.com/sap/opu/odata/sap/ZMY_SRV/EntitySet?\$top=1" \
-H "Authorization: Bearer <jwt>"
# → Should return OData JSON, not CORS error
# 5. Verify app in Launchpad
# Open: https://<launchpad>.launchpad.cfapps.<region>.hana.ondemand.com/sites
# → App should appear in the site navigation