@ui5/webcomponents-tools 0.0.0-8db0ce01a → 0.0.0-a3eca7ade

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/README.md +1 -1
  3. package/assets-meta.js +3 -1
  4. package/components-package/nps.js +10 -4
  5. package/components-package/postcss.themes.js +5 -2
  6. package/components-package/rollup-plugins/empty-module.js +15 -0
  7. package/components-package/rollup.js +52 -8
  8. package/components-package/wdio.js +50 -25
  9. package/components-package/wdio.sync.js +360 -0
  10. package/icons-collection/nps.js +42 -8
  11. package/lib/copy-list/index.js +28 -0
  12. package/lib/create-icons/index.js +20 -6
  13. package/lib/create-illustrations/index.js +150 -0
  14. package/lib/create-new-component/index.js +12 -4
  15. package/lib/documentation/templates/api-properties-section.js +3 -1
  16. package/lib/documentation/templates/template.js +2 -1
  17. package/lib/esm-abs-to-rel/index.js +54 -0
  18. package/lib/hbs2lit/src/litVisitor2.js +31 -6
  19. package/lib/hbs2lit/src/svgProcessor.js +3 -3
  20. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +4 -11
  21. package/lib/jsdoc/plugin.js +9 -0
  22. package/lib/jsdoc/template/publish.js +13 -2
  23. package/lib/postcss-css-to-esm/index.js +4 -4
  24. package/lib/postcss-css-to-json/index.js +7 -2
  25. package/lib/replace-global-core/index.js +20 -0
  26. package/lib/scoping/lint-src.js +1 -1
  27. package/lib/scoping/missing-dependencies.js +65 -0
  28. package/lib/scoping/report-tags-usage.js +28 -0
  29. package/lib/serve/index.js +1 -1
  30. package/package.json +23 -29
  31. package/bin/init-ui5-package.js +0 -3
  32. package/lib/init-package/index.js +0 -123
  33. package/lib/init-package/resources/.eslintignore +0 -3
  34. package/lib/init-package/resources/bundle.es5.js +0 -25
  35. package/lib/init-package/resources/bundle.esm.js +0 -31
  36. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  37. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  38. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  39. package/lib/init-package/resources/config/rollup.config.js +0 -1
  40. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  41. package/lib/init-package/resources/package-scripts.js +0 -11
  42. package/lib/init-package/resources/src/Assets.js +0 -5
  43. package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
  44. package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
  45. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  46. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  47. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  48. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  49. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  50. package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
  51. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  52. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  53. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  54. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  55. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  56. package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  57. package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  58. package/lib/init-package/resources/test/pages/index.html +0 -56
  59. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
@@ -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 +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="../../../../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
37
+ <img src="../../../assets/images/sap-logo-svg.svg" alt="Sap Logo" />
37
38
  </footer>`
38
39
  };
@@ -0,0 +1,54 @@
1
+ const esprima = require("esprima");
2
+ const escodegen = require("escodegen");
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const glob = require("glob");
7
+ const basePath = process.argv[2];
8
+
9
+ const convertImports = (srcPath) => {
10
+ let changed = false;
11
+ // console.log("scanning imports of", srcPath);
12
+ let code = fs.readFileSync(srcPath).toString();
13
+ const tree = esprima.parseModule(code);
14
+ const importer = srcPath.replace(basePath, "");
15
+ const importerDir = path.dirname(importer);
16
+ // console.log("-> ", importer);
17
+ tree.body.forEach(node => {
18
+ if (node.type === "ImportDeclaration") {
19
+ let importee = node.source.value;
20
+ if (importee.startsWith(".")) {
21
+ // add .js extension if missing
22
+ if (!importee.endsWith(".js")) {
23
+ node.source.value += ".js"
24
+ changed = true;
25
+ }
26
+ return;
27
+ }
28
+ let importeeDir = path.dirname(importee);
29
+ let importeeFile = path.basename(importee);
30
+ let relativePath = path.relative(importerDir, importeeDir);
31
+ if (relativePath.length === 0) {
32
+ relativePath = "."
33
+ }
34
+ if (!relativePath.startsWith(".")) {
35
+ relativePath = "./" + relativePath;
36
+ }
37
+
38
+ relativePath = relativePath.replace(/\\/g, "/"); // the browser expects unix paths
39
+ let relativeImport = `${relativePath}/${importeeFile}.js`;
40
+ // console.log(importee + " --> " + relativeImport);
41
+ node.source.value = relativeImport;
42
+ changed = true;
43
+ }
44
+ });
45
+
46
+ if (changed) {
47
+ fs.writeFileSync(srcPath, escodegen.generate(tree));
48
+ }
49
+ }
50
+
51
+ const fileNames = glob.sync(basePath + "**/*.js");
52
+ // console.log(fileNames);
53
+ fileNames.forEach(convertImports);
54
+ console.log("Success: Converted absolute imports to relative for files in:", basePath)
@@ -8,9 +8,26 @@ let skipIfDefined = false;
8
8
  // when true => an HTML node value, when false => an attribute value
9
9
  let isNodeValue = false;
10
10
 
11
+ // when true => the current attribute is "style"
12
+ let isStyleAttribute = false;
13
+
11
14
  // matches event handlers @click= and boolean attrs ?disabled=
12
15
  const dynamicAttributeRgx = /\s(\?|@)([a-zA-Z|-]+)="?\s*$/;
13
16
 
17
+ if (!String.prototype.replaceAll) {
18
+ String.prototype.replaceAll = function(str, newStr){
19
+
20
+ // If a regex pattern
21
+ if (Object.prototype.toString.call(str).toLowerCase() === '[object regexp]') {
22
+ return this.replace(str, newStr);
23
+ }
24
+
25
+ // If a string
26
+ return this.replace(new RegExp(str, 'g'), newStr);
27
+
28
+ };
29
+ }
30
+
14
31
  function HTMLLitVisitor(debug) {
15
32
  this.blockCounter = 0;
16
33
  this.keys = [];
@@ -18,7 +35,7 @@ function HTMLLitVisitor(debug) {
18
35
  this.result = "";
19
36
  this.mainBlock = "";
20
37
  this.blockPath = "context";
21
- this.blockParameters = ["context"];
38
+ this.blockParameters = ["context", "tags", "suffix"];
22
39
  this.paths = []; //contains all normalized relative paths
23
40
  this.debug = debug;
24
41
  if (this.debug) {
@@ -34,7 +51,7 @@ HTMLLitVisitor.prototype.Program = function(program) {
34
51
  this.keys.push(key);
35
52
  this.debug && this.blockByNumber.push(key);
36
53
 
37
- this.blocks[this.currentKey()] = "const " + this.currentKey() + " = (" + this.blockParameters.join(", ") + ") => { return ";
54
+ this.blocks[this.currentKey()] = "const " + this.currentKey() + " = (" + this.blockParameters.join(", ") + ") => ";
38
55
 
39
56
  if (this.keys.length > 1) { //it's a nested block
40
57
  this.blocks[this.prevKey()] += this.currentKey() + "(" + this.blockParameters.join(", ") + ")";
@@ -45,7 +62,7 @@ HTMLLitVisitor.prototype.Program = function(program) {
45
62
 
46
63
  this.blocks[this.currentKey()] += "html`";
47
64
  Visitor.prototype.Program.call(this, program);
48
- this.blocks[this.currentKey()] += "`; };";
65
+ this.blocks[this.currentKey()] += "`;";
49
66
 
50
67
  this.keys.pop(key);
51
68
  };
@@ -54,7 +71,7 @@ HTMLLitVisitor.prototype.ContentStatement = function(content) {
54
71
  Visitor.prototype.ContentStatement.call(this, content);
55
72
  // let content = content.orgiinal; // attribute="__ attribute = "__ attribute ="__
56
73
 
57
- const contentStatement = content.original;
74
+ let contentStatement = content.original;
58
75
  skipIfDefined = !!dynamicAttributeRgx.exec(contentStatement);
59
76
 
60
77
  const closingIndex = contentStatement.lastIndexOf(">");
@@ -63,6 +80,15 @@ HTMLLitVisitor.prototype.ContentStatement = function(content) {
63
80
  isNodeValue = closingIndex > openingIndex;
64
81
  }
65
82
 
83
+ isStyleAttribute = !isNodeValue && contentStatement.match(/style *= *["']? *$/);
84
+
85
+ if (!isStyleAttribute && contentStatement.match(/style=/)) {
86
+ console.log("WARNING: style hard-coded", contentStatement);
87
+ }
88
+
89
+ // Scope custom element tags
90
+ contentStatement = contentStatement.replaceAll(/(<\/?\s*)([a-zA-Z0-9_]+-[a-zA-Z0-9_-]+)/g, "$1\${scopeTag(\"$2\", tags, suffix)}");
91
+
66
92
  this.blocks[this.currentKey()] += contentStatement;
67
93
  };
68
94
 
@@ -74,7 +100,6 @@ HTMLLitVisitor.prototype.MustacheStatement = function(mustache) {
74
100
  } else {
75
101
  const path = normalizePath.call(this, mustache.path.original);
76
102
  const hasCalculatingClasses = path.includes("context.classes");
77
- const hasStylesCalculation = path.includes("context.styles");
78
103
 
79
104
  let parsedCode = "";
80
105
 
@@ -82,7 +107,7 @@ HTMLLitVisitor.prototype.MustacheStatement = function(mustache) {
82
107
  parsedCode = `\${unsafeHTML(${path})}`;
83
108
  } else if (hasCalculatingClasses) {
84
109
  parsedCode = `\${classMap(${path})}`;
85
- } else if (hasStylesCalculation) {
110
+ } else if (isStyleAttribute) {
86
111
  parsedCode = `\${styleMap(${path})}`;
87
112
  } else if (skipIfDefined){
88
113
  parsedCode = `\${${path}}`;
@@ -46,8 +46,8 @@ function getSVGMatches(template) {
46
46
 
47
47
  function getSVGBlock(input, blockCounter) {
48
48
  return {
49
- usage: `\${blockSVG${blockCounter}(context)}`,
50
- definition: `\nconst blockSVG${blockCounter} = (context) => {return svg\`${input}\`};`,
49
+ usage: `\${blockSVG${blockCounter}(context, tags, suffix)}`,
50
+ definition: `\nconst blockSVG${blockCounter} = (context, tags, suffix) => svg\`${input}\`;`,
51
51
  };
52
52
  }
53
53
 
@@ -55,7 +55,7 @@ function replaceInternalBlocks(template, svgContent) {
55
55
  const internalBlocks = svgContent.match(blockrx) || [];
56
56
 
57
57
  internalBlocks.forEach(blockName => {
58
- const rx = new RegExp(`const ${blockName}.*(html\`).*};`);
58
+ const rx = new RegExp(`const ${blockName}.*(html\`).*;`);
59
59
  template = template.replace(rx, (match, p1) => {
60
60
  return match.replace(p1, "svg\`");
61
61
  });
@@ -1,17 +1,10 @@
1
1
  const buildRenderer = (controlName, litTemplate) => {
2
- return `
3
- /* eslint no-unused-vars: 0 */
4
- import ifDefined from '@ui5/webcomponents-base/dist/renderer/ifDefined.js';
5
- import { html, svg, repeat, classMap, styleMap, unsafeHTML, setTags, setSuffix } from '@ui5/webcomponents-base/dist/renderer/LitRenderer.js';
2
+ return `/* eslint no-unused-vars: 0 */
3
+ import { html, svg, repeat, classMap, styleMap, ifDefined, unsafeHTML, scopeTag } from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
4
+
6
5
  ${litTemplate}
7
6
 
8
- const main = (context, tags, suffix) => {
9
- setTags(tags);
10
- setSuffix(suffix);
11
- return block0(context);
12
- };
13
-
14
- export default main;`
7
+ export default block0;`;
15
8
  };
16
9
 
17
10
  module.exports = {
@@ -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
 
@@ -8,10 +8,10 @@ const DEFAULT_THEME = assets.themes.default;
8
8
  const getDefaultThemeCode = packageName => {
9
9
  return `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
10
10
 
11
- import defaultThemeBase from "@ui5/webcomponents-theme-base/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
11
+ import defaultThemeBase from "@ui5/webcomponents-theming/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
12
12
  import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
13
13
 
14
- registerThemePropertiesLoader("@ui5/webcomponents-theme-base", "${DEFAULT_THEME}", () => defaultThemeBase);
14
+ registerThemePropertiesLoader("@ui5/webcomponents-theming", "${DEFAULT_THEME}", () => defaultThemeBase);
15
15
  registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", () => defaultTheme);
16
16
  `;
17
17
  };
@@ -38,8 +38,8 @@ module.exports = function (opts) {
38
38
 
39
39
  const filePath = `${targetFile}.js`;
40
40
  const defaultTheme = opts.includeDefaultTheme ? getDefaultThemeCode(opts.packageName) : ``;
41
- fs.writeFileSync(filePath, `${defaultTheme}export default ${css};`);
41
+ fs.writeFileSync(filePath, `${defaultTheme}export default {packageName:"${opts.packageName}",fileName:"${targetFile.substr(targetFile.lastIndexOf("themes"))}",content:${css}}`);
42
42
  }
43
43
  };
44
44
  };
45
- module.exports.postcss = true;
45
+ module.exports.postcss = true;
@@ -23,9 +23,14 @@ module.exports = function (opts) {
23
23
  mkdirp.sync(path.dirname(targetFile));
24
24
 
25
25
  const filePath = `${targetFile}.json`;
26
- fs.writeFileSync(filePath, JSON.stringify({_: css}));
26
+ const data = {
27
+ packageName: opts.packageName,
28
+ fileName: targetFile.substr(targetFile.lastIndexOf("themes")),
29
+ content: css
30
+ };
31
+ fs.writeFileSync(filePath, JSON.stringify({_: data}));
27
32
  }
28
33
  };
29
34
  };
30
35
 
31
- module.exports.postcss = true;
36
+ module.exports.postcss = true;
@@ -0,0 +1,20 @@
1
+ const fs = require("fs");
2
+ const glob = require("glob");
3
+
4
+ const basePath = process.argv[2];
5
+
6
+ const replaceGlobalCoreUsage = (srcPath) => {
7
+
8
+ const original = fs.readFileSync(srcPath).toString();
9
+ let replaced = original.replace(/sap\.ui\.getCore\(\)/g, `Core`);
10
+
11
+ if (original !== replaced) {
12
+ replaced = `import Core from 'sap/ui/core/Core';
13
+ ${replaced}`;
14
+ fs.writeFileSync(srcPath, replaced);
15
+ }
16
+ };
17
+
18
+ const fileNames = glob.sync(basePath + "**/*.js");
19
+ fileNames.forEach(replaceGlobalCoreUsage);
20
+ console.log("Success: Replaced global core usage in:", basePath);
@@ -10,7 +10,7 @@ const errors = [];
10
10
  glob.sync(path.join(process.cwd(), "src/**/*.css")).forEach(file => {
11
11
  let content = String(fs.readFileSync(file));
12
12
  tags.forEach(tag => {
13
- if (content.match(new RegExp(`(^|[^\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
13
+ if (content.match(new RegExp(`(^|[^\.\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
14
14
  errors.push(`Warning! ${tag} found in ${file}`);
15
15
  }
16
16
  });
@@ -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": "0.0.0-8db0ce01a",
3
+ "version": "0.0.0-a3eca7ade",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -13,8 +13,7 @@
13
13
  "scripts": {},
14
14
  "bin": {
15
15
  "wc-dev": "bin/dev.js",
16
- "wc-create-ui5-element": "bin/create-ui5-element.js",
17
- "wc-init-ui5-package": "bin/init-ui5-package.js"
16
+ "wc-create-ui5-element": "bin/create-ui5-element.js"
18
17
  },
19
18
  "repository": {
20
19
  "type": "git",
@@ -22,31 +21,30 @@
22
21
  "directory": "packages/tools"
23
22
  },
24
23
  "dependencies": {
25
- "@babel/cli": "^7.13.10",
26
24
  "@babel/core": "^7.13.10",
27
- "@babel/plugin-proposal-object-rest-spread": "^7.13.8",
28
25
  "@babel/preset-env": "^7.13.10",
26
+ "@openui5/sap.ui.core": "1.95.0",
29
27
  "@rollup/plugin-babel": "^5.3.0",
28
+ "@rollup/plugin-commonjs": "^21.0.1",
30
29
  "@rollup/plugin-json": "^4.1.0",
31
- "@rollup/plugin-node-resolve": "^11.2.0",
30
+ "@rollup/plugin-node-resolve": "^13.0.5",
31
+ "@rollup/plugin-replace": "^3.0.0",
32
32
  "@rollup/plugin-url": "^6.0.0",
33
- "@wdio/cli": "^7.2.0",
34
- "@wdio/dot-reporter": "^7.2.0",
35
- "@wdio/local-runner": "^7.2.0",
36
- "@wdio/mocha-framework": "^7.2.0",
37
- "@wdio/spec-reporter": "^7.2.0",
38
- "@wdio/sync": "^7.2.0",
33
+ "@wdio/cli": "^7.12.2",
34
+ "@wdio/dot-reporter": "^7.10.1",
35
+ "@wdio/local-runner": "^7.12.2",
36
+ "@wdio/mocha-framework": "^7.12.2",
37
+ "@wdio/spec-reporter": "^7.10.1",
39
38
  "@webcomponents/webcomponentsjs": "^2.5.0",
40
39
  "chai": "^4.3.4",
41
40
  "child_process": "^1.0.2",
42
41
  "chokidar": "^3.5.1",
43
- "chokidar-cli": "^2.1.0",
44
- "clean-css": "^5.1.1",
45
- "colors": "^1.4.0",
42
+ "chokidar-cli": "^3.0.0",
43
+ "cli-color": "^2.0.1",
46
44
  "command-line-args": "^5.1.1",
47
45
  "concurrently": "^6.0.0",
48
46
  "cross-env": "^7.0.3",
49
- "cssnano": "^4.1.10",
47
+ "cssnano": "^4.1.11",
50
48
  "escodegen": "^2.0.0",
51
49
  "eslint": "^7.22.0",
52
50
  "eslint-config-airbnb-base": "^14.2.1",
@@ -55,33 +53,29 @@
55
53
  "folder-hash": "^4.0.1",
56
54
  "getopts": "^2.3.0",
57
55
  "glob": "^7.1.6",
56
+ "glob-parent": "^6.0.2",
58
57
  "handlebars": "^4.7.7",
59
- "is-port-reachable": "^3.0.0",
58
+ "is-port-reachable": "^3.1.0",
60
59
  "jsdoc": "^3.6.6",
61
60
  "json-beautify": "^1.1.1",
62
61
  "mkdirp": "^1.0.4",
63
- "npm-run-all": "^4.1.3",
64
62
  "nps": "^5.10.0",
65
- "postcss": "^8.2.8",
66
- "postcss-cli": "^8.3.1",
67
- "postcss-combine-duplicated-selectors": "^10.0.2",
68
- "postcss-import": "^14.0.0",
63
+ "postcss": "^8.4.5",
64
+ "postcss-cli": "^9.1.0",
65
+ "postcss-combine-duplicated-selectors": "^10.0.3",
66
+ "postcss-import": "^14.0.2",
69
67
  "properties-reader": "^2.2.0",
70
- "puppeteer": "^8.0.0",
71
68
  "recursive-readdir": "^2.2.2",
69
+ "resolve": "^1.20.0",
72
70
  "rimraf": "^3.0.2",
73
71
  "rollup": "^2.41.4",
74
72
  "rollup-plugin-filesize": "^9.1.1",
75
73
  "rollup-plugin-livereload": "^2.0.0",
76
- "rollup-plugin-notify": "^1.1.0",
77
- "rollup-plugin-string": "^3.0.0",
78
74
  "rollup-plugin-terser": "^7.0.2",
79
- "rollup-plugin-visualizer": "^4.2.0",
75
+ "serve": "^12.0.0",
76
+ "slash": "3.0.0",
80
77
  "wdio-chromedriver-service": "^7.0.0"
81
78
  },
82
- "optionalDependencies": {
83
- "serve": "git://github.com/vercel/serve.git#a85bd9d03ae267a492aac683616e028c0bfc6447"
84
- },
85
79
  "peerDependencies": {
86
80
  "chromedriver": "*"
87
81
  }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../lib/init-package/index.js");