ui5-community / ui5-ecosystem-showcase

A repository showcasing the UI5 tooling extensibility to combine OSS tools for UI5 application development.
https://ui5-community.github.io/ui5-ecosystem-showcase/
Other
191 stars 92 forks source link

[ui5-task-zipper] Enhance includeDependencies flag to specify dependencies to include #550

Closed HappyHepo closed 1 year ago

HappyHepo commented 2 years ago

Is your feature request related to a problem? Please describe. When I deploy a UI5 application to SAP BTP, I only need to include custom dependencies, but not the UI5 libraries.

Describe the solution you'd like I would like to specify the dependency to include similar to how the builder specifies additional dependencies (possibly as another flag/flag value to only include the dependencies specified in the ui5.yaml under builder > settings > includeDependency)

Describe alternatives you've considered Currently I use a custom npm script to zip the content of the dist folder, but I would like to configure the complete build in the ui5.yaml

petermuessig commented 1 year ago

Feature is available with ui5-task-zipper version 0.8.0

HappyHepo commented 1 year ago

I have just tested it with "ui5-task-zipper": "^0.8.0" and "@ui5/cli": "^2.14.9". Currently, the behaviour does not match the expected behaviour.

When specifying true, all dependencies (UI5 and custom library) are included in the zip. (As expected) When specifying a UI5 library, the library is included. (As expected) When specifying only the custom library as documented, no resources folder is included in the zip. (Not expected) When specifying the custom library and a UI5 library, only the UI5 library is included. (Not expected)

Application

specVersion: "2.6"
type: application
metadata:
  name: my.app
framework:
  name: OpenUI5
  version: 1.108.7
  libraries:
    - name: sap.m
    - name: sap.ui.core
    - name: sap.ui.layout
    - name: themelib_sap_fiori_3
      development: true
builder:
  settings:
    includeDependency:
      - my.lib
  resources:
    excludes:
      - /test/**
      - /localService/**
      - "**/.git"
      - "**/*.d.ts"
  customTasks:
    - name: ui5-task-zipper
      afterTask: generateCachebusterInfo
      configuration:
        additionalFiles:
          - xs-app.json
        includeDependencies:
          - sap.m
          - my.lib

Library

specVersion: '2.2'
metadata:
  name: my.lib
type: library
framework:
  name: OpenUI5
  version: "1.98.0"
  libraries:
    - name: sap.ui.core
    - name: sap.ui.unified
    - name: sap.m
resources:
  configuration:
    paths:
      src: src-gen
builder:
  resources:
    excludes:
      - "**/*.d.ts"
petermuessig commented 1 year ago

Is the 'src-gen' folder present in the library?

petermuessig commented 1 year ago

In V2 tooling, the libraries are identified by the ui5.yaml with the metadata > name property: https://github.com/ui5-community/ui5-ecosystem-showcase/blob/main/packages/ui5-task-zipper/lib/zipper.js#L41

This check is to naiive so far and I need to make this more bullet proof. Unfortunately, for V2 we will get no feature, so I need to live with a hack here. I will provide a fix soon.

petermuessig commented 1 year ago

New version 0.8.1 is about to be released and should include the fix.

HappyHepo commented 1 year ago

This works now with my setup