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

ui5 init generates ui5.yaml with a wrong type: type: library instead of type: application #551

Open
pubmikeb opened this issue Aug 30, 2021 · 4 comments
Labels
enhancement New feature or request module/ui5-cli Related to the UI5 CLI module

Comments

@pubmikeb
Copy link

When I run ui5 init, it generates ui5.yaml with a wrong type: type: library instead of type: application, although in package.json it's written "type": "module".

Expected Behavior

ui5.yaml should contain type: application

Current Behavior

ui5.yaml contains type: library

Steps to Reproduce the Issue

  1. Install ui5-tooling globally
  2. Go in console to the root of the app, where package.json is located
  3. Run ui5 init
  4. I got type: library

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): 2.12.1
  • Node.js Version: v17.0.0-v8-canary202108258414d1aed8
  • npm Version: 7.21.1
  • OS/Platform: Windows 10 21H1 x64
  • Browser (if relevant): not relevant
  • Other information regarding your environment (optional): nothing
{...}
@pubmikeb pubmikeb added bug Something isn't working needs triage Needs to be investigated and confirmed as a valid issue that is not a duplicate labels Aug 30, 2021
@matz3
Copy link
Member

matz3 commented Aug 31, 2021

The "type" property within package.json is not related to the UI5 Tooling project types.
In the package.json, it can be script or module, which refers to the type of JavaScript source files, where UI5 Tooling currently only supports script (at least out-of-the-box).

ui5 init tries to detect an existing project where a webapp folder is a hint for an application and src / test folders are associated with type library. This might not be correct in all cases and is just a basic assumption based on our default folders for those projects.

@pubmikeb
Copy link
Author

pubmikeb commented Aug 31, 2021

I assumed type: library is derived either from package.json "type": "module" or from manifest.json "type": "application" inside of the sap.app block. In my case, the UI5 source code is located in src/webapp, so don't know why UI5 Tooling decides type: library and not type: application. In manifest.json it is stated clear: "type": "application".

@matz3
Copy link
Member

matz3 commented Aug 31, 2021

As mentioned above, the type detection is only based on some basic assumptions and currently doesn't do any further analysis of the project files.
See https://github.com/SAP/ui5-cli/blob/c33794909152162ed5a0471c3989ad220b2b0f24/lib/init/init.js#L28-L55

This could be improved to cover more cases like the one described by you (e.g. searching for a manifest.json file, detect the type, and configure the folders (e.g. src/webapp instead of the default webapp).

@matz3 matz3 added module/ui5-cli Related to the UI5 CLI module and removed needs triage Needs to be investigated and confirmed as a valid issue that is not a duplicate labels Aug 31, 2021
@pubmikeb
Copy link
Author

e.g. searching for a manifest.json file, detect the type, and configure the folders (e.g. src/webapp instead of the default webapp

IMO, a developer must provide a correct path to the manifest.json of the UI5 app (no need to guess it, just like npm does with package.json), then UI5 Tooling should derive an app type, based on the type value inside of the sap.app block.

@RandomByte RandomByte added enhancement New feature or request and removed bug Something isn't working labels Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module/ui5-cli Related to the UI5 CLI module
Projects
None yet
Development

No branches or pull requests

3 participants