cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 : Project Shims & Deployment

Aurelien
Participant

Hello,

I'm using the Shims to include 3rd party libraries as describe here Project Shims – Using NPM modules with UI5 | SAP Blogs . When doing my build & testing locally it's working fine (shims specified in ui5.yaml is correctly executed) ! However when deploying, i got the following error during deployment phase

Source contains multiple documents; please use YAML.parseAllDocuments() 

Could you give a hand ? See my ui5-deploy.yaml files and npm script link to it.

Thanks

Aurélien

"deploy": "ui5 build -a preload --clean-dest --config ui5-deploy.yaml --include-task=generateManifestBundle generateCachebusterInfo",

Accepted Solutions (0)

Answers (2)

Answers (2)

_jonas_
Participant
0 Kudos

I faced the same problem. As a workaround until this get fixed you can modify the function getUI5Theme (line 72344 in version 1.2.0) in the file node_modules/@sap/ux-ui5-tooling/dist/tasks/deploy/index.js to the following:

async function getUI5Theme(root) {
    const yamlFile = path_1.default.join(root, 'ui5-deploy.yaml');
    if (await fileExists(yamlFile)) {
        const yamlDocs = yaml_1.default.parseAllDocuments(await readLocalFile(yamlFile));
        const doc = yamlDocs.find((doc) => {
            const yamlContent = doc.toJSON();
            return yamlContent.ui5Theme;
        });
        return doc ? doc.toJSON().ui5Theme : undefined;
    }
}

This at least works for me. Keep in mind that any update to @sap/ux-ui5-tooling will revert your changes.

TheVivekGowda
Explorer
0 Kudos

Is it possible for you to show how you are making use of XLSX in project?

Also below is my sample code which is working. Your code looks vary familiar to this.

---
specVersion: '2.1'
kind: extension
type: project-shim
metadata:
  name: external # this can be your project shim name
shims:
  configurations:
    xlsx: # name as defined in package.json
      specVersion: '2.1'
      type: module # Use module type
      metadata:
        name: xlsx
      resources:
        configuration:
          paths:
            /resources/external/xlsx/: 'dist'

Aurelien
Participant
0 Kudos

Sure, here it is

sap.ui.define(
    [
        './BaseController',
        '../model/formatter',
        '../util/ErrorHandler',
        'sap/ui/core/message/Message',
        'sap/ui/core/MessageType',
        'sap/m/MessageBox',
        '../lib/thirdparty/xlsxdist/xlsx.full.min',
        '../lib/thirdparty/xlsxdist/jszip',
    ],
    function (BaseController, formatter, ErrorHandler, Message, MessageType, MessageBox) {
    ...



TheVivekGowda
Explorer
0 Kudos

Should it not be '../lib/thirdparty/xlsx/dist/xlsx.full.min' instead of '../lib/thirdparty/xlsxdist/xlsx.full.min'?

Aurelien
Participant
0 Kudos

Well.. not really. Actually the code works perfectly, i can use the library in my code without issues. The problem is when i want to deploy to the abap server, it's rebuilding the project correct but then when executing task "deploy-to-abap" it gives that error message and stop the process...

Source contains multiple documents; please use YAML.parseAllDocuments()