SAP / ui5-tooling

An open and modular toolchain to develop state of the art applications based on the UI5 framework
https://sap.github.io/ui5-tooling
Apache License 2.0
465 stars 70 forks source link

Error handling: Resource Component-preload.js has no content #408

Closed TheGreenToaster closed 3 years ago

TheGreenToaster commented 6 years ago

Expected Behavior

After running ui5 init the project should be able to build the project

Current Behavior

After running ui5 init the build fails because there is no metadata.namespace property in the ui5.yaml file.

Steps to reproduce the issue

  1. clone an existing project
  2. run ui5 init
  3. run ui5 build
  4. get error Error: Resource Component-preload.js has no content

Context

Affected components

Resolution

Perhaps the namespace could be read from the sap.app.id in the manifest.json file if it exists. If it does not exist then output warning the user or even a prompt for input might be acceptable? Also in the build perhaps a check could be performed if the namespace field exists and throws a meaningful error in its absence.

TheGreenToaster commented 6 years ago

Also entered SAP/ui5-cli#3

RandomByte commented 6 years ago

+1. We already have a verbose log "No manifest found for project ${project.metadata.name}. This might be an error in the future!". We definitely require a namespace for all applications, plus we'd like to enforce the presence of a manifest.json file for new apps.

So, to be compatible with existing apps, we could do the following:

  1. Try to read namespace from manifest.json
  2. Try to read namespace from ui5.yaml (metadata.namespace)

=> If unable to determine namespace, throw error => If a namespace is present in both sources, throw error

manifest.json should always be the preferred source, so the ui5.yaml option should go undocumented until more people complain that they don't want to add a manifest.json to their app.

Thanks for reporting!

RandomByte commented 3 years ago

In version 2.x of the UI5 Tooling we added additional checks and always require a project namespace now. Therefore closing this issue.