-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PoC] Proxy Mode #223
base: v2
Are you sure you want to change the base?
[PoC] Proxy Mode #223
Conversation
@RandomByte thanks for sharing this PoC. I have a couple of questions and remarks: Questions:
Remarks: This PR seems to be very much focused on serving UI5 resources from a different location (i.e. remote server, the |
Thanks, sure!
Basically, all resources of the application and library are served from your local disk. Everything else from a NetWeaver ABAP or -Gateway system.
They are contradicting. And I'm looking for a better solution to this for a final implementation. Setting
This parameter already exists today and is widely used among SAP owned applications: https://ui5.sap.com/#/topic/3a9babace121497abea8f0ea66e156d9 In my tests, the use of this parameter made it very simple clone a UI5 project and use it as part of a proxy setup without much changes to the projects configuration. An option to overwrite this parameter in the
Sorry that we missed to reply to that comment of yours! We simply haven't done enough research into this direction. The We would be happy for any contributions (comments and/or code) to integrate this as well. This PoC focuses a lot on the handling of "special" UI5 requests, like app-cache-buster URLs and unbundling preload- or custom bundles. I think these are elements that should come from the UI5 team. Also since they can change frequently. The actual rewrite logic can be exchanged or even better made pluggable if that helps to support more scenarios. |
047195d
to
8bc814b
Compare
As we cannot support all proxy variants for ABAP, CF, Neo CP, ... - I would not integrate a proxy solution into our tooling. We can never make everyone happy and this will just produce requirements. Being open and pluggable should be sufficient IMO. Hence, I would close the PR. |
@petermuessig thanks for sharing your view on this and I can fully understand it. While the new UI5 tooling already supports plugging in your own middlewares (and thus proxies), it still requires a lot of verbose config. I think a plug-and-play (or "install-as-dependency-and-play") mechanism would help a lot here. |
@mlenkeit - yes exactly - if a NPM package would also be able to transport the UI5 tooling configuration this would be also a nice option, something like this: specVersion: "2.0"
metadata:
name: my-custom-config
type: configuration
builder:
customTasks:
- name: ui5-task-transpile
afterTask: replaceVersion
configuration:
debug: true
removeConsoleStatements: true
excludePatterns:
- "lib/"
- "another/dir/in/webapp"
- "yet/another/dir"
server:
customMiddleware:
- name: ui5-middleware-simpleproxy
mountPath: /srv/
afterMiddleware: compression
configuration:
baseUri: https://services.odata.org/V2/Northwind/Northwind.svc/ Also the dependencies to the builders and tasks could be defined in the |
Especially libraries where not handled correctly. ABAP URI retrieval now moved to type formatters
8bc814b
to
d910f8f
Compare
Why do you think we can't? I think the majority of UI5 applications require a proxy in their development setup. It would be only reasonable to work out a good solution for those. With the current state of middleware extensibility, a solution that is as easy to use as this PoC tries to demonstrate it, is not possible. Even though this PoC is currently focused on ABAP environments, the idea of having a Anyways, I think it would be in the interest of many developers if the UI5 Tooling would be aligned with the SAP Business Application Studio in regards to proxying. In summary: Even if we don't write the proxy middleware ourselves, we need to put work into figuring out how anybody could write them. And first of all we need to get an overview of the requirements. |
This is what I agree with - but I am pretty sure - we cannot do it right for everyone and thus to save the work for us I am a bit more defensive here. Even today, with the extensibility we have ~4 variants of the proxy for different scenarios. In BAS - the AppRouter is being used - so maybe we just integrate the AppRouter which is not based on the express middleware - might be also challenging, IMO. |
} | ||
}); | ||
} else { | ||
await this.addMiddleware("connectUi5Proxy", { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now removed officially from UI5 Tooling since version 3: #550
Work in progress. Possible implementation of a somewhat NetWeaver ABAP / Gateway focused "proxy mode" as part of the standard UI5 Tooling.
Related to SAP/ui5-tooling#41
Note that many custom proxy implementations are already possible using Custom UI5 Server Middleware
Basic Working Principle
/sap/bc/ui5_ui5/sap/my_app/~D9F8F129E4F10B8324F1751A2A3C583A~5/Component.js
becomes/Component.js
/sap/bc/ui5_ui5/sap/my_lib/~D9F8F129E4F10B8324F1751A2A3C583A~5/library.js
becomes/resources/my/lib/library.js
ui5 tree
will be usedserver.cdnUrl
configuration: Try to serve normalized URI from configured CDNPossible Scenarios
Minimal Configuration
Full Configuration
How to try
In your projects package.json:
Refrain from using any lockfiles to ensure you always install the latest commits from the referenced feature branches:
Try it:
ui5 serve --proxy # --verbose for details
Notes
1.1a
"sap.platform.abap".uri
attribute in theirmanifest.json
(example value/sap/bc/ui5_ui5/sap/my_app
)"sap.platform.abap".uri
attribute. As a fallback to themanifest.json
this might be defined in.library
atlibrary.appData.manifest."sap.platform.abap".uri
(example value/sap/bc/ui5_ui5/sap/my_lib
)Related PRs