@ui5/webcomponents-tools 0.0.0-6298a142d → 0.0.0-64a57f090
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 +168 -0
- package/assets-meta.js +9 -6
- package/components-package/nps.js +3 -3
- package/components-package/postcss.components.js +6 -3
- package/components-package/postcss.themes.js +5 -11
- package/components-package/vite.config.js +0 -3
- package/components-package/wdio.js +1 -2
- package/lib/create-illustrations/index.js +14 -0
- package/lib/create-new-component/index.js +1 -1
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/generate-custom-elements-manifest/index.js +1 -1
- package/lib/generate-js-imports/illustrations.js +75 -64
- package/lib/postcss-css-to-esm/index.js +1 -1
- package/lib/postcss-css-to-json/index.js +1 -1
- package/lib/postcss-scope-vars/index.js +24 -0
- package/package.json +4 -6
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,174 @@
|
|
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.18.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.1...v1.18.0-rc.2) (2023-09-28)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
# [1.18.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.18.0-rc.0...v1.18.0-rc.1) (2023-09-21)
|
15
|
+
|
16
|
+
|
17
|
+
### Reverts
|
18
|
+
|
19
|
+
* Revert "build: fix dev server page refresh" ([105db9f](https://github.com/SAP/ui5-webcomponents/commit/105db9f3c42e7434c2dc9b0eb967fb45cac9620d))
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
# [1.18.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0...v1.18.0-rc.0) (2023-09-07)
|
26
|
+
|
27
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
# [1.17.0](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.2...v1.17.0) (2023-09-01)
|
34
|
+
|
35
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
# [1.17.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.1...v1.17.0-rc.2) (2023-08-24)
|
42
|
+
|
43
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
# [1.17.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.0...v1.17.0-rc.1) (2023-08-17)
|
50
|
+
|
51
|
+
|
52
|
+
### Features
|
53
|
+
|
54
|
+
* **framework:** scope css variables per runtime and version ([#7449](https://github.com/SAP/ui5-webcomponents/issues/7449)) ([d3f6c2e](https://github.com/SAP/ui5-webcomponents/commit/d3f6c2efba9cfda389ea4d700a375f75b3e2996b))
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
# [1.17.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0...v1.17.0-rc.0) (2023-08-10)
|
61
|
+
|
62
|
+
|
63
|
+
### Bug Fixes
|
64
|
+
|
65
|
+
* **ui5-illustrated-message:** support collection based illustration loading ([#7318](https://github.com/SAP/ui5-webcomponents/issues/7318)) ([6b52dbd](https://github.com/SAP/ui5-webcomponents/commit/6b52dbd157a3c8198e41c84157e3d9ae89e3386e))
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
# [1.16.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.4...v1.16.0) (2023-08-03)
|
72
|
+
|
73
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
# [1.16.0-rc.4](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.3...v1.16.0-rc.4) (2023-08-03)
|
80
|
+
|
81
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
# [1.16.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.2...v1.16.0-rc.3) (2023-07-27)
|
88
|
+
|
89
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
# [1.16.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.1...v1.16.0-rc.2) (2023-07-20)
|
96
|
+
|
97
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
# [1.16.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0-rc.0...v1.16.0-rc.1) (2023-07-13)
|
104
|
+
|
105
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
# [1.16.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.15.1...v1.16.0-rc.0) (2023-07-06)
|
112
|
+
|
113
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
# [1.15.0](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.2...v1.15.0) (2023-06-30)
|
120
|
+
|
121
|
+
|
122
|
+
### Bug Fixes
|
123
|
+
|
124
|
+
* **framework:** missing CSS variables in compact mode / rtl mode ([#7189](https://github.com/SAP/ui5-webcomponents/issues/7189)) ([9b39b9c](https://github.com/SAP/ui5-webcomponents/commit/9b39b9ce5c3720dbb106c5638f858754e11a735f))
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
# [1.15.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.1...v1.15.0-rc.2) (2023-06-22)
|
131
|
+
|
132
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
# [1.15.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.15.0-rc.0...v1.15.0-rc.1) (2023-06-15)
|
139
|
+
|
140
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
# [1.15.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0...v1.15.0-rc.0) (2023-06-08)
|
151
|
+
|
152
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
# [1.14.0](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.2...v1.14.0) (2023-06-01)
|
159
|
+
|
160
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
# [1.14.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.1...v1.14.0-rc.2) (2023-06-01)
|
167
|
+
|
168
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
6
174
|
# [1.14.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.14.0-rc.0...v1.14.0-rc.1) (2023-05-25)
|
7
175
|
|
8
176
|
**Note:** Version bump only for package @ui5/webcomponents-tools
|
package/assets-meta.js
CHANGED
@@ -9,12 +9,15 @@ const assetsMeta = {
|
|
9
9
|
"sap_belize_hcw",
|
10
10
|
"sap_fiori_3_hcb",
|
11
11
|
"sap_fiori_3_hcw",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
"sap_horizon",
|
13
|
+
"sap_horizon_dark",
|
14
|
+
"sap_horizon_hcb",
|
15
|
+
"sap_horizon_hcw",
|
16
|
+
"sap_horizon_exp",
|
17
|
+
"sap_horizon_dark_exp",
|
18
|
+
"sap_horizon_hcb_exp",
|
19
|
+
"sap_horizon_hcw_exp",
|
20
|
+
],
|
18
21
|
},
|
19
22
|
"languages": {
|
20
23
|
"default": "en",
|
@@ -8,12 +8,12 @@ const getScripts = (options) => {
|
|
8
8
|
|
9
9
|
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
10
10
|
const illustrationsData = options.illustrationsData || [];
|
11
|
-
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
|
11
|
+
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
|
12
12
|
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
13
|
|
14
14
|
// The script creates the "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
15
|
-
|
16
|
-
|
15
|
+
const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.prefix || '\"\"'} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
|
16
|
+
|
17
17
|
const tsOption = options.typescript;
|
18
18
|
const tsCommand = tsOption ? "tsc" : "";
|
19
19
|
const tsWatchCommand = tsOption ? "tsc --watch" : "";
|
@@ -1,9 +1,11 @@
|
|
1
1
|
const postcssImport = require('postcss-import');
|
2
2
|
const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
|
3
|
+
const postcssScopeVars = require('../lib/postcss-scope-vars/index.js');
|
3
4
|
const cssnano = require('cssnano');
|
4
|
-
const fs = require("fs")
|
5
|
+
const fs = require("fs")
|
5
6
|
|
6
|
-
|
7
|
+
|
8
|
+
const packageJSON = JSON.parse(fs.readFileSync("./package.json"))
|
7
9
|
|
8
10
|
module.exports = {
|
9
11
|
plugins: [
|
@@ -16,6 +18,7 @@ module.exports = {
|
|
16
18
|
},
|
17
19
|
]
|
18
20
|
}),
|
19
|
-
|
21
|
+
postcssScopeVars({version: packageJSON.version}),
|
22
|
+
postcssCSStoESM({ toReplace: 'src', includeDefaultTheme: true, packageName: packageJSON.name }),
|
20
23
|
]
|
21
24
|
}
|
@@ -2,14 +2,17 @@ const postcssImport = require('postcss-import');
|
|
2
2
|
const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
|
3
3
|
const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
|
4
4
|
const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
|
5
|
+
const postcssScopeVars = require('../lib/postcss-scope-vars/index.js');
|
5
6
|
const cssnano = require('cssnano');
|
6
|
-
const modifySelectors = require("modify-selectors");
|
7
7
|
const fs = require("fs");
|
8
8
|
|
9
|
-
|
9
|
+
|
10
|
+
const packageJSON = JSON.parse(fs.readFileSync("./package.json"))
|
11
|
+
const packageName = packageJSON.name;
|
10
12
|
|
11
13
|
module.exports = {
|
12
14
|
plugins: [
|
15
|
+
postcssScopeVars({version: packageJSON.version}),
|
13
16
|
postcssImport(),
|
14
17
|
combineSelectors({
|
15
18
|
removeDuplicatedProperties: true
|
@@ -21,15 +24,6 @@ module.exports = {
|
|
21
24
|
},
|
22
25
|
]
|
23
26
|
},),
|
24
|
-
modifySelectors({
|
25
|
-
enable: true,
|
26
|
-
suffix: [
|
27
|
-
{
|
28
|
-
match: '*',
|
29
|
-
with: '[_ui5host]', // Add suffix to each selector in the file (:root => :root [_ui5host])
|
30
|
-
},
|
31
|
-
],
|
32
|
-
}),
|
33
27
|
postcssCSStoJSON({ toReplace: 'src', packageName }),
|
34
28
|
postcssCSStoESM({ toReplace: 'src', packageName }),
|
35
29
|
]
|
@@ -107,8 +107,7 @@ exports.config = {
|
|
107
107
|
// Services take over a specific job you don't want to take care of. They enhance
|
108
108
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
109
109
|
// commands. Instead, they hook themselves up into the test process.
|
110
|
-
services: ['chromedriver', '
|
111
|
-
['static-server', {
|
110
|
+
services: ['chromedriver', ['static-server', {
|
112
111
|
folders: [
|
113
112
|
{ mount: '/', path: './dist' },
|
114
113
|
],
|
@@ -57,10 +57,20 @@ const generate = async () => {
|
|
57
57
|
const illustrationsPrefix = process.argv[4];
|
58
58
|
const illustrationSet = process.argv[5];
|
59
59
|
const destPath = process.argv[6];
|
60
|
+
const collection = process.argv[7];
|
60
61
|
const fileNamePattern = new RegExp(`${illustrationsPrefix}-.+-(.+).svg`);
|
61
62
|
// collect each illustration name because each one should have Sample.js file
|
62
63
|
const fileNames = new Set();
|
63
64
|
|
65
|
+
try {
|
66
|
+
await fs.access(srcPath);
|
67
|
+
} catch (error) {
|
68
|
+
console.log(`The path ${srcPath} does not exist.`);
|
69
|
+
return Promise.resolve(null);
|
70
|
+
}
|
71
|
+
|
72
|
+
console.log(`Generating illustrations from ${srcPath} to ${destPath}`)
|
73
|
+
|
64
74
|
const svgImportTemplate = svgContent => {
|
65
75
|
return `export default \`${svgContent}\`;`
|
66
76
|
};
|
@@ -95,6 +105,7 @@ import {
|
|
95
105
|
|
96
106
|
const name = "${illustrationName}";
|
97
107
|
const set = "${illustrationSet}";
|
108
|
+
const collection = "${collection}";
|
98
109
|
const title = IM_TITLE_${illustrationNameUpperCase};
|
99
110
|
const subtitle = IM_SUBTITLE_${illustrationNameUpperCase};
|
100
111
|
|
@@ -105,6 +116,7 @@ registerIllustration(name, {
|
|
105
116
|
title,
|
106
117
|
subtitle,
|
107
118
|
set,
|
119
|
+
collection,
|
108
120
|
});
|
109
121
|
|
110
122
|
export {
|
@@ -119,12 +131,14 @@ import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";
|
|
119
131
|
|
120
132
|
const name = "${illustrationName}";
|
121
133
|
const set = "${illustrationSet}";
|
134
|
+
const collection = "${collection}";
|
122
135
|
|
123
136
|
registerIllustration(name, {
|
124
137
|
dialogSvg,
|
125
138
|
sceneSvg,
|
126
139
|
spotSvg,
|
127
140
|
set,
|
141
|
+
collection,
|
128
142
|
});
|
129
143
|
|
130
144
|
export {
|
@@ -83,7 +83,7 @@ const generateFiles = (componentName, tagName, library, packageName, isTypeScrip
|
|
83
83
|
// Change the color of the output
|
84
84
|
console.warn('\x1b[33m%s\x1b[0m', `
|
85
85
|
Make sure to import the component in your bundle by using:
|
86
|
-
import
|
86
|
+
import "./dist/${componentName}.js";`);
|
87
87
|
}
|
88
88
|
|
89
89
|
// Main function
|
@@ -0,0 +1,39 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
|
3
|
+
/**
|
4
|
+
* A change is observed on MacOS since 13.5, where the build generates a large amount
|
5
|
+
* of JSON file that spotlight search has to index, as they are considered new files.
|
6
|
+
*
|
7
|
+
* Starting the vitejs dev server reads all of these files and this triggers the indexing.
|
8
|
+
* The indexing has a side effect of changing some file metadata (can be checked with `mdls <path_to_file>`).
|
9
|
+
* This metadata change is changing the ctime of the file, but not the mtime. This can be checked with `stat -x <path_to_file>
|
10
|
+
*
|
11
|
+
* Essentially only metadata is changed, not content. This should not cause a page refresh,
|
12
|
+
* but chokidar reports this change and vite refreshes the page.
|
13
|
+
* The indexing is running with a 10 second interval, so for roughtly 20 minutes vite is refreshing the page every 10 seconds
|
14
|
+
*
|
15
|
+
* This plugin checks if the file causing the refresh is a generated json file (dist/*.json) and if ctime is changed after mtime
|
16
|
+
* In that case, returing an empty array tells vitejs that a custom update will be made by the plugin,
|
17
|
+
* which is in effect ignoring the page refresh.
|
18
|
+
*/
|
19
|
+
|
20
|
+
const customHotUpdate = async () => {
|
21
|
+
return {
|
22
|
+
name: 'custom-hot-update',
|
23
|
+
handleHotUpdate(ctx) {
|
24
|
+
// custom check for generated json files
|
25
|
+
if (ctx.file.includes("dist/") && ctx.file.endsWith(".json")) {
|
26
|
+
const stat = fs.statSync(ctx.file);
|
27
|
+
|
28
|
+
// metadata change only
|
29
|
+
if (stat.ctime > stat.mtime) {
|
30
|
+
// uncomment for debugging
|
31
|
+
// console.log("ignoring hot update for:", ctx.file);
|
32
|
+
return [];
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
module.exports = customHotUpdate;
|
@@ -1,72 +1,83 @@
|
|
1
1
|
const fs = require("fs").promises;
|
2
|
-
const path = require(
|
3
|
-
|
4
|
-
const
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
default: throw new Error("[Illustrations] Illustration not found: " + illustrationName);
|
50
|
-
}
|
2
|
+
const path = require("path");
|
3
|
+
|
4
|
+
const generateDynamicImportLines = (fileNames, location, exclusionPatterns = []) => {
|
5
|
+
return fileNames
|
6
|
+
.filter((fileName) => !exclusionPatterns.some((pattern) => fileName.startsWith(pattern)))
|
7
|
+
.map((fileName) => {
|
8
|
+
const illustrationPath = `${location}/${fileName.replace(".js", "")}`;
|
9
|
+
return `\t\tcase "${fileName.replace('.js', '')}": return (await import("${illustrationPath}.js")).default;`;
|
10
|
+
})
|
11
|
+
.join("\n");
|
12
|
+
};
|
13
|
+
|
14
|
+
const generateAvailableIllustrationsArray = (fileNames, exclusionPatterns = []) => {
|
15
|
+
return JSON.stringify(
|
16
|
+
fileNames
|
17
|
+
.filter((fileName) => !exclusionPatterns.some((pattern) => fileName.startsWith(pattern)))
|
18
|
+
.map((fileName) => fileName.replace(".js", ""))
|
19
|
+
);
|
20
|
+
};
|
21
|
+
|
22
|
+
const generateDynamicImportsFileContent = (dynamicImports, availableIllustrations, collection, prefix = "") => {
|
23
|
+
return `import { registerIllustrationLoader } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
24
|
+
|
25
|
+
export const loadIllustration = async (illustrationName) => {
|
26
|
+
const collectionAndPrefix = "${collection}/${prefix}";
|
27
|
+
const cleanIllustrationName = illustrationName.startsWith(collectionAndPrefix) ? illustrationName.replace(collectionAndPrefix, "") : illustrationName;
|
28
|
+
switch (cleanIllustrationName) {
|
29
|
+
${dynamicImports}
|
30
|
+
default:
|
31
|
+
throw new Error("[Illustrations] Illustration not found: " + illustrationName);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
|
35
|
+
const loadAndCheck = async (illustrationName) => {
|
36
|
+
const data = await loadIllustration(illustrationName);
|
37
|
+
return data;
|
38
|
+
};
|
39
|
+
|
40
|
+
${availableIllustrations}.forEach((illustrationName) =>
|
41
|
+
registerIllustrationLoader(\`${collection}/${prefix}\${illustrationName}\`, loadAndCheck)
|
42
|
+
);
|
43
|
+
`;
|
44
|
+
};
|
45
|
+
|
46
|
+
const getMatchingFiles = async (folder, pattern) => {
|
47
|
+
const dir = await fs.readdir(folder);
|
48
|
+
return dir.filter((fileName) => fileName.match(pattern));
|
51
49
|
};
|
52
|
-
const loadAndCheck = async (illustrationName) => {
|
53
|
-
const data = await loadIllustration(illustrationName);
|
54
|
-
return data;
|
55
|
-
}
|
56
50
|
|
51
|
+
const generateIllustrations = async (config) => {
|
52
|
+
const { inputFolder, outputFile, collection, location, prefix, filterOut } = config;
|
53
|
+
|
54
|
+
const normalizedInputFolder = path.normalize(inputFolder);
|
55
|
+
const normalizedOutputFile = path.normalize(outputFile);
|
56
|
+
|
57
|
+
const illustrations = await getMatchingFiles(normalizedInputFolder, /^.*\.js$/);
|
57
58
|
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
const dynamicImports = generateDynamicImportLines(illustrations, location, filterOut);
|
60
|
+
const availableIllustrations = generateAvailableIllustrationsArray(illustrations, filterOut);
|
61
|
+
|
62
|
+
const contentDynamic = generateDynamicImportsFileContent(dynamicImports, availableIllustrations, collection, prefix);
|
63
|
+
|
64
|
+
await fs.mkdir(path.dirname(normalizedOutputFile), { recursive: true });
|
65
|
+
await fs.writeFile(normalizedOutputFile, contentDynamic);
|
66
|
+
|
67
|
+
console.log(`Generated ${normalizedOutputFile}`);
|
68
|
+
};
|
61
69
|
|
62
|
-
|
63
|
-
|
70
|
+
// Parse configuration from command-line arguments
|
71
|
+
const config = {
|
72
|
+
inputFolder: process.argv[2],
|
73
|
+
outputFile: process.argv[3],
|
74
|
+
collection: process.argv[4],
|
75
|
+
location: process.argv[5],
|
76
|
+
prefix: process.argv[6],
|
77
|
+
filterOut: process.argv.slice(7),
|
64
78
|
};
|
65
79
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
.catch(err => {
|
70
|
-
console.error(err);
|
71
|
-
process.exit(1);
|
80
|
+
// Run the generation process
|
81
|
+
generateIllustrations(config).catch((error) => {
|
82
|
+
console.error("Error generating illustrations:", error);
|
72
83
|
});
|
@@ -0,0 +1,24 @@
|
|
1
|
+
const name = "postcss-scope-vars";
|
2
|
+
|
3
|
+
module.exports = (options) => {
|
4
|
+
const versionStr = "v" + options?.version?.replaceAll(".", "-");
|
5
|
+
return {
|
6
|
+
postcssPlugin: name,
|
7
|
+
prepare() {
|
8
|
+
return {
|
9
|
+
Declaration: (declaration) => {
|
10
|
+
if (declaration.__ui5_replaced) {
|
11
|
+
return;
|
12
|
+
}
|
13
|
+
// add version after ui5
|
14
|
+
const expr = /(--_?ui5)([^\,\:\)\s]+)/g
|
15
|
+
declaration.prop = declaration.prop.replaceAll(expr, `$1-${versionStr}$2`)
|
16
|
+
declaration.value = declaration.value.replaceAll(expr, `$1-${versionStr}$2`)
|
17
|
+
declaration.__ui5_replaced = true;
|
18
|
+
},
|
19
|
+
};
|
20
|
+
},
|
21
|
+
};
|
22
|
+
};
|
23
|
+
|
24
|
+
module.exports.postcss = true;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ui5/webcomponents-tools",
|
3
|
-
"version": "0.0.0-
|
3
|
+
"version": "0.0.0-64a57f090",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -24,7 +24,6 @@
|
|
24
24
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
25
25
|
"@typescript-eslint/parser": "^5.42.1",
|
26
26
|
"@wdio/cli": "^7.19.7",
|
27
|
-
"@wdio/devtools-service": "^7.19.7",
|
28
27
|
"@wdio/dot-reporter": "^7.19.7",
|
29
28
|
"@wdio/local-runner": "^7.19.7",
|
30
29
|
"@wdio/mocha-framework": "^7.19.7",
|
@@ -37,7 +36,7 @@
|
|
37
36
|
"command-line-args": "^5.1.1",
|
38
37
|
"concurrently": "^6.0.0",
|
39
38
|
"cross-env": "^7.0.3",
|
40
|
-
"cssnano": "^
|
39
|
+
"cssnano": "^6.0.1",
|
41
40
|
"escodegen": "^2.0.0",
|
42
41
|
"eslint": "^7.22.0",
|
43
42
|
"eslint-config-airbnb-base": "^14.2.1",
|
@@ -52,7 +51,6 @@
|
|
52
51
|
"jsdoc": "^3.6.6",
|
53
52
|
"json-beautify": "^1.1.1",
|
54
53
|
"mkdirp": "^1.0.4",
|
55
|
-
"modify-selectors": "^2.0.0",
|
56
54
|
"nps": "^5.10.0",
|
57
55
|
"postcss": "^8.4.5",
|
58
56
|
"postcss-cli": "^9.1.0",
|
@@ -64,9 +62,9 @@
|
|
64
62
|
"resolve": "^1.20.0",
|
65
63
|
"rimraf": "^3.0.2",
|
66
64
|
"slash": "3.0.0",
|
67
|
-
"vite": "^
|
65
|
+
"vite": "^4.4.9",
|
68
66
|
"wdio-chromedriver-service": "^7.3.2",
|
69
|
-
"zx": "^
|
67
|
+
"zx": "^7.2.3"
|
70
68
|
},
|
71
69
|
"peerDependencies": {
|
72
70
|
"chromedriver": "*",
|