@ui5/webcomponents-tools 2.6.2 → 2.7.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/assets-meta.js +0 -4
- package/components-package/eslint.js +2 -0
- package/lib/create-new-component/{tsFileContentTemplate.js → Component.js} +11 -8
- package/lib/create-new-component/ComponentTemplate.js +12 -0
- package/lib/create-new-component/index.js +7 -6
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
# [2.7.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.6.2...v2.7.0-rc.0) (2025-01-16)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
6
14
|
## [2.6.2](https://github.com/SAP/ui5-webcomponents/compare/v2.6.2-rc.0...v2.6.2) (2025-01-09)
|
7
15
|
|
8
16
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
package/assets-meta.js
CHANGED
@@ -42,8 +42,10 @@ const getTsModeOverrides = () => {
|
|
42
42
|
|
43
43
|
const tsxConfiguration = JSON.parse(JSON.stringify(tsConfiguration));
|
44
44
|
tsxConfiguration.files = ["*.tsx"];
|
45
|
+
tsxConfiguration.plugins.push("jsx-no-leaked-values");
|
45
46
|
tsxConfiguration.rules = {
|
46
47
|
...tsxConfiguration.rules,
|
48
|
+
"jsx-no-leaked-values/jsx-no-leaked-values": "error",
|
47
49
|
"@typescript-eslint/unbound-method": "off", // to be able to attach on* listeners
|
48
50
|
"@typescript-eslint/no-misused-promises": "off", // to be able to have async event listeners
|
49
51
|
"operator-linebreak": "off",
|
@@ -1,12 +1,12 @@
|
|
1
|
-
const
|
1
|
+
const Component = (componentName, tagName, library, packageName) => {
|
2
2
|
return `import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
3
3
|
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
4
4
|
import property from "@ui5/webcomponents-base/dist/decorators/property.js";
|
5
5
|
import slot from "@ui5/webcomponents-base/dist/decorators/slot.js";
|
6
|
-
import event from "@ui5/webcomponents-base/dist/decorators/event.js";
|
7
|
-
import
|
6
|
+
import event from "@ui5/webcomponents-base/dist/decorators/event-strict.js";
|
7
|
+
import jsxRenderer from "@ui5/webcomponents-base/dist/renderer/JsxRenderer.js";
|
8
8
|
|
9
|
-
import ${componentName}Template from "
|
9
|
+
import ${componentName}Template from "./${componentName}Template.js";
|
10
10
|
|
11
11
|
// Styles
|
12
12
|
import ${componentName}Css from "./generated/themes/${componentName}.css.js";
|
@@ -30,10 +30,9 @@ import ${componentName}Css from "./generated/themes/${componentName}.css.js";
|
|
30
30
|
*/
|
31
31
|
@customElement({
|
32
32
|
tag: "${tagName}",
|
33
|
-
renderer:
|
33
|
+
renderer: jsxRenderer,
|
34
34
|
styles: ${componentName}Css,
|
35
35
|
template: ${componentName}Template,
|
36
|
-
dependencies: [],
|
37
36
|
})
|
38
37
|
|
39
38
|
/**
|
@@ -42,8 +41,12 @@ import ${componentName}Css from "./generated/themes/${componentName}.css.js";
|
|
42
41
|
*
|
43
42
|
* @public
|
44
43
|
*/
|
45
|
-
@event("interact"
|
44
|
+
@event("interact")
|
46
45
|
class ${componentName} extends UI5Element {
|
46
|
+
eventDetails!: {
|
47
|
+
"interact": void,
|
48
|
+
};
|
49
|
+
|
47
50
|
/**
|
48
51
|
* Defines the value of the component.
|
49
52
|
*
|
@@ -68,4 +71,4 @@ export default ${componentName};
|
|
68
71
|
`;
|
69
72
|
};
|
70
73
|
|
71
|
-
module.exports =
|
74
|
+
module.exports = Component;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
const ComponentTemplate = (componentName) => {
|
2
|
+
return `import type ${componentName} from "./${componentName}.js";
|
3
|
+
|
4
|
+
export default function ${componentName}Template(this: ${componentName}) {
|
5
|
+
return (
|
6
|
+
<div>Hello World!</div>
|
7
|
+
);
|
8
|
+
}
|
9
|
+
`;
|
10
|
+
};
|
11
|
+
|
12
|
+
module.exports = ComponentTemplate;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
const fs = require("fs");
|
2
2
|
const prompts = require("prompts");
|
3
|
-
const
|
3
|
+
const Component = require("./Component.js");
|
4
|
+
const ComponentTemplate= require("./ComponentTemplate.js");
|
4
5
|
|
5
6
|
/**
|
6
7
|
* Hyphanates the given PascalCase string, f.e.:
|
@@ -61,12 +62,12 @@ const generateFiles = (componentName, tagName, library, packageName) => {
|
|
61
62
|
const filePaths = {
|
62
63
|
"main": `./src/${componentName}.ts`,
|
63
64
|
"css": `./src/themes/${componentName}.css`,
|
64
|
-
"template": `./src/${componentName}.
|
65
|
+
"template": `./src/${componentName}Template.tsx`,
|
65
66
|
};
|
66
67
|
|
67
|
-
fs.writeFileSync(filePaths.main,
|
68
|
+
fs.writeFileSync(filePaths.main, Component(componentName, tagName, library, packageName), { flag: "wx+" });
|
68
69
|
fs.writeFileSync(filePaths.css, "", { flag: "wx+" });
|
69
|
-
fs.writeFileSync(filePaths.template,
|
70
|
+
fs.writeFileSync(filePaths.template, ComponentTemplate(componentName), { flag: "wx+" });
|
70
71
|
|
71
72
|
console.log(`Successfully generated ${filePaths.main}`);
|
72
73
|
console.log(`Successfully generated ${filePaths.css}`);
|
@@ -74,8 +75,8 @@ const generateFiles = (componentName, tagName, library, packageName) => {
|
|
74
75
|
|
75
76
|
// Change the color of the output
|
76
77
|
console.warn('\x1b[33m%s\x1b[0m', `
|
77
|
-
|
78
|
-
|
78
|
+
Now, import the component via: "import ${componentName} from ./${componentName}.js";
|
79
|
+
And, add it to your HTML: <${tagName}></${tagName}>.`);
|
79
80
|
}
|
80
81
|
|
81
82
|
// Main function
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.7.0-rc.0",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -49,6 +49,7 @@
|
|
49
49
|
"eslint-config-airbnb-base": "^14.2.1",
|
50
50
|
"eslint-plugin-cypress": "^3.4.0",
|
51
51
|
"eslint-plugin-import": "^2.31.0",
|
52
|
+
"eslint-plugin-jsx-no-leaked-values": "^0.1.24",
|
52
53
|
"esprima": "^4.0.1",
|
53
54
|
"getopts": "^2.3.0",
|
54
55
|
"glob": "^7.1.6",
|
@@ -86,5 +87,5 @@
|
|
86
87
|
"esbuild": "^0.19.9",
|
87
88
|
"yargs": "^17.5.1"
|
88
89
|
},
|
89
|
-
"gitHead": "
|
90
|
+
"gitHead": "bae15996685c58d21d6bf20ce7fa8ed10e4728c7"
|
90
91
|
}
|