Skip to content
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

Allow loading RTA plugins for adaptation projects #1166

Closed
wants to merge 68 commits into from

Conversation

tobiasqueck
Copy link
Contributor

@tobiasqueck tobiasqueck commented Aug 10, 2023

This PR does not contain a changeset on purpose because the change does not fix a bug or adds any new functionality that is exposed to the consumer. This is a preparation work required to be able to add new features to the adp-tooling. Once this is merged, PR #1183 will follow right away including a changeset.

  • adt-tooling
    • added an addApis function allowing to define additional APIs for adaptation project e.g. to read and write fragments
    • moved content from templates to templates/project to allow adding other templates for RTA
  • preview-middleware
    • enhanced the templates to support registering a callback script
    • enhanced the initialization for adaption projects to register additional routes implemented in adt-tooling
  • preview-middleware-client

@changeset-bot
Copy link

changeset-bot bot commented Aug 10, 2023

⚠️ No Changeset found

Latest commit: 495cec8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@tobiasqueck tobiasqueck added preview-middleware @sap-ux/preview-middleware adp-tooling labels Aug 29, 2023
@tobiasqueck tobiasqueck marked this pull request as ready for review August 29, 2023 08:02
@tobiasqueck tobiasqueck requested review from a team as code owners August 29, 2023 08:02
@tobiasqueck tobiasqueck changed the title WIP: allow loading RTA plugins for adaptation projects Allow loading RTA plugins for adaptation projects Aug 29, 2023
const files = await this.project.byGlob('/**/changes/**/*.fragment.xml');
try {
const names = files.map((file) => file.getPath());
res.status(200).contentType('application/json').send(JSON.stringify(names));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on #1224 Shouldn't we use here also writeHead, write and end?

@zdravko-georgiev
Copy link
Contributor

Also I am getting the following error for adp-preview.test.ts

Cannot find module '@ui5/fs' or its corresponding type declarations.

Copy link
Member

@devinea devinea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the motivation to combine server, client and writer features in 1 module?
It does not seem an optimal separation.
Also it deviates from standard module config for build etc..

@@ -14,7 +14,9 @@
"author": "@SAP/ux-tools-team",
"main": "dist/index.js",
"scripts": {
"build": "tsc --build",
"build": "pnpm build:server && pnpm build:client",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use npm-run-all -l -p to run these in parallel.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to separate writer module?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say no as explained at #1166 (comment)

@voicis
Copy link
Contributor

voicis commented Aug 30, 2023

Is babel actually sufficient in this case? It only transpiles and usually all code that gets consumed by browser needs to be bundled for performance reasons.

@tobiasqueck
Copy link
Contributor Author

Is babel actually sufficient in this case? It only transpiles and usually all code that gets consumed by browser needs to be bundled for performance reasons.

I'd say it is sufficient because it is a development module and while there might be a measurable performance issue I doubt that it is perceivable for a human being.

@tobiasqueck
Copy link
Contributor Author

What is the motivation to combine server, client and writer features in 1 module?

Combining server and writer is actually independent of this PR and happened a while ago. The main reason is the reuse of the functionality in both cases, e.g. adding artifacts like a fragment are planned to be enabled through the middleware and the client running the browser as well as through other interfaces e.g. in guided development or the page modeler.
It is also a trend you can see in the ui5-community modules where middlewares and tasks are going into one *-tooling module since their shared functionality is significant.

Combining client and server is done because the client is only hosted by this server, i.e. running the very same client by any other server, not offering the APIs is not useful.

@tobiasqueck
Copy link
Contributor Author

Also I am getting the following error for adp-preview.test.ts

Cannot find module '@ui5/fs' or its corresponding type declarations.

that is the annoying ts server. It sometimes (sometimes not) crashes and then it cannot find the .d.ts files. I cannot explain to you why. I looked at the logs and at reported issues for it, and couldn't find anything helping. Restarting the language server helps often, restarting it a few times helps usually.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Sep 7, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

52.0% 52.0% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@tobiasqueck tobiasqueck deleted the feat/1149/enable-enhancements branch September 12, 2023 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adp-tooling preview-middleware @sap-ux/preview-middleware
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants