SAP / open-ux-tools

Enable community collaboration to jointly promote and facilitate best in class tooling capabilities
Apache License 2.0
83 stars 41 forks source link

FEATURE - Reuse library writer #1006

Open cianmSAP opened 1 year ago

cianmSAP commented 1 year ago

As an SAPUI5 developer, I want to be able create a new reuse library, so that I can share as a reusable component with other applications.

Description

This new writer should allow users to create reuse libraries that can then be used with existing applications.

Technical Design

Creates a new writer @sap-ux/reuse-lib-writer. Based on the exisiting yeoman generator generator-ui5-library.

A single function is exposede (generate) which takes input :

    libraryName: string;
    namespace: string;
    framework: 'SAPUI5' | 'OpenUI5';
    frameworkVersion: 'string';
    author: 'string';
    typescript: boolean;

Current (proposed) lib contents and structure. (only the yo-rc.json is removed currently in comparison with an app generated with generator-ui5-library)

.
├── src
│   └── test
│       └── com
│           └── myUI5Lib
│               ├── Example.js
│               ├── ExampleRenderer.js
│               ├── library.js
│               ├── messagebundle.properties
│               └── themes
│                   ├── base
│                   │   ├── Example.less
│                   │   └── library.source.less
│                   ├── sap_belize
│                   │   └── library.source.less
│                   ├── sap_belize_hcb
│                   │   └── library.source.less
│                   ├── sap_belize_hcw
│                   │   └── library.source.less
│                   ├── sap_belize_plus
│                   │   └── library.source.less
│                   ├── sap_fiori_3
│                   │   └── library.source.less
│                   ├── sap_fiori_3_dark
│                   │   └── library.source.less
│                   ├── sap_fiori_3_hcb
│                   │   └── library.source.less
│                   └── sap_fiori_3_hcw
│                       └── library.source.less
├── test
│   └── test
│       └── com
│           └── myUI5Lib
│               ├── Example.html
│               ├── Example.js
│               └── qunit
│                   ├── Example.qunit.js
│                   ├── testsuite.qunit.html
│                   └── testsuite.qunit.js
├── karma.conf.js
├── package.json
├── readme.md
└── ui5.yaml

Acceptance Criteria

Given I have a Reuse lib configuration when I pass this config to the Reuse lib writer then a Reuse lib is generated

Given I create a new Reuse library when I reference it in a Fiori application then the application will load the Reuse lib

Given I generate a Reuse library, I can add reference to it in a Fiori application using the Reuse lib reference generator.

Notes

JS Reuse lib to be based on generator-ui5-library. and the TS version to be based on generator-ui5-ts-library

Tasks

Additional Tasks

FYI @tobiasqueck @devinea @docirl

cianmSAP commented 1 year ago

Examples :

Generated UI5 lib using https://github.com/ui5-community/generator-ui5-library yo.gen.myUI5Lib.zip

TS lib yo.gen.myUI5TsLib.zip

devinea commented 1 year ago

@cianmSAP I think this still needs to be addressed ? https://github.com/SAP/open-ux-tools/pull/1008#discussion_r1226632295

cianmSAP commented 1 year ago

@cianmSAP I think this still needs to be addressed ? #1008 (comment)

I'll look into this, thanks @devinea

tobiasqueck commented 1 year ago

@cianmSAP @devinea what is the current state of this one?

cianmSAP commented 1 year ago

@cianmSAP @devinea what is the current state of this one?

While this fix went in https://github.com/SAP/open-ux-tools/pull/1054

It does not seem to be consumed by ui5-tooling? I still see this error

Error Message: Error reading manifest.json from 'com.myorg.library1/webapp/manifest.json'. Error was : 'ENOENT: no such file or directory, open 'com.myorg.library1/webapp/manifest.json''.

@tobiasqueck

tobiasqueck commented 1 year ago

@cianmSAP I noticed the same issue in a different test. @zdravko-georgiev do you know why it isn't consumed yet?

zdravko-georgiev commented 1 year ago

@tobiasqueck Fixes for ui5-tooling are prepared and in code review. Hopefully the fixes will be submitted soon.

zdravko-georgiev commented 1 year ago

Fixes submitted in @sap/ux-ui5-tooling. Should be in with the next release.