SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
466 stars 71 forks source link

New builder setting to fix data source URI in manifest.json #625

Open budenko opened 2 years ago

budenko commented 2 years ago

Is your feature request related to a problem? Please describe.

Data source URI in manifest.json should not start with a slash in order to UI5 application work properly in a FLP.

Describe the solution you'd like

It would be nice to have a builder task or setting that checks manifest.json and strips off leading slash from a data source URI during a building of an application to ensure that URI is correct automatically.

Describe alternatives you've considered

There is a such feature in @sap/grunt-sapui5-bestpractice-build module that is not supported any more and should be replaced with @ui5/builder.

Additional context

Example of a data source section of manifest.json

  "dataSources": {
    "Document-RestSource": {
      "uri": "fnd/document-ms/",
      "type": "JSON"
    }
  }
sebastianesch commented 1 year ago

It would be great to have this feature directly in ui5-tooling. At the moment the Fiori Application Generator uses a custom task using "webide-extension-task-updateManifestJson" to update the manifest.json when deploying to Cloud Foundry.

https://www.npmjs.com/package/@sap/ui5-builder-webide-extension is quite old and has a dependency to @ui5/fs@1.1.2 and @ui5/cli@1.14.0.

Regloom commented 6 months ago

Absolutely agree with previous post, current 'deploy-config' script generates quite an outdated and huge list of dependencies.

flovogt commented 6 months ago

As far as I remember, SAP Build Work Zone, standard edition a.k.a "Central Launchpad on CF" does not support absolute URLs at all. So the url should be relative in the source manifest.json.

I wonder why you not adjust the source manifest.json to make it relative right from the beginning?

nicoschoenteich commented 3 months ago

Hi everyone, I was looking for a solution to this problem while working on the generator-ui5-project, which also uses the open-ux-tools for project generation (just like the Fiori Tools Application Generator) and therefore contains absolute paths in the manifest. As @flovogt said, SAP Build Work Zone only supports relative paths. Is there a current best practice as far as tooling goes to change the paths upon build? If not, I would fall back to creating a simple custom script that does that in case the target platform is SAP Build Work Zone. Any other suggestions from your side? Looking forward to your input! Best, Nico

flovogt commented 3 months ago

Hi @nicoschoenteich, thanks for pointing this out. Currently, there is no URL correction available in UI5 Tooling. In the past this was fixed by https://www.npmjs.com/package/@sap/ui5-builder-webide-extension which fixed the URLs in the manifest. But nowadays (CF deployment), this custom task is no longer needed, so we also do not recommend that any longer.

So as long as we have no auto correction available, feel free to go with the custom solution :-)

nicoschoenteich commented 3 months ago

Hi @flovogt, I implemented it as part of the ui5-task-zipper (https://github.com/ui5-community/ui5-ecosystem-showcase/pull/1046), which is a good option when zipping and deploying to the HTML5 Apps Repo, to later consume in SAP Build Work Zone.