ui5-community / generator-ui5-ts-app

Generator for UI5 applications using TypeScript which use the official UI5 tooling. This generator was built as a plug-in for the community project Easy UI5 by SAP.
Apache License 2.0
20 stars 15 forks source link

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

Closed heimwege closed 4 months ago

heimwege commented 4 months ago

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 commented 4 months ago

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

akudev commented 4 months ago

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 https://github.com/ui5-community/generator-ui5-ts-app/commit/dd10070f7b0013bc1316eded13453b50ee3f1193). @petermuessig ?

heimwege commented 4 months ago

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 commented 4 months ago

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

heimwege commented 4 months ago

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

petermuessig commented 4 months ago

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 commented 4 months ago

Cc: @vobu

vobu commented 4 months ago

ACK. Further tracking in https://github.com/ui5-community/create-wdi5/issues/11