@ui5/webcomponents-tools 2.0.0-rc.2 → 2.0.0-rc.4
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 +63 -0
- package/assets-meta.js +0 -3
- package/components-package/nps.js +8 -1
- package/components-package/wdio.js +12 -2
- package/lib/create-icons/index.js +8 -6
- package/lib/css-processors/css-processor-component-styles.mjs +1 -0
- package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
- package/lib/scoping/lint-src.js +8 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,69 @@
|
|
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.0.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.3...v2.0.0-rc.4) (2024-05-29)
|
7
|
+
|
8
|
+
|
9
|
+
### Features
|
10
|
+
|
11
|
+
* **ui5-input:** allow custom icon styling ([#8881](https://github.com/SAP/ui5-webcomponents/issues/8881)) ([cf9f1c2](https://github.com/SAP/ui5-webcomponents/commit/cf9f1c28c93b9fa6c8663ce24d3c5e6d1ff4cc4e)), closes [#8182](https://github.com/SAP/ui5-webcomponents/issues/8182) [#6132](https://github.com/SAP/ui5-webcomponents/issues/6132)
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
# [2.0.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.2...v2.0.0-rc.3) (2024-05-10)
|
18
|
+
|
19
|
+
|
20
|
+
### chore
|
21
|
+
|
22
|
+
* **Icons:** make pathData async ([#8785](https://github.com/SAP/ui5-webcomponents/issues/8785)) ([0549dc9](https://github.com/SAP/ui5-webcomponents/commit/0549dc95edae139f7a4f9efbbc7170922b3ab6cb))
|
23
|
+
|
24
|
+
|
25
|
+
### Code Refactoring
|
26
|
+
|
27
|
+
* **theming:** remove Belize theme ([#8519](https://github.com/SAP/ui5-webcomponents/issues/8519)) ([990313f](https://github.com/SAP/ui5-webcomponents/commit/990313fc8e429a491f4d6e67306d3df2703e54fe)), closes [#8461](https://github.com/SAP/ui5-webcomponents/issues/8461)
|
28
|
+
|
29
|
+
|
30
|
+
### BREAKING CHANGES
|
31
|
+
|
32
|
+
* **theming:** Remove SAP Belize theme
|
33
|
+
* **Icons:** UI5 Web Components Icons now export `getPathData` (function) instead of `pathData` (string)
|
34
|
+
|
35
|
+
If you used icons like this:
|
36
|
+
|
37
|
+
```js
|
38
|
+
import "@ui5/webcomponents-icons/dist/accept.js";
|
39
|
+
```
|
40
|
+
|
41
|
+
or like this:
|
42
|
+
|
43
|
+
```js
|
44
|
+
import accept from "@ui5/webcomponents-icons/dist/accept.js";
|
45
|
+
```
|
46
|
+
|
47
|
+
**there is no change and no adaptations are required**.
|
48
|
+
|
49
|
+
In the rare case you imported `pathData` from icons, for example:
|
50
|
+
|
51
|
+
```js
|
52
|
+
import { pathData, ltr, accData } from "@ui5/webcomponents-icons/dist/accept.js";
|
53
|
+
console.log(pathData); // String containing the SVG path
|
54
|
+
```
|
55
|
+
|
56
|
+
you must change your code to, for example:
|
57
|
+
|
58
|
+
```js
|
59
|
+
import { getPathData, ltr, accData } from "@ui5/webcomponents-icons/dist/accept.js";
|
60
|
+
getPathData().then(pathData => {
|
61
|
+
console.log(pathData); // String containing the SVG path
|
62
|
+
});
|
63
|
+
```
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
6
69
|
# [2.0.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v2.0.0-rc.1...v2.0.0-rc.2) (2024-04-18)
|
7
70
|
|
8
71
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
package/assets-meta.js
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
const path = require("path");
|
2
2
|
const fs = require("fs");
|
3
3
|
const LIB = path.join(__dirname, `../lib/`);
|
4
|
+
let websiteBaseUrl = "/";
|
5
|
+
|
6
|
+
if (process.env.DEPOY) {
|
7
|
+
websiteBaseUrl = "/ui5-webcomponents/";
|
8
|
+
} else if (process.env.DEPLOY_NIGHTLY) {
|
9
|
+
websiteBaseUrl = "/ui5-webcomponents/nightly/";
|
10
|
+
}
|
4
11
|
|
5
12
|
const getScripts = (options) => {
|
6
13
|
|
@@ -89,7 +96,7 @@ const getScripts = (options) => {
|
|
89
96
|
default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
90
97
|
illustrationsLoaders: createIllustrationsLoadersScript,
|
91
98
|
},
|
92
|
-
bundle: `vite build ${viteConfig}`,
|
99
|
+
bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
|
93
100
|
bundle2: ``,
|
94
101
|
illustrations: createIllustrationsJSImportsScript,
|
95
102
|
},
|
@@ -1,4 +1,5 @@
|
|
1
1
|
const dns = require("node:dns");
|
2
|
+
const assert = require("chai").assert;
|
2
3
|
|
3
4
|
exports.config = {
|
4
5
|
//
|
@@ -309,8 +310,17 @@ exports.config = {
|
|
309
310
|
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
310
311
|
* @param {Object} test test details
|
311
312
|
*/
|
312
|
-
|
313
|
-
|
313
|
+
afterTest: async function (test, context) {
|
314
|
+
// fetch the browser logs and fail the test if there are `console.error` messages with the `[UI5-FWK]` marker
|
315
|
+
const logs = await browser.getLogs('browser');
|
316
|
+
const severeLogs = logs
|
317
|
+
.filter(l => l.level === "SEVERE" && l.message.includes("[UI5-FWK]"))
|
318
|
+
.map(l => l.message);
|
319
|
+
assert.equal(severeLogs.length, 0, `[${test.title}]\n\n ${severeLogs.join("\n ")}`)
|
320
|
+
if (severeLogs.length) {
|
321
|
+
test.callback(new Error('Framework errors detected.'))
|
322
|
+
}
|
323
|
+
},
|
314
324
|
/**
|
315
325
|
* Hook that gets executed after the suite has ended
|
316
326
|
* @param {Object} suite suite details
|
@@ -38,14 +38,16 @@ export { pathData, ltr, accData };`;
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
const collectionTemplate = (name, versions, fullName) => `import {
|
41
|
+
const collectionTemplate = (name, versions, fullName) => `import { isLegacyThemeFamilyAsync } from "@ui5/webcomponents-base/dist/config/Theme.js";
|
42
42
|
import { pathData as pathData${versions[0]}, ltr, accData } from "./${versions[0]}/${name}.js";
|
43
43
|
import { pathData as pathData${versions[1]} } from "./${versions[1]}/${name}.js";
|
44
44
|
|
45
|
-
const
|
45
|
+
const getPathData = async() => {
|
46
|
+
return await isLegacyThemeFamilyAsync() ? pathDatav4 : pathDatav5;
|
47
|
+
};
|
46
48
|
|
47
49
|
export default "${fullName}";
|
48
|
-
export {
|
50
|
+
export { getPathData, ltr, accData };`;
|
49
51
|
|
50
52
|
|
51
53
|
const typeDefinitionTemplate = (name, accData, collection) => `declare const pathData: string;
|
@@ -56,13 +58,13 @@ declare const _default: "${collection}/${name}";
|
|
56
58
|
export default _default;
|
57
59
|
export { pathData, ltr, accData };`
|
58
60
|
|
59
|
-
const collectionTypeDefinitionTemplate = (name, accData) => `declare const
|
61
|
+
const collectionTypeDefinitionTemplate = (name, accData) => `declare const getPathData: () => Promise<string>;
|
60
62
|
declare const ltr: boolean;
|
61
63
|
declare const accData: ${accData ? '{ key: string; defaultText: string; }' : null}
|
62
64
|
declare const _default: "${name}";
|
63
65
|
|
64
66
|
export default _default;
|
65
|
-
export {
|
67
|
+
export { getPathData, ltr, accData };`
|
66
68
|
|
67
69
|
|
68
70
|
const svgTemplate = (pathData) => `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
@@ -91,7 +93,7 @@ const createIcons = async (file) => {
|
|
91
93
|
|
92
94
|
// For versioned icons collections, the script creates top level (unversioned) module that internally imports the versioned ones.
|
93
95
|
// For example, the top level "@ui5/ui5-webcomponents-icons/dist/accept.js" imports:
|
94
|
-
// - "@ui5/ui5-webcomponents-icons/dist/v5/accept.js"
|
96
|
+
// - "@ui5/ui5-webcomponents-icons/dist/v5/accept.js"
|
95
97
|
// - "@ui5/ui5-webcomponents-icons/dist/v4/accept.js"
|
96
98
|
|
97
99
|
if (json.version) {
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { globby } from "globby";
|
2
|
+
import * as esbuild from 'esbuild'
|
3
|
+
import * as fs from "fs";
|
4
|
+
|
5
|
+
let customPlugin = {
|
6
|
+
name: 'ui5-tools',
|
7
|
+
setup(build) {
|
8
|
+
build.onLoad({ filter: /UI5Element.ts$/ }, async (args) => {
|
9
|
+
let text = await fs.promises.readFile(args.path, 'utf8');
|
10
|
+
text = text.replaceAll(/const DEV_MODE = true/g, "");
|
11
|
+
text = text.replaceAll(/if \(DEV_MODE\)/g, "if (false)");
|
12
|
+
return {
|
13
|
+
contents: text,
|
14
|
+
loader: 'ts',
|
15
|
+
}
|
16
|
+
})
|
17
|
+
},
|
18
|
+
}
|
19
|
+
|
20
|
+
const getConfig = async () => {
|
21
|
+
const config = {
|
22
|
+
entryPoints: await globby("src/**/*.ts"),
|
23
|
+
bundle: false,
|
24
|
+
minify: true,
|
25
|
+
sourcemap: true,
|
26
|
+
outdir: 'dist/prod',
|
27
|
+
outbase: 'src',
|
28
|
+
plugins: [
|
29
|
+
customPlugin,
|
30
|
+
]
|
31
|
+
};
|
32
|
+
return config;
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
const config = await getConfig();
|
37
|
+
const result = await esbuild.build(config);
|
package/lib/scoping/lint-src.js
CHANGED
@@ -7,25 +7,26 @@ const tags = getAllTags(process.cwd());
|
|
7
7
|
|
8
8
|
const errors = [];
|
9
9
|
|
10
|
+
const removeComments = str => str.replaceAll(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*$/gm, "");
|
11
|
+
|
10
12
|
glob.sync(path.join(process.cwd(), "src/**/*.css")).forEach(file => {
|
11
|
-
let content = String(fs.readFileSync(file));
|
13
|
+
let content = removeComments(String(fs.readFileSync(file)));
|
12
14
|
tags.forEach(tag => {
|
13
15
|
if (content.match(new RegExp(`(^|[^\.\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
|
14
|
-
errors.push(
|
16
|
+
errors.push(`${tag} found in ${file}`);
|
15
17
|
}
|
16
18
|
});
|
17
19
|
});
|
18
20
|
|
19
|
-
glob.sync(path.join(process.cwd(), "src/**/*.
|
20
|
-
let content = String(fs.readFileSync(file));
|
21
|
+
glob.sync(path.join(process.cwd(), "src/**/*.ts")).forEach(file => {
|
22
|
+
let content = removeComments(String(fs.readFileSync(file)));
|
21
23
|
tags.forEach(tag => {
|
22
24
|
if (content.match(new RegExp(`querySelector[A-Za-z]*..${tag}`, "g"))) {
|
23
|
-
errors.push(`
|
25
|
+
errors.push(`querySelector for ${tag} found in ${file}`);
|
24
26
|
}
|
25
27
|
});
|
26
28
|
});
|
27
29
|
|
28
30
|
if (errors.length) {
|
29
|
-
errors.
|
30
|
-
throw new Error("Errors found.");
|
31
|
+
throw new Error(`Scoping-related errors found (f.e. used ui5-input instead of [ui5-input]): \n ${errors.join("\n")}`);
|
31
32
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "2.0.0-rc.
|
3
|
+
"version": "2.0.0-rc.4",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -80,5 +80,5 @@
|
|
80
80
|
"esbuild": "^0.19.9",
|
81
81
|
"yargs": "^17.5.1"
|
82
82
|
},
|
83
|
-
"gitHead": "
|
83
|
+
"gitHead": "328a4aa4a6d81244939ba9201542ec2b1726b97e"
|
84
84
|
}
|