项目作者: ui5-community

项目描述 :
yeoman-based (sub-)generator for a UI5 custom control, prepped for npm distribution as ui5-cc-*
高级语言: JavaScript
项目地址: git://github.com/ui5-community/generator-ui5-control.git
创建时间: 2021-02-06T08:04:48Z
项目社区:https://github.com/ui5-community/generator-ui5-control

开源协议:Other

下载


generator for a UI5 custom control

Scaffold a UI5 custom control that is structured in such a way that it can also distributed as a node module via npm.
Mainly intended for re-use via easy-ui5, but also suitable to run standalone.

use w/ easy-ui5

do yo easy-ui5 and select this generator when prompted

use w/ yeoman locally/standalone

generating a ui5 custom control

  1. $> npm i -g yo
  2. $> yo ./path-to-this-repo/app
  3. _-----_ ╭──────────────────────────╮
  4. | | Welcome to the amazing
  5. |--(o)--| UI5 custom control
  6. `---------´ │ generator! │
  7. ( _´U`_ ) ╰──────────────────────────╯
  8. /___A___\ /
  9. | ~ |
  10. __'.___.'__
  11. ´ ` |° ´ Y `
  12. ? What's the name space your custom control(s) should live in? (my.ui5.cc)

use w/ options supplied

  1. $> yo ./path-to-this-repo/app --controlNamespace=bla.fasel --buildDir=../some/dir
  2. # will make the control live in namespace 'bla.fasel"
  3. # and put the built control in directory `cwd` + '../some/dir'

aftermath

the generator also provides a full dev- and test-environment for your new and shiny custom control 😱 !

  1. $> cd path/to/generator/result
  2. $> npm run test:manual
  3. # ...
  4. info normalizer:translators:ui5Framework Using OpenUI5 version: 1.86.3
  5. info server:custommiddleware:livereload Livereload server started!
  6. Server started
  7. URL: http://localhost:8081

As obvious from the above, the manual test command boots up a barebones UI5 app using your new custom control, inclusing live reload capabilites. So once you edit the control, the app auto-reloads and changes are visible immediately.

  1. $> npm run test
  2. # ...
  3. PASS test/ui5-app/basic.test.js
  4. my.ui5.cc.Control
  5. should find the my.ui5.cc.Control in index.html (36 ms)
  6. Test Suites: 1 passed, 1 total
  7. Tests: 1 passed, 1 total
  8. Snapshots: 0 total
  9. Time: 1.103 s
  10. Ran all test suites.

test for the generator

all tests are located in __tests__.
jest is used as test framework and runner.

contributing

  • as of now: stick to yo v3 (not 5) and yeoman-generator v4.x (not 5) due to incompatability issues
  • use the prettier config in .prettierrc in this repo
  • please supply an additional test per new feature and/or fixed bug