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

Project generated with sapui5 gets @openui5/types devDependency (+ bonus type questions 🐱 ) #33

Closed
heimwege opened this issue May 7, 2024 · 8 comments

Comments

@heimwege
Copy link

heimwege commented May 7, 2024

Hey hey 👋🏻

I just generated a ts app for sapui5 1.120.11 and noticed that I got two types devDependencies

"@openui5/types": "^1.123.0",
"@sapui5/types": "1.120.11",

I would have expected only the @sapui5/types one. Is this intended or is this a bug?

Speaking about types I'm also missing the respective qunit types that come with sap/ui/thirdparty/qunit-2 ("@types/qunit": "2.5.4" afaik). In case you want to use Hooks in the qunit module definition you should be type supported by the version that comes with ui5 instead of the latest version to avoid conflicts during runtime.

Same is valid for sap/ui/thirdparty/sinon ("@types/sinon": "10.0.16" afaik) in case you want to e.g. stub something in your unit tests like
const messageBoxStub = sinon.stub(MessageBox, "success") as SinonStub<[text: string], MessageBox>; you should get the type support for the respective sinon version that comes with sapui5

@akudev
Copy link
Collaborator

akudev commented May 7, 2024

Hi,
ok, that's a whole list of things...

  • "@openui5/types": "^1.123.0", looks like a bug at first glance (the version and it being present)
  • "@types/qunit": "2.5.4" is a dependency inside the UI5 types (only for the @types/openui5 we don't have control over the referenced type version). The same for jQuery.
  • Regarding Sinon: we only include the types as dependencies in our types which are used in the UI5 APIs. As sinon is not, it's the app developer's responsibility to add the types if needed. And yes, the closest version should be used, which means the app developer has to find out which Sinon version is included. But actually the app developer also has to find out the version in order to use Sinon properly, so it's not that much of a difference.

@akudev
Copy link
Collaborator

akudev commented May 7, 2024

Actually, looking at the template, it is hard to imagine how TWO UI5 types could end up in the dev dependencies: https://github.com/ui5-community/generator-ui5-ts-app/blob/main/generators/app/templates/package.json#L23

And actually, when trying it locally and watching package.json closely, then first only the correct types are there. Then, something else runs and does stuff in "./webapp/test/e2e/". Then the openui5 one appears. So I'd say this probably comes from calling the wdi5 sub-generator to add testing stuff (see dd10070). @petermuessig ?

@heimwege
Copy link
Author

heimwege commented May 7, 2024

That's a good hint @akudev I had a look at the generator and it basically just does npm init wdi5 -- --ts. So I tested it and there it is "@openui5/types": "^1.123.0". Should I close this issue here and open it directly in the wdi5 repo?

@akudev
Copy link
Collaborator

akudev commented May 7, 2024

Probably... just want to avoid a ping-pong between the two repos.

@heimwege
Copy link
Author

heimwege commented May 7, 2024

Done. Let's close this one and hope for the best 🤞🏻

@heimwege heimwege closed this as completed May 7, 2024
@petermuessig
Copy link
Member

Oh yes, good catch and sorry for being late to the party. This must be fixed in the wdi5 generator. There the types must be detected and ignored if present already.

THX, Peter

@petermuessig
Copy link
Member

Cc: @vobu

@vobu
Copy link
Contributor

vobu commented May 8, 2024

ACK. Further tracking in ui5-community/create-wdi5#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants