UNPKG

@ui5/task-adaptation

Version:

Custom task for ui5-builder which allows building UI5 Flexibility Adaptation Projects for SAP BTP, Cloud Foundry environment

45 lines 1.86 kB
import HTML5RepoManager from "../repositories/html5RepoManager.js"; import { validateObject } from "../util/commonUtil.js"; export default class CFProcessor { configuration; cacheManager; constructor(configuration, cacheManager) { this.configuration = configuration; this.cacheManager = cacheManager; } async getBaseAppFiles() { return this.cacheManager.getFiles(() => HTML5RepoManager.getMetadata(this.configuration), () => HTML5RepoManager.getBaseAppFiles(this.configuration)); } validateConfiguration() { validateObject(this.configuration, ["appHostId", "appName", "appVersion"], "should be specified in ui5.yaml configuration"); } async updateLandscapeSpecificContent(renamedBaseAppManifest) { this.updateCloudPlatform(renamedBaseAppManifest); } updateCloudPlatform(renamedBaseAppManifest) { const sapCloudService = renamedBaseAppManifest["sap.cloud"]?.service; const sapPlatformCf = renamedBaseAppManifest["sap.platform.cf"]; if (sapPlatformCf?.oAuthScopes && sapCloudService) { sapPlatformCf.oAuthScopes = sapPlatformCf.oAuthScopes.map((scope) => scope.replace(`$XSAPPNAME.`, `$XSAPPNAME('${sapCloudService}').`)); } if (this.configuration.sapCloudService) { if (renamedBaseAppManifest["sap.cloud"] == null) { renamedBaseAppManifest["sap.cloud"] = {}; } renamedBaseAppManifest["sap.cloud"].service = this.configuration.sapCloudService; } else { delete renamedBaseAppManifest["sap.cloud"]; } } getConfigurationType() { return "cf"; } createAppVariantHierarchyItem(appVariantId, version) { return { appVariantId, version }; } } //# sourceMappingURL=cfProcessor.js.map