Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new custom elements schema parser #113

Merged
merged 8 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,5 @@ Thumbs.db
!.yarn/releases
!.yarn/sdks
!.yarn/versions

.nx/cache
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@

/dist
/coverage

/.nx/cache
6 changes: 3 additions & 3 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The project is divided into 2 main parts:
- Publishable library - `ui5-angular`, aka `@ui5/webcomponents-ngx`
- Libraries for creating the publishable library.
- `wrapper` - Contains core logic for wrapping the web components.
- `api-json-parser` - Contains logic for parsing the web components API JSONs into `ComponentData` structure
- `ui5-schema-parser` - Contains logic for parsing the web components API JSONs into `ComponentData` structure
- `angular-generator` - Contains logic for generating the Angular components and directives from `ComponentData` interface.
- `fs-commit` - Contains logic for committing the generated files to the filesystem(or any other persistence layer).

Expand All @@ -20,7 +20,7 @@ but they can be omitted and the wrappers can be generated without using them.

## General overview of functionality

### Wrapper - @ui5/webcomponents-wrapper
### Wrapper - @ui5/webcomponents-transformer
Wrapper is a library that contains core logic for wrapping the web components. It is a simple generic function
which holds the logic and order of executing the methods for wrapping the web components.
Steps are:
Expand All @@ -46,7 +46,7 @@ the default behavior.
As every step is just pure function, you can easily write your own implementation of any step on top of the existing
one and use it in your wrapper configuration.

### API JSON parser - @ui5/webcomponents-api-json-parser
### API JSON parser - @ui5/webcomponents-schema-parser

API JSON parser is a library that contains logic for parsing the web components API JSONs into `ComponentData` structure.
It expects that it will receive the paths to the API JSONs, which should be in the format of the `@ui5/webcomponents` export.
Expand Down
23 changes: 12 additions & 11 deletions apps/documentation/api-json.config.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import {ComponentData, GeneratedFile, WrapperConfig} from "@ui5/webcomponents-wrapper";
import apiJsonParser from '@ui5/webcomponents-api-json-parser';
import {ComponentData, GeneratedFile, TransformerConfig} from "@ui5/webcomponents-transformer";
import { customElementSchemaParser } from '@ui5/webcomponents-schema-parser';
import {stringify} from 'flatted';

export default {
getComponents: () => apiJsonParser({
apiJsonPaths: [
'@ui5/webcomponents-base/dist/api.json',
'@ui5/webcomponents-fiori/dist/api.json',
'@ui5/webcomponents/dist/api.json',
gatherer: () => customElementSchemaParser({
sources: [
'@ui5/webcomponents-base/dist/custom-elements-internal.json',
'@ui5/webcomponents-fiori/dist/custom-elements-internal.json',
'@ui5/webcomponents/dist/custom-elements-internal.json'
]
}),
generator: (c: ComponentData[]) => ({
'api.json': {
transformers: [
(c: ComponentData[]) => ([{
path: 'api-json.json',
getCode: () => stringify(c)
} as GeneratedFile
})
} as Partial<WrapperConfig<ComponentData>>;
])
]
} as Partial<TransformerConfig<ComponentData>>;
10 changes: 2 additions & 8 deletions apps/documentation/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,8 @@
"prefix": "ui-angular",
"targets": {
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/documentation/**/*.ts",
"apps/documentation/**/*.html"
]
}
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"]
},
"sync": {
"executor": "@ui5/webcomponents-nx:sync",
Expand Down
Loading
Loading