@ui5/webcomponents-tools 0.0.0-f734ea2da → 0.0.0-f79db712b

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 (108) hide show
  1. package/CHANGELOG.md +808 -0
  2. package/README.md +6 -6
  3. package/assets-meta.js +18 -3
  4. package/bin/dev.js +1 -5
  5. package/components-package/eslint.js +36 -0
  6. package/components-package/nps.js +108 -66
  7. package/components-package/postcss.components.js +1 -21
  8. package/components-package/postcss.themes.js +1 -23
  9. package/components-package/vite.config.js +13 -0
  10. package/components-package/wdio.js +405 -344
  11. package/components-package/wdio.sync.js +368 -0
  12. package/icons-collection/nps.js +51 -18
  13. package/lib/cem/custom-elements-manifest.config.mjs +499 -0
  14. package/lib/cem/event.mjs +135 -0
  15. package/lib/cem/schema-internal.json +1354 -0
  16. package/lib/cem/schema.json +1098 -0
  17. package/lib/cem/types-internal.d.ts +801 -0
  18. package/lib/cem/types.d.ts +736 -0
  19. package/lib/cem/utils.mjs +354 -0
  20. package/lib/cem/validate.js +67 -0
  21. package/lib/copy-and-watch/index.js +24 -1
  22. package/lib/copy-list/index.js +17 -17
  23. package/lib/create-icons/index.js +124 -58
  24. package/lib/create-illustrations/index.js +165 -0
  25. package/lib/create-new-component/index.js +72 -97
  26. package/lib/create-new-component/jsFileContentTemplate.js +73 -0
  27. package/lib/create-new-component/tsFileContentTemplate.js +71 -0
  28. package/lib/css-processors/css-processor-components.mjs +77 -0
  29. package/lib/css-processors/css-processor-themes.mjs +79 -0
  30. package/lib/css-processors/scope-variables.mjs +46 -0
  31. package/lib/css-processors/shared.mjs +76 -0
  32. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  33. package/lib/dev-server/dev-server.js +66 -0
  34. package/lib/dev-server/virtual-index-html-plugin.js +52 -0
  35. package/lib/esm-abs-to-rel/index.js +17 -10
  36. package/lib/generate-custom-elements-manifest/index.js +327 -0
  37. package/lib/generate-js-imports/illustrations.js +86 -0
  38. package/lib/generate-json-imports/i18n.js +43 -31
  39. package/lib/generate-json-imports/themes.js +36 -24
  40. package/lib/hbs2lit/src/compiler.js +24 -4
  41. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  42. package/lib/hbs2lit/src/litVisitor2.js +95 -24
  43. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  44. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +33 -11
  45. package/lib/hbs2ui5/index.js +56 -23
  46. package/lib/i18n/defaults.js +65 -57
  47. package/lib/i18n/toJSON.js +12 -11
  48. package/lib/jsdoc/configTypescript.json +29 -0
  49. package/lib/jsdoc/plugin.js +41 -0
  50. package/lib/jsdoc/preprocess.js +146 -0
  51. package/lib/jsdoc/template/publish.js +21 -2
  52. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  53. package/lib/replace-global-core/index.js +13 -8
  54. package/lib/scoping/get-all-tags.js +2 -9
  55. package/lib/scoping/lint-src.js +1 -1
  56. package/lib/scoping/missing-dependencies.js +65 -0
  57. package/lib/scoping/report-tags-usage.js +28 -0
  58. package/lib/scoping/scope-test-pages.js +2 -1
  59. package/lib/test-runner/test-runner.js +71 -0
  60. package/package.json +36 -38
  61. package/bin/init-ui5-package.js +0 -3
  62. package/components-package/rollup.js +0 -216
  63. package/lib/documentation/index.js +0 -165
  64. package/lib/documentation/templates/api-component-since.js +0 -3
  65. package/lib/documentation/templates/api-css-variables-section.js +0 -24
  66. package/lib/documentation/templates/api-events-section.js +0 -35
  67. package/lib/documentation/templates/api-methods-section.js +0 -26
  68. package/lib/documentation/templates/api-properties-section.js +0 -40
  69. package/lib/documentation/templates/api-slots-section.js +0 -28
  70. package/lib/documentation/templates/template.js +0 -38
  71. package/lib/hash/config.js +0 -10
  72. package/lib/hash/generate.js +0 -19
  73. package/lib/hash/upToDate.js +0 -31
  74. package/lib/init-package/index.js +0 -136
  75. package/lib/init-package/resources/.eslintignore +0 -3
  76. package/lib/init-package/resources/bundle.es5.js +0 -25
  77. package/lib/init-package/resources/bundle.esm.js +0 -31
  78. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  79. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  80. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  81. package/lib/init-package/resources/config/rollup.config.js +0 -1
  82. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  83. package/lib/init-package/resources/package-scripts.js +0 -11
  84. package/lib/init-package/resources/src/Assets.js +0 -5
  85. package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
  86. package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
  87. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  88. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  89. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  90. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  91. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  92. package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
  93. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  94. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  95. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  96. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  97. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  98. package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  99. package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  100. package/lib/init-package/resources/test/pages/index.html +0 -56
  101. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
  102. package/lib/polyfill-placeholder/index.js +0 -5
  103. package/lib/postcss-css-to-esm/index.js +0 -45
  104. package/lib/postcss-css-to-json/index.js +0 -31
  105. package/lib/postcss-new-files/index.js +0 -36
  106. package/lib/serve/index.js +0 -46
  107. package/lib/serve/serve.json +0 -3
  108. package/package-lock.json +0 -48
@@ -1,136 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const mkdirp = require("mkdirp");
4
- const commandLineArgs = require('command-line-args');
5
- const beautify = require("json-beautify");
6
-
7
- // String utils
8
- const kebabToCamelCase = string => toCamelCase(string.split("-"));
9
- const toCamelCase = parts => {
10
- return parts.map((string, index) => {
11
- return index === 0 ? string.toLowerCase() : string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
12
- }).join("");
13
- };
14
- const capitalizeFirst = str => str.substr(0,1).toUpperCase() + str.substr(1);
15
-
16
- // content of package.json
17
- let packageContent;
18
-
19
- const DEFAULT_PORT = 8080;
20
- const DEFAULT_TAG = 'my-first-component';
21
-
22
- // from where all the files will be copied
23
- const RESOURCES_DIR = path.join(`${__dirname}`, `resources/`);
24
-
25
- // Command line options
26
- const options = commandLineArgs([
27
- {name: 'port', alias: 'p', type: Number},
28
- {name: 'tag', type: String},
29
- ]);
30
-
31
- // Ensure there is package.json
32
- try {
33
- packageContent = JSON.parse(fs.readFileSync("package.json"));
34
- } catch (err) {
35
- console.log("No package.json found, please run: 'npm init' first");
36
- process.exit(1);
37
- }
38
-
39
- // Ensure correct tag
40
- const tag = options.tag || DEFAULT_TAG;
41
- if (!tag.includes("-")) {
42
- console.log("tag name should contain at least one dash");
43
- process.exit(1);
44
- }
45
- if (tag.startsWith("ui5-")) {
46
- console.log("The ui5- prefix is reserved for the standard UI5 Web Components due to future possible name clashes.");
47
- process.exit(1);
48
- }
49
-
50
- const className = capitalizeFirst(kebabToCamelCase(tag));
51
-
52
- // All variables that will be replaced in the content of the resources/
53
- const vars = {
54
- INIT_PACKAGE_VAR_NAME: packageContent.name,
55
- INIT_PACKAGE_VAR_PORT: options.port || DEFAULT_PORT,
56
- INIT_PACKAGE_VAR_TAG: tag,
57
- INIT_PACKAGE_VAR_CLASS_NAME: className,
58
- };
59
- console.log(vars);
60
-
61
- const replaceVarsInFileContent = content => {
62
- for (let key in vars) {
63
- const re = new RegExp(key, "g");
64
- content = content.replace(re, vars[key]);
65
- }
66
- return content;
67
- };
68
-
69
- const replaceVarsInFileName = fileName => {
70
- return fileName.replace(/MyFirstComponent/, vars.INIT_PACKAGE_VAR_CLASS_NAME) ;
71
- };
72
-
73
- const copyFile = (sourcePath, destPath) => {
74
- let content = fs.readFileSync(sourcePath, {encoding: "UTF-8"});
75
- content = replaceVarsInFileContent(content);
76
- destPath = replaceVarsInFileName(destPath);
77
- fs.writeFileSync(destPath, content);
78
- console.log(destPath);
79
- };
80
-
81
- const copyResources = sourcePath => {
82
- const destPath = sourcePath.substr(RESOURCES_DIR.length);
83
- const isDir = fs.lstatSync(sourcePath).isDirectory();
84
- if (isDir) {
85
- if (destPath) {
86
- mkdirp.sync(destPath);
87
- console.log(destPath);
88
- }
89
- fs.readdirSync(sourcePath).forEach(file => {
90
- copyResources(path.join(sourcePath, file));
91
- });
92
- } else {
93
- copyFile(sourcePath, destPath);
94
- }
95
- };
96
-
97
- const updatePackageFile = () => {
98
- packageContent.scripts = {
99
- "clean": "wc-dev clean",
100
- "lint": "wc-dev lint",
101
- "start": "wc-dev start",
102
- "watch": "wc-dev watch",
103
- "serve": "wc-dev serve",
104
- "build": "wc-dev build",
105
- "test": "wc-dev test",
106
- "create-ui5-element": "wc-create-ui5-element",
107
- "prepublishOnly": "npm run build"
108
- };
109
-
110
- // make convinient exports (no dist in component path)
111
- // export the rest that is used directly or via require.resolve in scripts
112
- packageContent.exports = {
113
- "./.port": "./.port",
114
- "./src/*": "./src/*",
115
- "./dist/*": "./dist/*",
116
- "./package.json": "./package.json",
117
- "./bundle.esm.js": "./bundle.esm.js",
118
- "./bundle.es5.js": "./bundle.es5.js",
119
- "./bundle.common.js": "./bundle.common.js",
120
- "./*": "./dist/*"
121
- }
122
-
123
- packageContent.ui5 = {
124
- webComponentsPackage: true
125
- };
126
-
127
- fs.writeFileSync("package.json", beautify(packageContent, null, 2, 100));
128
- };
129
-
130
- // Copy files
131
- copyResources(RESOURCES_DIR);
132
-
133
- // Update package.json
134
- updatePackageFile();
135
-
136
- console.log("Package successfully initialized.");
@@ -1,3 +0,0 @@
1
- # Note: Changes to this file also must be applied to the top level .eslintignore file.
2
- dist
3
- test
@@ -1,25 +0,0 @@
1
- // ES5 bundle targets IE11 only
2
- import "@ui5/webcomponents-ie11/dist/features/IE11.js";
3
-
4
- import "./bundle.esm.js";
5
-
6
- import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js";
7
- import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
8
- import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
9
- import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
10
- import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
11
- import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
12
- import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
13
-
14
- const configuration = {
15
- getAnimationMode,
16
- getLanguage,
17
- getTheme,
18
- setTheme,
19
- getNoConflict,
20
- setNoConflict,
21
- getCalendarType,
22
- getRTL,
23
- getFirstDayOfWeek,
24
- };
25
- export default configuration;
@@ -1,31 +0,0 @@
1
- // used in test pages
2
- import { renderFinished } from "@ui5/webcomponents-base/dist/Render.js";
3
-
4
- import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js";
5
- import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
6
- import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
7
- import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
8
- import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
9
- import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
10
- import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
11
-
12
- // Enable additional themes and i18n texts
13
- import "./dist/Assets.js";
14
-
15
- // Import your web components here from the dist/ directory
16
- import "./dist/INIT_PACKAGE_VAR_CLASS_NAME.js";
17
-
18
- window["sap-ui-webcomponents-bundle"] = {
19
- renderFinished,
20
- configuration: {
21
- getAnimationMode,
22
- getLanguage,
23
- getTheme,
24
- setTheme,
25
- getNoConflict,
26
- setNoConflict,
27
- getCalendarType,
28
- getRTL,
29
- getFirstDayOfWeek,
30
- },
31
- };
@@ -1 +0,0 @@
1
- module.exports = require("@ui5/webcomponents-tools/components-package/eslint.js");
@@ -1 +0,0 @@
1
- module.exports = require("@ui5/webcomponents-tools/components-package/postcss.components.js");
@@ -1 +0,0 @@
1
- module.exports = require("@ui5/webcomponents-tools/components-package/postcss.themes.js");
@@ -1 +0,0 @@
1
- module.exports = require("@ui5/webcomponents-tools/components-package/rollup.js");
@@ -1 +0,0 @@
1
- module.exports = require("@ui5/webcomponents-tools/components-package/wdio.js");
@@ -1,11 +0,0 @@
1
- const getScripts = require("@ui5/webcomponents-tools/components-package/nps.js");
2
-
3
- const options = {
4
- port: INIT_PACKAGE_VAR_PORT,
5
- };
6
-
7
- const scripts = getScripts(options);
8
-
9
- module.exports = {
10
- scripts,
11
- };
@@ -1,5 +0,0 @@
1
- import "@ui5/webcomponents-theme-base/dist/Assets.js"; // Theming
2
-
3
- // own INIT_PACKAGE_VAR_NAME package assets
4
- import "./generated/json-imports/Themes.js";
5
- import "./generated/json-imports/i18n.js";
@@ -1 +0,0 @@
1
- <div>This is: INIT_PACKAGE_VAR_TAG. {{pleaseWaitText}}</div>
@@ -1,56 +0,0 @@
1
- import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
- import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js";
3
- import { fetchI18nBundle, getI18nBundle } from "@ui5/webcomponents-base/dist/i18nBundle.js";
4
-
5
- // Template
6
- import INIT_PACKAGE_VAR_CLASS_NAMETemplate from "./generated/templates/INIT_PACKAGE_VAR_CLASS_NAMETemplate.lit.js";
7
-
8
- // Styles
9
- import INIT_PACKAGE_VAR_CLASS_NAMECss from "./generated/themes/INIT_PACKAGE_VAR_CLASS_NAME.css.js";
10
-
11
- import { PLEASE_WAIT } from "./generated/i18n/i18n-defaults.js";
12
-
13
- const metadata = {
14
- tag: "INIT_PACKAGE_VAR_TAG",
15
- properties: {
16
- },
17
- slots: {
18
- },
19
- events: {
20
- },
21
- };
22
-
23
- class INIT_PACKAGE_VAR_CLASS_NAME extends UI5Element {
24
- constructor() {
25
- super();
26
- this.i18nBundle = getI18nBundle("INIT_PACKAGE_VAR_NAME");
27
- }
28
-
29
- get pleaseWaitText() {
30
- return this.i18nBundle.getText(PLEASE_WAIT);
31
- }
32
-
33
- static get metadata() {
34
- return metadata;
35
- }
36
-
37
- static get render() {
38
- return litRender;
39
- }
40
-
41
- static get template() {
42
- return INIT_PACKAGE_VAR_CLASS_NAMETemplate;
43
- }
44
-
45
- static get styles() {
46
- return INIT_PACKAGE_VAR_CLASS_NAMECss;
47
- }
48
-
49
- static async onDefine() {
50
- await fetchI18nBundle("INIT_PACKAGE_VAR_NAME");
51
- }
52
- }
53
-
54
- INIT_PACKAGE_VAR_CLASS_NAME.define();
55
-
56
- export default INIT_PACKAGE_VAR_CLASS_NAME;
@@ -1,2 +0,0 @@
1
- #please wait text for the sample component
2
- PLEASE_WAIT=wait
@@ -1 +0,0 @@
1
- PLEASE_WAIT=Bitte warten
@@ -1 +0,0 @@
1
- PLEASE_WAIT=Please wait
@@ -1 +0,0 @@
1
- PLEASE_WAIT=Espere
@@ -1 +0,0 @@
1
- PLEASE_WAIT=Patientez.
@@ -1,11 +0,0 @@
1
- :host {
2
- border: 2px solid var(--my-component-border-color);
3
- background-color: var(--sapBackgroundColor);
4
- color: var(--sapTextColor);
5
- display: block;
6
- width: 24rem;
7
- height: 3rem;
8
- text-align: center;
9
- vertical-align: middle;
10
- line-height: 3rem;
11
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: lightblue;
3
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: black;
3
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: black;
3
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: green;
3
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: blue;
3
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: lightblue;
3
- }
@@ -1,3 +0,0 @@
1
- :root {
2
- --my-component-border-color: gray;
3
- }
@@ -1,56 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <meta charset="utf-8">
7
-
8
- <title>INIT_PACKAGE_VAR_TAG</title>
9
- <meta name="viewport" content="width=device-width, initial-scale=1">
10
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
11
- <meta charset="utf-8">
12
-
13
- <script data-ui5-config type="application/json">
14
- {
15
- "language": "EN"
16
- }
17
- </script>
18
-
19
- <script src="../../webcomponentsjs/webcomponents-loader.js"></script>
20
- <script src="../../resources/bundle.esm.js" type="module"></script>
21
- <script nomodule src="../../resources/bundle.es5.js"></script>
22
-
23
- <style>
24
- code { color: blue; font-size: small; }
25
- </style>
26
-
27
- </head>
28
-
29
- <body>
30
- <ul>
31
- <li><a href="?sap-ui-theme=sap_fiori_3">Fiori 3</a></li>
32
- <li><a href="?sap-ui-theme=sap_fiori_3_dark">Fiori 3 Dark</a></li>
33
- <li><a href="?sap-ui-theme=sap_fiori_3_hcb">Fiori 3 High Contrast Black</a></li>
34
- <li><a href="?sap-ui-theme=sap_fiori_3_hcw">Fiori 3 High Contrast White</a></li>
35
- <li><a href="?sap-ui-theme=sap_belize">Belize</a></li>
36
- <li><a href="?sap-ui-theme=sap_belize_hcb">Belize High Contrast Black</a></li>
37
- <li><a href="?sap-ui-theme=sap_belize_hcw">Belize High Contrast White</a></li>
38
- </ul>
39
- <br>
40
- <span>or in the browser console, for example:</span>
41
- <code>window['sap-ui-webcomponents-bundle'].configuration.setTheme("sap_belize_hcb")</code>
42
-
43
- <br><br>
44
-
45
- <a href="?sap-ui-language=en">English</a> |
46
- <a href="?sap-ui-language=de">German</a> |
47
- <a href="?sap-ui-language=es">Spanish</a> |
48
- <a href="?sap-ui-language=fr">French</a>
49
-
50
- <br><br>
51
-
52
- <h1>Test your web components here</h1>
53
- <INIT_PACKAGE_VAR_TAG id="myFirstComponent"></INIT_PACKAGE_VAR_TAG>
54
- </body>
55
-
56
- </html>
@@ -1,12 +0,0 @@
1
- const assert = require("assert");
2
-
3
- describe("INIT_PACKAGE_VAR_TAG rendering", () => {
4
- browser.url("http://localhost:INIT_PACKAGE_VAR_PORT/test-resources/pages/index.html");
5
-
6
- it("tests if web component is correctly rendered", () => {
7
-
8
- const innerContent = browser.$("#myFirstComponent").shadow$("div");
9
-
10
- assert.ok(innerContent, "content rendered");
11
- });
12
- });
@@ -1,5 +0,0 @@
1
- const mkdirp = require("mkdirp");
2
- const fs = require("fs");
3
-
4
- mkdirp.sync("dist/webcomponentsjs/");
5
- fs.writeFileSync("dist/webcomponentsjs/webcomponents-loader.js", "");
@@ -1,45 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const mkdirp = require('mkdirp');
4
- const assets = require("../../assets-meta.js");
5
-
6
- const DEFAULT_THEME = assets.themes.default;
7
-
8
- const getDefaultThemeCode = packageName => {
9
- return `import { registerThemePropertiesLoader } from "@ui5/webcomponents-base/dist/asset-registries/Themes.js";
10
-
11
- import defaultThemeBase from "@ui5/webcomponents-theme-base/dist/generated/themes/${DEFAULT_THEME}/parameters-bundle.css.js";
12
- import defaultTheme from "./${DEFAULT_THEME}/parameters-bundle.css.js";
13
-
14
- registerThemePropertiesLoader("@ui5/webcomponents-theme-base", "${DEFAULT_THEME}", () => defaultThemeBase);
15
- registerThemePropertiesLoader("${packageName}", "${DEFAULT_THEME}", () => defaultTheme);
16
- `;
17
- };
18
-
19
- const proccessCSS = css => {
20
- css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
21
- css = css.replace(/\.background-image.*{.*}/, "");
22
- css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
23
- css = css.replace(/--sapFontUrl.*\);?/, "");
24
- return JSON.stringify(css);
25
- }
26
-
27
- module.exports = function (opts) {
28
- opts = opts || {};
29
-
30
- return {
31
- postcssPlugin: 'postcss-css-to-esm',
32
- Once (root) {
33
- let css = root.toString();
34
- css = proccessCSS(css);
35
-
36
- const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\");
37
- mkdirp.sync(path.dirname(targetFile));
38
-
39
- const filePath = `${targetFile}.js`;
40
- const defaultTheme = opts.includeDefaultTheme ? getDefaultThemeCode(opts.packageName) : ``;
41
- fs.writeFileSync(filePath, `${defaultTheme}export default ${css};`);
42
- }
43
- };
44
- };
45
- module.exports.postcss = true;
@@ -1,31 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const mkdirp = require('mkdirp');
4
-
5
- const proccessCSS = css => {
6
- css = css.replace(/\.sapThemeMeta[\s\S]*?:root/, ":root");
7
- css = css.replace(/\.background-image.*{.*}/, "");
8
- css = css.replace(/\.sapContrast[ ]*:root[\s\S]*?}/, "");
9
- css = css.replace(/--sapFontUrl.*\);?/, "");
10
- return css;
11
- }
12
-
13
- module.exports = function (opts) {
14
- opts = opts || {};
15
-
16
- return {
17
- postcssPlugin: 'postcss-css-to-json',
18
- Once (root) {
19
- let css = root.toString();
20
- css = proccessCSS(css);
21
-
22
- const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\assets\\");
23
- mkdirp.sync(path.dirname(targetFile));
24
-
25
- const filePath = `${targetFile}.json`;
26
- fs.writeFileSync(filePath, JSON.stringify({_: css}));
27
- }
28
- };
29
- };
30
-
31
- module.exports.postcss = true;
@@ -1,36 +0,0 @@
1
- const chokidar = require("chokidar");
2
- const commandLineArgs = require("command-line-args");
3
- const { exec } = require("child_process");
4
-
5
- const options = commandLineArgs([
6
- { name: "srcFiles", type: String },
7
- ]);
8
-
9
- const runPostcss = path => {
10
- let command = `postcss ${path} --config config/postcss.components --base src --dir dist/css/`;
11
- console.log(`Executing: ${command}`);
12
- exec(command, (err, stdout, stderr) => {
13
- if (err) {
14
- console.log(`Could not run postcss for ${path}. Error: ${err}`);
15
- }
16
- });
17
-
18
- command = `${command} -w`;
19
- console.log(`Executing: ${command}`);
20
- exec(command, (err, stdout, stderr) => {
21
- if (err) {
22
- console.log(`Could not run postcss in watch mode for ${path}. Error: ${err}`);
23
- }
24
- });
25
- };
26
-
27
- let ready = false; // Do nothing until the ready event has been fired (we don't want to recompile all files initially)
28
- const watcher = chokidar.watch(options.srcFiles);
29
- watcher.on("ready", () => {
30
- ready = true; // Initial scan is over -> waiting for new files
31
- });
32
- watcher.on("add", path => {
33
- if (ready) {
34
- runPostcss(path);
35
- }
36
- });
@@ -1,46 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const commandLineArgs = require("command-line-args");
4
- const { exec } = require("child_process");
5
- const colors = require("colors/safe");
6
- const isPortReachable = require("is-port-reachable");
7
-
8
- const options = commandLineArgs([
9
- { name: "port", type: Number },
10
- { name: "portStep", type: Number },
11
- { name: "packageName", type: String },
12
- { name: "dir", type: String },
13
- { name: "config", type: String },
14
- ]);
15
- const serveConfig = path.join(__dirname, `serve.json`);
16
-
17
- const requestPort = async () => {
18
- const serveProcess = (await gen.next()).value;
19
- serveProcess.stdout.on('data', data => {
20
- const matches = data.match(/Accepting connections at .*?:(\d+)/);
21
- if (matches) {
22
- console.log(colors.yellow(`Reserved port ${matches[1]} for the ${options.packageName} package.`));
23
- fs.writeFileSync(".port", matches[1]);
24
- }
25
- });
26
- };
27
-
28
- async function* serverGenerator(callback, port = 8080, step = 1) {
29
- while (true) {
30
- const portInUse = await isPortReachable(port, { host: "127.0.0.1" });
31
- if (!portInUse) {
32
- const command = `serve --config "${serveConfig}" --no-port-switching --no-clipboard -l ${port} ${options.dir}`;
33
- console.log(colors.yellow(`Executing: ${command}`));
34
- const serveProcess = exec(command, (err) => {
35
- console.log(colors.yellow(`Port ${port} already in use.`));
36
- callback();
37
- });
38
- yield serveProcess;
39
- }
40
- port += step;
41
- }
42
- }
43
-
44
- const gen = serverGenerator(requestPort, options.port, options.portStep);
45
-
46
- requestPort();
@@ -1,3 +0,0 @@
1
- {
2
- "cleanUrls": false
3
- }
package/package-lock.json DELETED
@@ -1,48 +0,0 @@
1
- {
2
- "name": "@ui5/webcomponents-tools",
3
- "version": "1.0.0-rc.8",
4
- "lockfileVersion": 1,
5
- "requires": true,
6
- "dependencies": {
7
- "balanced-match": {
8
- "version": "1.0.0",
9
- "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
10
- "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=",
11
- "dev": true
12
- },
13
- "brace-expansion": {
14
- "version": "1.1.11",
15
- "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
16
- "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
17
- "dev": true,
18
- "requires": {
19
- "balanced-match": "^1.0.0",
20
- "concat-map": "0.0.1"
21
- }
22
- },
23
- "concat-map": {
24
- "version": "0.0.1",
25
- "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
26
- "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=",
27
- "dev": true
28
- },
29
- "minimatch": {
30
- "version": "3.0.4",
31
- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
32
- "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
33
- "dev": true,
34
- "requires": {
35
- "brace-expansion": "^1.1.7"
36
- }
37
- },
38
- "recursive-readdir": {
39
- "version": "2.2.2",
40
- "resolved": "https://registry.npmjs.org/recursive-readdir/-/recursive-readdir-2.2.2.tgz",
41
- "integrity": "sha512-nRCcW9Sj7NuZwa2XvH9co8NPeXUBhZP7CRKJtU+cS6PW9FpCIFoI5ib0NT1ZrbNuPoRy0ylyCaUL8Gih4LSyFg==",
42
- "dev": true,
43
- "requires": {
44
- "minimatch": "3.0.4"
45
- }
46
- }
47
- }
48
- }