@ui5/webcomponents-tools 1.1.1 → 1.2.1

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 CHANGED
@@ -3,6 +3,39 @@
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.1](https://github.com/SAP/ui5-webcomponents/compare/v1.2.0...v1.2.1) (2022-03-02)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
14
+ # [1.2.0](https://github.com/SAP/ui5-webcomponents/compare/v1.1.2...v1.2.0) (2022-02-28)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * correct scoping issues with several components ([#4820](https://github.com/SAP/ui5-webcomponents/issues/4820)) ([621dc20](https://github.com/SAP/ui5-webcomponents/commit/621dc20))
20
+ * display methods in child components API ([#4792](https://github.com/SAP/ui5-webcomponents/issues/4792)) ([1929d08](https://github.com/SAP/ui5-webcomponents/commit/1929d08))
21
+
22
+
23
+ ### Features
24
+
25
+ * **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)
26
+
27
+
28
+
29
+
30
+
31
+ ## [1.1.2](https://github.com/SAP/ui5-webcomponents/compare/v1.1.1...v1.1.2) (2022-01-26)
32
+
33
+ **Note:** Version bump only for package @ui5/webcomponents-tools
34
+
35
+
36
+
37
+
38
+
6
39
  ## [1.1.1](https://github.com/SAP/ui5-webcomponents/compare/v1.1.0...v1.1.1) (2022-01-24)
7
40
 
8
41
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -8,7 +8,7 @@ const { terser } = require("rollup-plugin-terser");
8
8
  const json = require("@rollup/plugin-json");
9
9
  const replace = require("@rollup/plugin-replace");
10
10
  const commonjs = require("@rollup/plugin-commonjs");
11
- const colors = require("colors/safe");
11
+ const colors = require("cli-color");
12
12
  const filesize = require("rollup-plugin-filesize");
13
13
  const livereload = require("rollup-plugin-livereload");
14
14
  const emptyModulePlugin = require("./rollup-plugins/empty-module.js");
@@ -21,7 +21,9 @@ module.exports = {
21
21
  {{/if}}
22
22
  <br>
23
23
  {{#if (toKebabCase this.name)}}
24
- <code>{{toKebabCase this.name}}</code>
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 +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
- attrib("type", listTypes(member.type));
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,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
+ });
@@ -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("colors/safe");
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": "1.1.1",
3
+ "version": "1.2.1",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -40,7 +40,7 @@
40
40
  "child_process": "^1.0.2",
41
41
  "chokidar": "^3.5.1",
42
42
  "chokidar-cli": "^3.0.0",
43
- "colors": "^1.4.0",
43
+ "cli-color": "^2.0.1",
44
44
  "command-line-args": "^5.1.1",
45
45
  "concurrently": "^6.0.0",
46
46
  "cross-env": "^7.0.3",
@@ -60,10 +60,10 @@
60
60
  "json-beautify": "^1.1.1",
61
61
  "mkdirp": "^1.0.4",
62
62
  "nps": "^5.10.0",
63
- "postcss": "^8.2.10",
64
- "postcss-cli": "^9.0.1",
63
+ "postcss": "^8.4.5",
64
+ "postcss-cli": "^9.1.0",
65
65
  "postcss-combine-duplicated-selectors": "^10.0.3",
66
- "postcss-import": "^14.0.0",
66
+ "postcss-import": "^14.0.2",
67
67
  "properties-reader": "^2.2.0",
68
68
  "recursive-readdir": "^2.2.2",
69
69
  "resolve": "^1.20.0",