@ui5/webcomponents-tools 0.0.0-dc3ccac50 → 0.0.0-deac3098a
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 +99 -0
- package/assets-meta.js +4 -0
- package/components-package/nps.js +1 -1
- package/components-package/rollup.js +4 -2
- package/components-package/wdio.js +16 -0
- package/components-package/wdio.sync.js +16 -0
- package/lib/create-icons/index.js +2 -2
- package/lib/create-illustrations/index.js +60 -5
- package/lib/documentation/templates/api-properties-section.js +3 -1
- package/lib/documentation/templates/template.js +2 -1
- package/lib/hbs2lit/src/compiler.js +10 -1
- package/lib/jsdoc/plugin.js +9 -0
- package/lib/jsdoc/template/publish.js +13 -2
- package/lib/postcss-p/postcss-p.mjs +11 -0
- package/lib/scoping/missing-dependencies.js +65 -0
- package/lib/scoping/report-tags-usage.js +28 -0
- package/lib/serve/index.js +1 -1
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,105 @@
|
|
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.2.3](https://github.com/SAP/ui5-webcomponents/compare/v1.2.2...v1.2.3) (2022-03-23)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.2.2](https://github.com/SAP/ui5-webcomponents/compare/v1.2.1...v1.2.2) (2022-03-22)
|
15
|
+
|
16
|
+
|
17
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
## [1.2.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
|
24
|
+
|
25
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
# [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
|
32
|
+
|
33
|
+
|
34
|
+
### Bug Fixes
|
35
|
+
|
36
|
+
* correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
|
37
|
+
* display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
|
38
|
+
|
39
|
+
|
40
|
+
### Features
|
41
|
+
|
42
|
+
* **jsdoc:** remove attr name for Object props ([#4680](https://github.com/SAP/ui5-webcomponents/issues/4680)) ([1741bd6](https://github.com/SAP/ui5-webcomponents/commit/1741bd6)), closes [#4674](https://github.com/SAP/ui5-webcomponents/issues/4674)
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
|
49
|
+
|
50
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
|
57
|
+
|
58
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
# [1.1.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.2...v1.1.0) (2022-01-21)
|
65
|
+
|
66
|
+
|
67
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
## [1.0.2](https://github.com/SAP/ui5-webcomponents/compare/v1.0.1...v1.0.2) (2021-11-29)
|
74
|
+
|
75
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
## [1.0.1](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0...v1.0.1) (2021-11-10)
|
82
|
+
|
83
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
# [1.0.0](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.16...v1.0.0) (2021-11-10)
|
90
|
+
|
91
|
+
|
92
|
+
**Note:** Version bump only for package @ui5/webcomponents-tools
|
93
|
+
|
94
|
+
|
95
|
+
# [1.0.0-rc.16](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.15...v1.0.0-rc.16) (2021-11-09)
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
### Features
|
100
|
+
|
101
|
+
* **tools:** create an npm init script ([#4090](https://github.com/SAP/ui5-webcomponents/issues/4090)) ([5608e04](https://github.com/SAP/ui5-webcomponents/commit/5608e04))
|
102
|
+
|
103
|
+
|
104
|
+
|
6
105
|
# [1.0.0-rc.15](https://github.com/SAP/ui5-webcomponents/compare/v1.0.0-rc.14...v1.0.0-rc.15) (2021-07-23)
|
7
106
|
|
8
107
|
|
package/assets-meta.js
CHANGED
@@ -10,6 +10,9 @@ const assetsMeta = {
|
|
10
10
|
"sap_fiori_3_hcb",
|
11
11
|
"sap_fiori_3_hcw",
|
12
12
|
"sap_horizon",
|
13
|
+
"sap_horizon_dark",
|
14
|
+
"sap_horizon_hcb",
|
15
|
+
"sap_horizon_hcw",
|
13
16
|
"sap_horizon_exp"
|
14
17
|
]
|
15
18
|
},
|
@@ -133,6 +136,7 @@ const assetsMeta = {
|
|
133
136
|
"sk",
|
134
137
|
"sl",
|
135
138
|
"sr",
|
139
|
+
"sr_Latn",
|
136
140
|
"sv",
|
137
141
|
"th",
|
138
142
|
"tr",
|
@@ -29,7 +29,7 @@ const getScripts = (options) => {
|
|
29
29
|
templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
|
30
30
|
styles: {
|
31
31
|
default: "nps build.styles.themes build.styles.components",
|
32
|
-
themes: "postcss
|
32
|
+
themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
|
33
33
|
components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
|
34
34
|
},
|
35
35
|
i18n: {
|
@@ -7,7 +7,8 @@ const url = require("@rollup/plugin-url");
|
|
7
7
|
const { terser } = require("rollup-plugin-terser");
|
8
8
|
const json = require("@rollup/plugin-json");
|
9
9
|
const replace = require("@rollup/plugin-replace");
|
10
|
-
const
|
10
|
+
const commonjs = require("@rollup/plugin-commonjs");
|
11
|
+
const colors = require("cli-color");
|
11
12
|
const filesize = require("rollup-plugin-filesize");
|
12
13
|
const livereload = require("rollup-plugin-livereload");
|
13
14
|
const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
|
@@ -137,10 +138,11 @@ const getPlugins = ({ transpile }) => {
|
|
137
138
|
}
|
138
139
|
|
139
140
|
if (transpile) {
|
141
|
+
plugins.push(commonjs());
|
140
142
|
plugins.push(babel({
|
141
143
|
presets: ["@babel/preset-env"],
|
142
144
|
exclude: /node_modules\/(?!(lit-html|@ui5\/webcomponents))/, // exclude all node_modules/ except lit-html and all starting with @ui5/webcomponents
|
143
|
-
sourcemap:
|
145
|
+
sourcemap: false,
|
144
146
|
babelHelpers: "bundled",
|
145
147
|
}));
|
146
148
|
}
|
@@ -168,6 +168,21 @@ exports.config = {
|
|
168
168
|
}, this);
|
169
169
|
}, true);
|
170
170
|
|
171
|
+
await browser.addCommand("isFocusedDeepElement", async function (element) {
|
172
|
+
return browser.executeAsync(function (elem, element, done) {
|
173
|
+
let activeElement = document.activeElement;
|
174
|
+
|
175
|
+
while (activeElement.shadowRoot) {
|
176
|
+
if (activeElement.shadowRoot.activeElement) {
|
177
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
178
|
+
} else {
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
done(element === activeElement);
|
183
|
+
}, this, element);
|
184
|
+
}, true);
|
185
|
+
|
171
186
|
await browser.addCommand("setProperty", async function(property, value) {
|
172
187
|
return browser.executeAsync((elem, property, value, done) => {
|
173
188
|
elem[property] = value;
|
@@ -230,6 +245,7 @@ exports.config = {
|
|
230
245
|
"isExisting",
|
231
246
|
"isFocused",
|
232
247
|
"isFocusedDeep", // custom
|
248
|
+
"isFocusedDeepElement", // custom
|
233
249
|
"shadow$",
|
234
250
|
"shadow$$",
|
235
251
|
];
|
@@ -168,6 +168,21 @@ exports.config = {
|
|
168
168
|
}, this);
|
169
169
|
}, true);
|
170
170
|
|
171
|
+
browser.addCommand("isFocusedDeepElement", function (element) {
|
172
|
+
return browser.execute(function (elem, element, done) {
|
173
|
+
let activeElement = document.activeElement;
|
174
|
+
|
175
|
+
while (activeElement.shadowRoot) {
|
176
|
+
if (activeElement.shadowRoot.activeElement) {
|
177
|
+
activeElement = activeElement.shadowRoot.activeElement;
|
178
|
+
} else {
|
179
|
+
break;
|
180
|
+
}
|
181
|
+
}
|
182
|
+
done(element === activeElement);
|
183
|
+
}, this, element);
|
184
|
+
}, true);
|
185
|
+
|
171
186
|
browser.addCommand("setProperty", function(property, value) {
|
172
187
|
return browser.execute((elem, property, value) => {
|
173
188
|
return elem[property] = value;
|
@@ -223,6 +238,7 @@ exports.config = {
|
|
223
238
|
"isExisting",
|
224
239
|
"isFocused",
|
225
240
|
"isFocusedDeep", // custom
|
241
|
+
"isFocusedDeepElement", // custom
|
226
242
|
"shadow$",
|
227
243
|
"shadow$$",
|
228
244
|
];
|
@@ -38,10 +38,10 @@ export default { pathData, accData };`;
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
const collectionTemplate = (name) => `import {
|
41
|
+
const collectionTemplate = (name) => `import { isThemeFamily } from "@ui5/webcomponents-base/dist/config/Theme.js";
|
42
42
|
import pathDataV4 from "./v5/${name}.js";
|
43
43
|
import pathDataV5 from "./v4/${name}.js";
|
44
|
-
const pathData =
|
44
|
+
const pathData = isThemeFamily("sap_horizon") ? pathDataV5 : pathDataV4;
|
45
45
|
export default { pathData };`;
|
46
46
|
|
47
47
|
|
@@ -6,6 +6,51 @@ if (process.argv.length < 7) {
|
|
6
6
|
return;
|
7
7
|
}
|
8
8
|
|
9
|
+
const ORIGINAL_TEXTS = {
|
10
|
+
UnableToLoad: "UnableToLoad",
|
11
|
+
UnableToUpload: "UnableToUpload",
|
12
|
+
NoActivities: "NoActivities",
|
13
|
+
BeforeSearch: "BeforeSearch",
|
14
|
+
NoSearchResults: "NoSearchResults",
|
15
|
+
NoEntries: "NoEntries",
|
16
|
+
NoData: "NoData",
|
17
|
+
NoNotifications: "NoNotifications",
|
18
|
+
BalloonSky: "BalloonSky",
|
19
|
+
SuccessScreen: "SuccessScreen",
|
20
|
+
NoMail: "NoMail",
|
21
|
+
NoSavedItems: "NoSavedItems",
|
22
|
+
NoTasks: "NoTasks"
|
23
|
+
};
|
24
|
+
|
25
|
+
const FALLBACK_TEXTS = {
|
26
|
+
ReloadScreen: ORIGINAL_TEXTS.UnableToLoad,
|
27
|
+
Connection: ORIGINAL_TEXTS.UnableToLoad,
|
28
|
+
ErrorScreen: ORIGINAL_TEXTS.UnableToUpload,
|
29
|
+
EmptyCalendar: ORIGINAL_TEXTS.NoActivities,
|
30
|
+
SearchEarth: ORIGINAL_TEXTS.BeforeSearch,
|
31
|
+
SearchFolder: ORIGINAL_TEXTS.NoSearchResults,
|
32
|
+
EmptyList: ORIGINAL_TEXTS.NoEntries,
|
33
|
+
Tent: ORIGINAL_TEXTS.NoData,
|
34
|
+
SleepingBell: ORIGINAL_TEXTS.NoNotifications,
|
35
|
+
SimpleBalloon: ORIGINAL_TEXTS.BalloonSky,
|
36
|
+
SimpleBell: ORIGINAL_TEXTS.NoNotifications,
|
37
|
+
SimpleCalendar: ORIGINAL_TEXTS.NoActivities,
|
38
|
+
SimpleCheckMark: ORIGINAL_TEXTS.SuccessScreen,
|
39
|
+
SimpleConnection: ORIGINAL_TEXTS.UnableToLoad,
|
40
|
+
SimpleEmptyDoc: ORIGINAL_TEXTS.NoData,
|
41
|
+
SimpleEmptyList: ORIGINAL_TEXTS.NoEntries,
|
42
|
+
SimpleError: ORIGINAL_TEXTS.UnableToUpload,
|
43
|
+
SimpleMagnifier: ORIGINAL_TEXTS.BeforeSearch,
|
44
|
+
SimpleMail: ORIGINAL_TEXTS.NoMail,
|
45
|
+
SimpleNoSavedItems: ORIGINAL_TEXTS.NoSavedItems,
|
46
|
+
SimpleNotFoundMagnifier: ORIGINAL_TEXTS.NoSearchResults,
|
47
|
+
SimpleReload: ORIGINAL_TEXTS.UnableToLoad,
|
48
|
+
SimpleTask: ORIGINAL_TEXTS.NoTasks,
|
49
|
+
SuccessBalloon: ORIGINAL_TEXTS.BalloonSky,
|
50
|
+
SuccessCheckMark: ORIGINAL_TEXTS.SuccessScreen,
|
51
|
+
SuccessHighFive: ORIGINAL_TEXTS.BalloonSky
|
52
|
+
};
|
53
|
+
|
9
54
|
const srcPath = process.argv[2];
|
10
55
|
const defaultText = process.argv[3] === "true";
|
11
56
|
const illustrationsPrefix = process.argv[4];
|
@@ -24,21 +69,31 @@ const svgToJs = fileName => {
|
|
24
69
|
fs.writeFileSync(path.join(destPath, fileName), fileContent);
|
25
70
|
};
|
26
71
|
const illustrationImportTemplate = illustrationName => {
|
27
|
-
|
72
|
+
let illustrationNameForTranslation = illustrationName;
|
73
|
+
|
74
|
+
if (defaultText) {
|
75
|
+
if (FALLBACK_TEXTS[illustrationNameForTranslation]) {
|
76
|
+
illustrationNameForTranslation = FALLBACK_TEXTS[illustrationNameForTranslation];
|
77
|
+
} else if (illustrationName.indexOf("_v") !== -1) {
|
78
|
+
illustrationNameForTranslation = illustrationNameForTranslation.substr(0, illustrationNameForTranslation.indexOf('_v'));
|
79
|
+
}
|
80
|
+
}
|
28
81
|
|
82
|
+
const illustrationNameUpperCase = illustrationNameForTranslation.toUpperCase();
|
83
|
+
|
29
84
|
return defaultText ? `import { registerIllustration } from "@ui5/webcomponents-base/dist/asset-registries/Illustrations.js";
|
30
85
|
import dialogSvg from "./${illustrationsPrefix}-Dialog-${illustrationName}.js";
|
31
86
|
import sceneSvg from "./${illustrationsPrefix}-Scene-${illustrationName}.js";
|
32
87
|
import spotSvg from "./${illustrationsPrefix}-Spot-${illustrationName}.js";
|
33
88
|
import {
|
34
|
-
IM_TITLE_${
|
35
|
-
IM_SUBTITLE_${
|
89
|
+
IM_TITLE_${illustrationNameUpperCase},
|
90
|
+
IM_SUBTITLE_${illustrationNameUpperCase},
|
36
91
|
} from "../generated/i18n/i18n-defaults.js";
|
37
92
|
|
38
93
|
const name = "${illustrationName}";
|
39
94
|
const set = "${illustrationSet}";
|
40
|
-
const title = IM_TITLE_${
|
41
|
-
const subtitle = IM_SUBTITLE_${
|
95
|
+
const title = IM_TITLE_${illustrationNameUpperCase};
|
96
|
+
const subtitle = IM_SUBTITLE_${illustrationNameUpperCase};
|
42
97
|
|
43
98
|
registerIllustration(name, {
|
44
99
|
dialogSvg,
|
@@ -21,7 +21,9 @@ module.exports = {
|
|
21
21
|
{{/if}}
|
22
22
|
<br>
|
23
23
|
{{#if (toKebabCase this.name)}}
|
24
|
-
|
24
|
+
{{#unless this.noattribute}}
|
25
|
+
<code>{{toKebabCase this.name}}</code>
|
26
|
+
{{/unless}}
|
25
27
|
{{/if}}
|
26
28
|
</div>
|
27
29
|
<div class="cell api-table-content-cell">{{this.type}}</div>
|
@@ -23,6 +23,7 @@ module.exports = {
|
|
23
23
|
{{> properties this}}
|
24
24
|
{{> slots this}}
|
25
25
|
{{> events this}}
|
26
|
+
{{> methods this}}
|
26
27
|
{{> cssVariables this}}
|
27
28
|
</section>
|
28
29
|
</section>
|
@@ -33,6 +34,6 @@ module.exports = {
|
|
33
34
|
<a class="separator" href="https://www.sap.com/about/legal/privacy.html" target="_blank">Privacy Policy</a>
|
34
35
|
<a href="https://www.sap.com/about/legal/impressum.html" target="_blank">Legal</a>
|
35
36
|
</div>
|
36
|
-
<img src="
|
37
|
+
<img src="../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
|
37
38
|
</footer>`
|
38
39
|
};
|
@@ -30,7 +30,16 @@ const hbs2lit = (file) => {
|
|
30
30
|
lv.accept(ast);
|
31
31
|
|
32
32
|
for (let key in lv.blocks) {
|
33
|
-
|
33
|
+
let block = lv.blocks[key];
|
34
|
+
|
35
|
+
if (block.match(/scopeTag/)) {
|
36
|
+
const matches = block.match(/^(.*?)( => )(.*?);$/);
|
37
|
+
const scopedCode = matches[3];
|
38
|
+
const normalCode = scopedCode.replace(/\${scopeTag\("/g, "").replace(/", tags, suffix\)}/g, "");
|
39
|
+
block = `${matches[1]}${matches[2]}suffix ? ${scopedCode} : ${normalCode};`;
|
40
|
+
}
|
41
|
+
|
42
|
+
result += block + "\n";
|
34
43
|
}
|
35
44
|
|
36
45
|
result = svgProcessor.process(result);
|
package/lib/jsdoc/plugin.js
CHANGED
@@ -33,6 +33,8 @@
|
|
33
33
|
*
|
34
34
|
* native
|
35
35
|
*
|
36
|
+
* noattribute
|
37
|
+
*
|
36
38
|
* allowPreventDefault
|
37
39
|
*
|
38
40
|
* It furthermore listens to the following JSDoc3 events to implement additional functionality
|
@@ -2099,6 +2101,13 @@ exports.defineTags = function(dictionary) {
|
|
2099
2101
|
doclet.native = true;
|
2100
2102
|
}
|
2101
2103
|
});
|
2104
|
+
|
2105
|
+
dictionary.defineTag('noattribute', {
|
2106
|
+
mustHaveValue: false,
|
2107
|
+
onTagged: function(doclet, tag) {
|
2108
|
+
doclet.noattribute = true;
|
2109
|
+
}
|
2110
|
+
});
|
2102
2111
|
};
|
2103
2112
|
|
2104
2113
|
exports.handlers = {
|
@@ -2804,6 +2804,10 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
|
|
2804
2804
|
attrib("export", undefined, '', true);
|
2805
2805
|
}
|
2806
2806
|
|
2807
|
+
if (member.noattribute) {
|
2808
|
+
attrib("noattribute", true);
|
2809
|
+
}
|
2810
|
+
|
2807
2811
|
if (member.readonly) {
|
2808
2812
|
attrib("readonly", member.readonly, null);
|
2809
2813
|
}
|
@@ -2815,7 +2819,14 @@ function createAPIJSON4Symbol(symbol, omitDefaults) {
|
|
2815
2819
|
if ( member.since ) {
|
2816
2820
|
attrib("since", extractVersion(member.since));
|
2817
2821
|
}
|
2818
|
-
|
2822
|
+
|
2823
|
+
var type = listTypes(member.type);
|
2824
|
+
attrib("type", type);
|
2825
|
+
|
2826
|
+
if ((type === "object" || type === "Object") && visibility(member) === "public") {
|
2827
|
+
attrib("noattribute", true);
|
2828
|
+
}
|
2829
|
+
|
2819
2830
|
tag("description", normalizeWS(member.description), true);
|
2820
2831
|
if (member.defaultvalue) {
|
2821
2832
|
attrib("defaultValue", member.defaultvalue);
|
@@ -3854,7 +3865,7 @@ function createAPIJS(symbols, filename) {
|
|
3854
3865
|
|
3855
3866
|
var output = [];
|
3856
3867
|
|
3857
|
-
var rkeywords = /^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|is|long|namespace|native|new|null|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|use|var|void|volatile|while|with)$/;
|
3868
|
+
var rkeywords = /^(?:abstract|as|boolean|break|byte|case|catch|char|class|continue|const|debugger|default|delete|do|double|else|enum|export|extends|false|final|finally|float|for|function|goto|if|implements|import|in|instanceof|int|interface|is|long|namespace|native|new|null|noattribute|package|private|protected|public|return|short|static|super|switch|synchronized|this|throw|throws|transient|true|try|typeof|use|var|void|volatile|while|with)$/;
|
3858
3869
|
|
3859
3870
|
function isNoKeyword($) { return !rkeywords.test($.name); }
|
3860
3871
|
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import 'zx/globals';
|
2
|
+
|
3
|
+
const inputFiles = await globby("src/**/parameters-bundle.css");
|
4
|
+
|
5
|
+
const restArgs = process.argv.slice(2);
|
6
|
+
|
7
|
+
// run all postcss processes in parallel as passing the glob directly to postcss makes them processed sequentially.
|
8
|
+
// and the amount of imports give a big speed up when run in parallel
|
9
|
+
await Promise.all(inputFiles.map(file => {
|
10
|
+
return $`postcss ${file} --config config/postcss.themes --base src --dir dist/css/ ${restArgs}`;
|
11
|
+
}));
|
@@ -0,0 +1,65 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const glob = require("glob");
|
3
|
+
const path = require("path");
|
4
|
+
const process = require("process");
|
5
|
+
|
6
|
+
const projectPath = process.argv[2];
|
7
|
+
|
8
|
+
// gather all tags from all files
|
9
|
+
const tagsToFiles = new Map();
|
10
|
+
const filesToTags = new Map();
|
11
|
+
|
12
|
+
let files = [
|
13
|
+
...glob.sync(path.join("packages/main/src/**/*.js")),
|
14
|
+
...glob.sync(path.join("packages/fiori/src/**/*.js")),
|
15
|
+
];
|
16
|
+
files.forEach(file => {
|
17
|
+
let matches = file.match(/([a-zA-Z0-9_]+)\.js$/);
|
18
|
+
const name = matches[1];
|
19
|
+
|
20
|
+
const content = `${fs.readFileSync(file)}`;
|
21
|
+
matches = content.match(/tag: "(.*?)",/);
|
22
|
+
if (matches) {
|
23
|
+
const tag = matches[1];
|
24
|
+
tagsToFiles.set(tag, name);
|
25
|
+
filesToTags.set(name, tag);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
|
29
|
+
// Process the package
|
30
|
+
files = glob.sync(path.join(projectPath, "src/**/*.js"));
|
31
|
+
tagsToFiles.forEach((file, tag) => {
|
32
|
+
const sourcePath = path.join(projectPath, "src/", `${file}.js`);
|
33
|
+
if (!fs.existsSync(sourcePath)) {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
const sourceContent = `${fs.readFileSync(sourcePath)}`.split("\n").join(" ");
|
37
|
+
|
38
|
+
const hbsPath = path.join(projectPath, "src/", `${file}.hbs`);
|
39
|
+
const hbsContent = fs.existsSync(hbsPath) ? `${fs.readFileSync(hbsPath)}` : "";
|
40
|
+
|
41
|
+
const hbsPopoverPath = path.join(projectPath, "src/", `${file}Popover.hbs`);
|
42
|
+
const hbsPopoverContent = fs.existsSync(hbsPopoverPath) ? `${fs.readFileSync(hbsPopoverPath)}` : "";
|
43
|
+
|
44
|
+
// deps
|
45
|
+
let deps = [];
|
46
|
+
let matches = sourceContent.match(/static get dependencies\(\) \{\s+return \[(.*?)\]/);
|
47
|
+
if (matches) {
|
48
|
+
deps = matches[1].split(",").map(x => x.trim()).filter(x => !!x);
|
49
|
+
}
|
50
|
+
|
51
|
+
// tags
|
52
|
+
matches = [
|
53
|
+
...hbsContent.matchAll(/<ui5-[a-z0-9-]+/g),
|
54
|
+
...hbsPopoverContent.matchAll(/<ui5-[a-z0-9-]+/g),
|
55
|
+
];
|
56
|
+
if (matches) {
|
57
|
+
matches.forEach(match => {
|
58
|
+
const tagUsed = match[0].substr(1);
|
59
|
+
const dep = tagsToFiles.get(tagUsed);
|
60
|
+
if (!deps.includes(dep)) {
|
61
|
+
console.log(`${file} used ${tagUsed}`);
|
62
|
+
}
|
63
|
+
});
|
64
|
+
}
|
65
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const glob = require("glob");
|
3
|
+
const path = require("path");
|
4
|
+
const process = require("process");
|
5
|
+
|
6
|
+
// gather all tags from all files
|
7
|
+
const tags = new Set();
|
8
|
+
const files = glob.sync(path.join(process.argv[2], "src/**/*.js"));
|
9
|
+
files.forEach(file => {
|
10
|
+
const content = `${fs.readFileSync(file)}`;
|
11
|
+
const matches = content.match(/tag: "(.*?)",/);
|
12
|
+
if (matches) {
|
13
|
+
tags.add(matches[1]);
|
14
|
+
}
|
15
|
+
});
|
16
|
+
|
17
|
+
// report all usages of any tag within any file, which is not the tag definition and is not hasAttribute
|
18
|
+
files.forEach(file => {
|
19
|
+
const content = `${fs.readFileSync(file)}`;
|
20
|
+
const lines = content.split("\n");
|
21
|
+
lines.forEach(line => {
|
22
|
+
tags.forEach(tag => {
|
23
|
+
if (line.includes(`"${tag}"`) && !line.includes(`tag: "${tag}",`) && !line.includes(`hasAttribute("${tag}")`)) {
|
24
|
+
console.log(`${file}: ${line.trim()}`);
|
25
|
+
}
|
26
|
+
});
|
27
|
+
});
|
28
|
+
});
|
package/lib/serve/index.js
CHANGED
@@ -2,7 +2,7 @@ const fs = require("fs");
|
|
2
2
|
const path = require("path");
|
3
3
|
const commandLineArgs = require("command-line-args");
|
4
4
|
const { exec } = require("child_process");
|
5
|
-
const colors = require("
|
5
|
+
const colors = require("cli-color");
|
6
6
|
const isPortReachable = require("is-port-reachable");
|
7
7
|
|
8
8
|
const options = commandLineArgs([
|
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-deac3098a",
|
4
4
|
"description": "UI5 Web Components: webcomponents.tools",
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
6
6
|
"license": "Apache-2.0",
|
@@ -25,6 +25,7 @@
|
|
25
25
|
"@babel/preset-env": "^7.13.10",
|
26
26
|
"@openui5/sap.ui.core": "1.95.0",
|
27
27
|
"@rollup/plugin-babel": "^5.3.0",
|
28
|
+
"@rollup/plugin-commonjs": "^21.0.1",
|
28
29
|
"@rollup/plugin-json": "^4.1.0",
|
29
30
|
"@rollup/plugin-node-resolve": "^13.0.5",
|
30
31
|
"@rollup/plugin-replace": "^3.0.0",
|
@@ -39,7 +40,7 @@
|
|
39
40
|
"child_process": "^1.0.2",
|
40
41
|
"chokidar": "^3.5.1",
|
41
42
|
"chokidar-cli": "^3.0.0",
|
42
|
-
"
|
43
|
+
"cli-color": "^2.0.1",
|
43
44
|
"command-line-args": "^5.1.1",
|
44
45
|
"concurrently": "^6.0.0",
|
45
46
|
"cross-env": "^7.0.3",
|
@@ -59,10 +60,10 @@
|
|
59
60
|
"json-beautify": "^1.1.1",
|
60
61
|
"mkdirp": "^1.0.4",
|
61
62
|
"nps": "^5.10.0",
|
62
|
-
"postcss": "^8.
|
63
|
-
"postcss-cli": "^9.0
|
63
|
+
"postcss": "^8.4.5",
|
64
|
+
"postcss-cli": "^9.1.0",
|
64
65
|
"postcss-combine-duplicated-selectors": "^10.0.3",
|
65
|
-
"postcss-import": "^14.0.
|
66
|
+
"postcss-import": "^14.0.2",
|
66
67
|
"properties-reader": "^2.2.0",
|
67
68
|
"recursive-readdir": "^2.2.2",
|
68
69
|
"resolve": "^1.20.0",
|
@@ -73,7 +74,8 @@
|
|
73
74
|
"rollup-plugin-terser": "^7.0.2",
|
74
75
|
"serve": "^12.0.0",
|
75
76
|
"slash": "3.0.0",
|
76
|
-
"wdio-chromedriver-service": "^7.0.0"
|
77
|
+
"wdio-chromedriver-service": "^7.0.0",
|
78
|
+
"zx": "^4.3.0"
|
77
79
|
},
|
78
80
|
"peerDependencies": {
|
79
81
|
"chromedriver": "*"
|