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 71 forks source link

Builder generates invalid XML #389

Closed IObert closed 3 years ago

IObert commented 3 years ago

Expected Behavior

That the builder will generate a valid XML view.

Current Behavior

It generates an invalid one (missing "f" namespace):

<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" controllerName="sap.ui.demo.todo.controller.App" displayBlock="true"><App><Page><customHeader><f:ShellBar title="{i18n>TITLE}" homeIcon="./img/logo_ui5.png"/></customHeader><content><HBox class="create-todo-wrapper"><Input class="todoInput" id="addTodoItemInput" value="{/newTodo/text}" placeholder="{i18n>INPUT_PLACEHOLDER}" submit=".addTodo"/><DatePicker id="datepicker" valueFormat="dd/MM/yyyy" displayFormat="dd/MM/yyyy" value="{/newTodo/deadline}"/><Button type="Emphasized" text="{i18n>BUTTON}" press=".addTodo"/></HBox><List id="todoList" backgroundDesign="Transparent" mode="MultiSelect" showNoData="false" items="{ path:'/todos' }"><CustomListItem visible="{= !${done} }" selected="{done}"><HBox><VBox justifyContent="Center"><Text text="{text} - finish before: {deadline}"/></VBox><Button class="editButton" text="{i18n>EDIT}" press=".onEditTodo"/><Button type="Reject" text="{i18n>DELETE}" press=".onDeleteTodo"/></HBox></CustomListItem></List><Panel expandable="true" expanded="true" width="auto"><headerToolbar><OverflowToolbar style="Clear"><Title text="{i18n>COMPLETED}"/></OverflowToolbar></headerToolbar><content><List id="doneList" mode="MultiSelect" backgroundDesign="Transparent" items="{/todos}"><CustomListItem visible="{done}" selected="{done}"><HBox><VBox justifyContent="Center"><Text text="{text} - finish before: {deadline}"/></VBox><Button class="editButton" text="{i18n>EDIT}" press=".onEditTodo"/><Button type="Reject" text="{i18n>DELETE}" press=".onDeleteTodo"/></HBox></CustomListItem></List></content></Panel></content><dependents><Dialog id="editDialog" title="{i18n>EDIT_TODO}" contentWidth="400px"><content><VBox><Label text="{i18n>TODO_TITLE}" labelFor="input-title"/><TextArea width="100%" id="input-title" value="{/edit/text}"/><Label text="{i18n>TODO_DATE}" labelFor="input-date"/><DatePicker id="input-date" valueFormat="dd/MM/yyyy" displayFormat="dd/MM/yyyy" value="{/edit/deadline}"/></VBox></content><buttons><Button text="{i18n>CANCEL}" press=".onClose"/><Button type="Emphasized" text="{i18n>SAVE}" press=".onSave"/></buttons></Dialog></dependents></Page></App></mvc:View>

Steps to reproduce the issue

  1. Clone sample repo git clone https://<SAP Cloud GitHub/Marius' User>/ui-tech-samples.git
  2. cd sapui5-sample-app
  3. Remove the yarn.lock file (the current lock file won't break the build - I'm not sure why)
  4. Run the following commands to build and host the dist folder
    yarn install && yarn build && npx http-server dist

Context

Affected components (if known)

Log Output / Stack Trace

NA

RandomByte commented 3 years ago

Thanks for reporting! This might be caused by https://github.com/SAP/ui5-builder/pull/488

I can reproduce the issue with UI5 CLI 2.6.0 but not with 2.5.0. I also can not reproduce it with 2.4.4, opposing to your report.

We'll look into it.

IObert commented 3 years ago

I think you're right. I have 2.6.0 installed globally. It probably used 2.6.0 for all builds and ignored the version that has been specified in the package.json bc of the caret. That would make sense

codeworrior commented 3 years ago

Seems to be a bug in one of the regular expressions in minify-xml. See https://github.com/kristian/minify-xml/issues/4 .

kristian commented 3 years ago

Seems to be a bug in one of the regular expressions in minify-xml. See kristian/minify-xml#4 .

Fixed with 2.1.3 sorry for any inconvenience caused!

RandomByte commented 3 years ago

I can confirm minify-xml v2.1.3 fixes the reported issue. It's part of @ui5/cli v2.6.1

IObert commented 3 years ago

Awesome, thanks!