Skip to content

Commit 28b14d9

Browse files
MarcusNotheisLukas742
andauthoredAug 19, 2024
feat: expose CLI package for creating web component wrappers (#6212)
This PR adds the documentation for the `@ui5/webcomponents-react-cli` package and describes how to create web components wrappers on the fly. Closes #5046 --------- Co-authored-by: Lukas Harbarth <[email protected]>
1 parent 7981491 commit 28b14d9

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { Footer, TableOfContent } from '@sb/components';
2+
import { Meta } from '@storybook/blocks';
3+
import { Link, MessageStrip } from '@ui5/webcomponents-react';
4+
5+
<Meta title="Bring Your Own Web Components" />
6+
7+
# Bring Your Own Web Components
8+
9+
<TableOfContent />
10+
11+
If you have created a custom UI5 Web Components package, you will be able to create React component wrappers in your project by leveraging our [@ui5/webcomponents-react-cli](http://npmjs.com/package/@ui5/webcomponents-react-cli).
12+
13+
<MessageStrip
14+
hideCloseButton
15+
design="Critical"
16+
children={
17+
<>
18+
The UI5 Web Components for React CLI package is tailor-made for custom UI5 Web Components packages following{' '}
19+
<Link href="https://sap.github.io/ui5-webcomponents/docs/development/">this documentation</Link>. <br />
20+
You can not use it for creating React wrapper for arbitrary custom element libraries.
21+
</>
22+
}
23+
/>
24+
25+
<br />
26+
<br />
27+
28+
## Create React Wrappers
29+
30+
> This guide uses the name `my-custom-webcomponents-package` for the custom UI5 Web Components package. <br />
31+
> Please replace all occurrences with your real package name when following this guide.
32+
33+
First of all, install the `@ui5/webcomponents-react-cli` package in your project:
34+
35+
```shell
36+
npm install @ui5/webcomponents-react-cli --save-dev
37+
38+
# if your package is based on UI5 Web Components V1, please install the V1 version of the CLI
39+
npm install @ui5/webcomponents-react-cli@V1 --save-dev
40+
```
41+
42+
Then, install your custom UI5 Web Components package:
43+
44+
```shell
45+
npm install my-custom-webcomponents-package --save
46+
```
47+
48+
Now, you can add a npm script to create your wrapper components.<br />
49+
_We recommend ensuring that the target directory (specified by the `--out` parameter) is empty._
50+
51+
<MessageStrip
52+
hideCloseButton
53+
children={
54+
<>
55+
The UI5 Web Component for React CLI is not aware of any code style conventions you may be using in your project, so we recommend that you run tools such as <Link href="https://prettier.io/">prettier</Link> and{' '}
56+
<Link href="https://eslint.org/">eslint</Link> after creating the wrapper components if you are using them in your project.
57+
</>
58+
}
59+
/>
60+
61+
```json
62+
{
63+
"//": "rest of your applications package.json",
64+
"scripts": {
65+
"//": "your other scripts",
66+
"create-webcomponent-wrappers": "ui5-wcr create-wrappers --packageName my-custom-webcomponents-package --out ./any/directory/in/your/project"
67+
}
68+
}
69+
```
70+
71+
<Footer />

0 commit comments

Comments
 (0)