Modules for building a UI5 projects dependency tree, including configuration
Part of the UI5 Build and Development Tooling
This is an alpha release!
The UI5 Build and Development Tooling described here is not intended for productive use yet. Breaking changes are to be expected.
The purpose of the normalizer is to collect dependency information and to enrich it with project configuration (generateProjectTree).
Translators are used to collect dependency information. The Project Preprocessor enriches this dependency information with project configuration. Typically from a ui5.yaml
file. A development server and build process can use this information to locate project- and dependency resources.
To only retrieve the project dependency graph, please use (generateDependencyTree).
Translators collect recursively all dependencies on a package manager specific layer and return information about them in a well-defined tree-structure.
The following dependency tree is the expected input structure of the Project Preprocessor.
{
"id": "projectA",
"version": "1.0.0",
"path": "/absolute/path/to/projectA",
"dependencies": [
{
"id": "projectB",
"version": "1.0.0",
"path": "/path/to/projectB",
"dependencies": [
{
"id": "projectD",
"path": "/path/to/different/projectD"
}
]
},
{
"id": "projectD",
"version": "1.0.0",
"path": "/path/to/projectD"
},
{
"id": "myStaticServerTool",
"version": "1.0.0",
"path": "/path/to/some/dependency"
}
]
}
The npm translator is currently the default translator and looks for dependencies defined in the package.json
file of a certain project. dependencies
, devDepedencies
and napa dependencies (Git repositories which don't have a package.json
file) are located via the Node.js module resolution logic.
This translator is currently intended for testing purposes only.
Can be used to supply the full dependency information of a project in a single structured file.
Usage example: ui5 serve -b static:/path/to/projectDependencies.yaml
projectDependencies.yaml
contains something like:
---
id: testsuite
version: "",
path: "./"
dependencies:
- id: sap.f
version: "",
path: "../sap.f"
- id: sap.m
version: "",
path: "../sap.m"
Enhances a given dependency tree based on a projects configuration.
{
"id": "projectA",
"version": "1.0.0",
"path": "/absolute/path/to/projectA",
"specVersion": "0.1",
"type": "application",
"metadata": {
"name": "sap.projectA",
"copyright": "Some copyright ${currentYear}"
},
"resources": {
"configuration": {
"paths": {
"webapp": "app"
}
},
"pathMappings": {
"/": "app"
}
},
"dependencies": [
{
"id": "projectB",
"version": "1.0.0",
"path": "/path/to/projectB",
"specVersion": "0.1",
"type": "library",
"metadata": {
"name": "sap.ui.projectB"
},
"resources": {
"configuration": {
"paths": {
"src": "src",
"test": "test"
}
},
"pathMappings": {
"/resources/": "src",
"/test-resources/": "test"
}
},
"dependencies": [
{
"id": "projectD",
"version": "1.0.0",
"path": "/path/to/different/projectD",
"specVersion": "0.1",
"type": "library",
"metadata": {
"name": "sap.ui.projectD"
},
"resources": {
"configuration": {
"paths": {
"src": "src/main/uilib",
"test": "src/test"
}
},
"pathMappings": {
"/resources/": "src/main/uilib",
"/test-resources/": "src/test"
}
},
"dependencies": []
}
]
},
{
"id": "projectD",
"version": "1.0.0",
"path": "/path/to/projectD",
"specVersion": "0.1",
"type": "library",
"metadata": {
"name": "sap.ui.projectD"
},
"resources": {
"configuration": {
"paths": {
"src": "src/main/uilib",
"test": "src/test"
}
},
"pathMappings": {
"/resources/": "src/main/uilib",
"/test-resources/": "src/test"
}
},
"dependencies": []
}
]
}
Typically located in a per-project ui5.yaml
file.
---
specVersion: "0.1"
type: application|library|custom
metadata:
name: testsuite
copyright: |-
UI development toolkit for HTML5 (OpenUI5)
* (c) Copyright 2009-${currentYear} SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
resources:
configuration:
paths:
"<virtual path>": "<physical path>"
"<virtual path 2>": "<physical path 2>"
shims:
some-dependency-name:
type: library
metadata:
name: library-xy
resources:
configuration:
paths:
"src": "source"
server:
settings:
port: 8099
specVersion
: Version of the specificationtype
: Eitherapplication
,library
orcustom
(custom not yet implemented). Defines default path mappings and build steps. Custom doesn't define any specific defaults
Some general information
name
: Name of the application/library/resourcecopyright
(optional): String to be used for replacement of copyright placeholders in the project
configuration
paths
: Mapping between virtual and physical paths- For type
application
there can be a setting for mapping the virtual pathwebapp
to a physical path within the project - For type
library
there can be a setting for mapping the virtual pathssrc
andtest
to physical paths within the project
- For type
shims
: Can be used to define, extend or override UI5 configs of dependencies. Inner structure equals the general structure. It is a key-value map where the key equals the project ID as supplied by the translator.
settings
(not yet implemented)port
: Project default server port. Can be overwritten via CLI parameters.
Please check our Contribution Guidelines.
Please follow our Contribution Guidelines on how to report an issue.
See CHANGELOG.md.
This project is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the LICENSE file.