@ui5/create-webcomponents-package 1.10.3 → 1.11.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 +16 -0
- package/index.js +29 -0
- package/package.json +2 -2
- package/template/.eslintignore +2 -0
- package/template/global.d.ts +12 -0
- package/template/package-scripts.js +1 -0
- package/template/src/Assets.ts +5 -0
- package/template/src/MyFirstComponent.ts +55 -0
- package/template/tsconfig.json +14 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,22 @@
|
|
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
|
+
# [1.11.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.10.4-rc.0...v1.11.0-rc.0) (2023-02-02)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.10.4-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.10.3...v1.10.4-rc.0) (2023-01-26)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
6
22
|
## [1.10.3](https://github.com/SAP/ui5-webcomponents/compare/v1.10.2...v1.10.3) (2023-01-25)
|
7
23
|
|
8
24
|
**Note:** Version bump only for package @ui5/create-webcomponents-package
|
package/index.js
CHANGED
@@ -19,6 +19,9 @@ const toCamelCase = parts => {
|
|
19
19
|
return index === 0 ? string.toLowerCase() : string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
20
20
|
}).join("");
|
21
21
|
};
|
22
|
+
const isTypescriptRelatedFile = sourcePath => {
|
23
|
+
return ["Аssets.ts", "MyFirstComponent.ts", "tsconfig.json", "global.d.ts"].some(fileName => sourcePath.includes(fileName));
|
24
|
+
}
|
22
25
|
|
23
26
|
// Validation of user input
|
24
27
|
const isNameValid = name => typeof name === "string" && name.match(/^[a-zA-Z0-9\-_]+$/);
|
@@ -39,6 +42,13 @@ const replaceVarsInFileName = (vars, fileName) => {
|
|
39
42
|
};
|
40
43
|
|
41
44
|
const copyFile = (vars, sourcePath, destPath) => {
|
45
|
+
const ignoreJsRelated = vars.INIT_PACKAGE_VAR_TYPESCRIPT && sourcePath.includes("MyFirstComponent.js")
|
46
|
+
const ignoreTsRelated = !vars.INIT_PACKAGE_VAR_TYPESCRIPT && isTypescriptRelatedFile(sourcePath)
|
47
|
+
|
48
|
+
if (ignoreJsRelated || ignoreTsRelated) {
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
|
42
52
|
let content = fs.readFileSync(sourcePath, {encoding: "UTF-8"});
|
43
53
|
content = replaceVarsInFileContent(vars, content);
|
44
54
|
destPath = replaceVarsInFileName(vars, destPath);
|
@@ -76,6 +86,24 @@ const createWebcomponentsPackage = async () => {
|
|
76
86
|
name = response.name;
|
77
87
|
}
|
78
88
|
|
89
|
+
// Add TypeScript support
|
90
|
+
response = await prompts({
|
91
|
+
type: "select",
|
92
|
+
name: "language",
|
93
|
+
message: "Support TypeScript:",
|
94
|
+
choices: [
|
95
|
+
{
|
96
|
+
title: "JavaScript",
|
97
|
+
value: "js",
|
98
|
+
},
|
99
|
+
{
|
100
|
+
title: "TypeScript",
|
101
|
+
value: "ts",
|
102
|
+
},
|
103
|
+
]
|
104
|
+
});
|
105
|
+
const typescript = response.language === "ts";
|
106
|
+
|
79
107
|
// Get the port
|
80
108
|
response = await prompts({
|
81
109
|
type: "text",
|
@@ -104,6 +132,7 @@ const createWebcomponentsPackage = async () => {
|
|
104
132
|
INIT_PACKAGE_VAR_PORT: port,
|
105
133
|
INIT_PACKAGE_VAR_TAG: tag,
|
106
134
|
INIT_PACKAGE_VAR_CLASS_NAME: className,
|
135
|
+
INIT_PACKAGE_VAR_TYPESCRIPT: typescript
|
107
136
|
};
|
108
137
|
|
109
138
|
const packageContent = {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/create-webcomponents-package",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.11.0-rc.0",
|
4
4
|
"description": "UI5 Web Components: create package",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -23,5 +23,5 @@
|
|
23
23
|
"npm-config-user-agent-parser": "^1.0.0",
|
24
24
|
"prompts": "^2.4.1"
|
25
25
|
},
|
26
|
-
"gitHead": "
|
26
|
+
"gitHead": "6464abd79265425ce65232ebeee53cf6585e6ec6"
|
27
27
|
}
|
package/template/.eslintignore
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
// eslint-disable-next-line
|
2
|
+
import "@ui5/webcomponents-base/dist/global";
|
3
|
+
import { TemplateFunction } from "@ui5/webcomponents-base/dist/renderer/executeTemplate.js";
|
4
|
+
|
5
|
+
export {};
|
6
|
+
|
7
|
+
declare global {
|
8
|
+
module "*.lit.js" {
|
9
|
+
const content: TemplateFunction;
|
10
|
+
export default content;
|
11
|
+
}
|
12
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
|
2
|
+
import customElement from "@ui5/webcomponents-base/dist/decorators/customElement.js";
|
3
|
+
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
|
4
|
+
import { getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
5
|
+
import type I18nBundle from "@ui5/webcomponents-base/dist/i18nBundle.js";
|
6
|
+
|
7
|
+
// Template
|
8
|
+
import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACKAGE_VAR_CLASS_NAMETemplate.lit.js";
|
9
|
+
|
10
|
+
// Styles
|
11
|
+
import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
|
12
|
+
|
13
|
+
import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @class
|
17
|
+
*
|
18
|
+
* <h3 class="comment-api-title">Overview</h3>
|
19
|
+
*
|
20
|
+
* The <code>INIT_PACKAGE_VAR_TAG</code> component is a demo component that displays some text.
|
21
|
+
*
|
22
|
+
* @constructor
|
23
|
+
* @alias demo.components.INIT_PACKAGE_VAR_CLASS_NAME
|
24
|
+
* @extends sap.ui.webc.base.UI5Element
|
25
|
+
* @tagname INIT_PACKAGE_VAR_TAG
|
26
|
+
* @public
|
27
|
+
*/
|
28
|
+
@customElement("INIT_PACKAGE_VAR_TAG")
|
29
|
+
class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
|
30
|
+
static i18nBundle: I18nBundle;
|
31
|
+
|
32
|
+
static get render() {
|
33
|
+
return litRender;
|
34
|
+
}
|
35
|
+
|
36
|
+
static get template() {
|
37
|
+
return INIT_PACKAGE_VAR_CLASS_NAMETemplate;
|
38
|
+
}
|
39
|
+
|
40
|
+
static get styles() {
|
41
|
+
return INIT_PACKAGE_VAR_CLASS_NAMECss;
|
42
|
+
}
|
43
|
+
|
44
|
+
static async onDefine() {
|
45
|
+
INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle = await getI18nBundle("INIT_PACKAGE_VAR_NAME");
|
46
|
+
}
|
47
|
+
|
48
|
+
get pleaseWaitText() {
|
49
|
+
return INIT_PACKAGE_VAR_CLASS_NAME.i18nBundle.getText(PLEASE_WAIT);
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
INIT_PACKAGE_VAR_CLASS_NAME.define();
|
54
|
+
|
55
|
+
export default INIT_PACKAGE_VAR_CLASS_NAME;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"include": ["src/**/*", "global.d.ts"],
|
3
|
+
"compilerOptions": {
|
4
|
+
"target": "ES2021",
|
5
|
+
// Generate d.ts files
|
6
|
+
"declaration": true,
|
7
|
+
"outDir": "dist",
|
8
|
+
"skipLibCheck": true,
|
9
|
+
"sourceMap": true,
|
10
|
+
"strict": true,
|
11
|
+
"moduleResolution": "node",
|
12
|
+
"experimentalDecorators": true,
|
13
|
+
},
|
14
|
+
}
|