@ui5/webcomponents-tools 0.0.0-c6d8872f3 → 0.0.0-cf069fb29

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 (75) hide show
  1. package/CHANGELOG.md +164 -1
  2. package/README.md +1 -1
  3. package/assets-meta.js +149 -0
  4. package/bin/dev.js +16 -1
  5. package/components-package/nps.js +73 -34
  6. package/components-package/postcss.themes.js +5 -2
  7. package/components-package/rollup-plugins/empty-module.js +15 -0
  8. package/components-package/rollup.js +155 -50
  9. package/components-package/wdio.js +100 -64
  10. package/components-package/wdio.sync.js +360 -0
  11. package/icons-collection/nps.js +72 -28
  12. package/lib/copy-and-watch/index.js +122 -0
  13. package/lib/copy-list/index.js +28 -0
  14. package/lib/create-icons/index.js +41 -23
  15. package/lib/create-illustrations/index.js +150 -0
  16. package/lib/create-new-component/index.js +18 -6
  17. package/lib/documentation/index.js +43 -21
  18. package/lib/documentation/templates/template.js +1 -1
  19. package/lib/esm-abs-to-rel/index.js +54 -0
  20. package/lib/generate-json-imports/i18n.js +91 -47
  21. package/lib/generate-json-imports/themes.js +61 -15
  22. package/lib/hash/config.js +10 -0
  23. package/lib/hash/generate.js +19 -0
  24. package/lib/hash/upToDate.js +31 -0
  25. package/lib/hbs2lit/index.js +2 -4
  26. package/lib/hbs2lit/src/compiler.js +8 -7
  27. package/lib/hbs2lit/src/includesReplacer.js +22 -16
  28. package/lib/hbs2lit/src/litVisitor2.js +44 -8
  29. package/lib/hbs2lit/src/svgProcessor.js +3 -3
  30. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +5 -5
  31. package/lib/hbs2ui5/index.js +26 -20
  32. package/lib/i18n/defaults.js +25 -6
  33. package/lib/i18n/toJSON.js +15 -4
  34. package/lib/jsdoc/config.json +1 -1
  35. package/lib/jsdoc/plugin.js +24 -4
  36. package/lib/jsdoc/template/publish.js +11 -2
  37. package/lib/polyfill-placeholder/index.js +5 -0
  38. package/lib/postcss-css-to-esm/index.js +31 -19
  39. package/lib/postcss-css-to-json/index.js +27 -11
  40. package/lib/postcss-new-files/index.js +36 -0
  41. package/lib/replace-global-core/index.js +20 -0
  42. package/lib/scoping/get-all-tags.js +44 -0
  43. package/lib/scoping/lint-src.js +31 -0
  44. package/lib/scoping/scope-test-pages.js +40 -0
  45. package/lib/serve/index.js +46 -0
  46. package/{components-package → lib/serve}/serve.json +0 -0
  47. package/package-lock.json +48 -0
  48. package/package.json +55 -55
  49. package/bin/init-ui5-package.js +0 -3
  50. package/lib/init-package/index.js +0 -119
  51. package/lib/init-package/resources/.eslintignore +0 -3
  52. package/lib/init-package/resources/bundle.es5.js +0 -25
  53. package/lib/init-package/resources/bundle.esm.js +0 -34
  54. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  55. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  56. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  57. package/lib/init-package/resources/config/rollup.config.js +0 -1
  58. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  59. package/lib/init-package/resources/package-scripts.js +0 -11
  60. package/lib/init-package/resources/src/Assets.js +0 -6
  61. package/lib/init-package/resources/src/Demo.hbs +0 -1
  62. package/lib/init-package/resources/src/Demo.js +0 -56
  63. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  64. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  65. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  66. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  67. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  68. package/lib/init-package/resources/src/themes/Demo.css +0 -11
  69. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  70. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  71. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  72. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  73. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  74. package/lib/init-package/resources/test/pages/index.html +0 -51
  75. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
@@ -1,20 +1,36 @@
1
- const postcss = require('postcss');
2
1
  const fs = require('fs');
3
2
  const path = require('path');
4
3
  const mkdirp = require('mkdirp');
5
4
 
6
- module.exports = postcss.plugin('add css to JSON transform plugin', function (opts) {
7
- opts = opts || {};
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
+ }
8
12
 
9
- return function (root) {
10
- const css = root.toString();
11
- const targetFile = root.source.input.from.replace(`/${opts.toReplace}/`, "/dist/generated/assets/").replace(`\\${opts.toReplace}\\`, "\\dist\\generated\\assets\\");
13
+ module.exports = function (opts) {
14
+ opts = opts || {};
12
15
 
13
- mkdirp.sync(path.dirname(targetFile));
16
+ return {
17
+ postcssPlugin: 'postcss-css-to-json',
18
+ Once (root) {
19
+ let css = root.toString();
20
+ css = proccessCSS(css);
14
21
 
15
- const filePath = `${targetFile}.json`;
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));
16
24
 
17
- fs.writeFileSync(filePath, JSON.stringify({_: css}));
25
+ const filePath = `${targetFile}.json`;
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}));
32
+ }
33
+ };
34
+ };
18
35
 
19
- }
20
- });
36
+ module.exports.postcss = true;
@@ -0,0 +1,36 @@
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
+ });
@@ -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);
@@ -0,0 +1,44 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const glob = require("glob");
4
+
5
+ const getTag = file => {
6
+ const fileContent = String(fs.readFileSync(file)).replace(/\n/g, "");
7
+ const matches = fileContent.match(/\btag\b:\s*\"(.*?)\"/);
8
+ return matches ? matches[1] : undefined;
9
+ };
10
+
11
+ const getAltTag = file => {
12
+ const fileContent = String(fs.readFileSync(file)).replace(/\n/g, "");
13
+ const matches = fileContent.match(/\baltTag\b:\s*\"(.*?)\"/);
14
+ return matches ? matches[1] : undefined;
15
+ };
16
+
17
+ const getPackageTags = (packageDir) => {
18
+ const srcDir = path.join(packageDir, "src/");
19
+ return glob.sync(path.join(srcDir, "/**/*.js")).flatMap(file => {
20
+ const tag = getTag(file);
21
+ const altTag = getAltTag(file);
22
+ return [tag, altTag];
23
+ }).filter(item => !!item);
24
+ };
25
+
26
+ const isComponentsPackage = (packageFileContent) => {
27
+ return packageFileContent.ui5 && packageFileContent.ui5.webComponentsPackage;
28
+ };
29
+
30
+ const getDepComponentPackages = packageDir => {
31
+ const packageFile = path.join(packageDir, "package.json");
32
+ const packageFileContent = JSON.parse(fs.readFileSync(packageFile));
33
+ if (!isComponentsPackage(packageFileContent)) {
34
+ return [];
35
+ }
36
+
37
+ return Object.keys(packageFileContent.dependencies || {}).map(dep => path.dirname(require.resolve(path.join(dep, "package.json"))));
38
+ };
39
+
40
+ const getAllTags = (packageDir) => {
41
+ return getPackageTags(packageDir).concat(getDepComponentPackages(packageDir).flatMap(getPackageTags));
42
+ };
43
+
44
+ module.exports = getAllTags;
@@ -0,0 +1,31 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const glob = require("glob");
4
+ const getAllTags = require("./get-all-tags.js");
5
+
6
+ const tags = getAllTags(process.cwd());
7
+
8
+ const errors = [];
9
+
10
+ glob.sync(path.join(process.cwd(), "src/**/*.css")).forEach(file => {
11
+ let content = String(fs.readFileSync(file));
12
+ tags.forEach(tag => {
13
+ if (content.match(new RegExp(`(^|[^\.\-_A-Za-z0-9"\[])(${tag})([^\-_A-Za-z0-9]|$)`, "g"))) {
14
+ errors.push(`Warning! ${tag} found in ${file}`);
15
+ }
16
+ });
17
+ });
18
+
19
+ glob.sync(path.join(process.cwd(), "src/**/*.js")).forEach(file => {
20
+ let content = String(fs.readFileSync(file));
21
+ tags.forEach(tag => {
22
+ if (content.match(new RegExp(`querySelector[A-Za-z]*..${tag}`, "g"))) {
23
+ errors.push(`Warning! querySelector for ${tag} found in ${file}`);
24
+ }
25
+ });
26
+ });
27
+
28
+ if (errors.length) {
29
+ errors.forEach(error => console.log(error));
30
+ throw new Error("Errors found.");
31
+ }
@@ -0,0 +1,40 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const glob = require("glob");
4
+ const getAllTags = require("./get-all-tags.js");
5
+
6
+ const root = process.argv[2];
7
+ const suffix = process.argv[3];
8
+
9
+ const tags = getAllTags(process.cwd());
10
+
11
+ // Replaces tags in HTML content, f.e. <ui5-button> with <ui5-button-ver> or </ui5-button> with </ui5-button-ver>
12
+ const replaceTagsHTML = content => {
13
+ tags.forEach(tag => {
14
+ content = content.replace(new RegExp(`(<\/?)(${tag})(\/?[> \t\n])`, "g"), `$1$2-${suffix}$3`);
15
+ });
16
+ return content;
17
+ };
18
+
19
+ // Replace tags in any content
20
+ const replaceTagsAny = content => {
21
+ tags.forEach(tag => {
22
+ content = content.replace(new RegExp(`(^|[^\-_A-Za-z0-9])(${tag})([^\-_A-Za-z0-9]|$)`, "g"), `$1$2-${suffix}$3`);
23
+ });
24
+ return content;
25
+ };
26
+
27
+ // Replace bundle names and HTML tag names in test pages
28
+ glob.sync(path.join(root, "/**/*.html")).forEach(file => {
29
+ let content = String(fs.readFileSync(file));
30
+ content = content.replace(/bundle\.(.*?)\.js/g, `bundle.scoped.$1.js`);
31
+ content = replaceTagsHTML(content);
32
+ fs.writeFileSync(file, content);
33
+ });
34
+
35
+ // Replace tag names everywhere
36
+ glob.sync(path.join(root, "/**/*.{html,css,js}")).forEach(file => {
37
+ let content = String(fs.readFileSync(file));
38
+ content = replaceTagsAny(content);
39
+ fs.writeFileSync(file, content);
40
+ });
@@ -0,0 +1,46 @@
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("cli-color");
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();
File without changes
@@ -0,0 +1,48 @@
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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "0.0.0-c6d8872f3",
3
+ "version": "0.0.0-cf069fb29",
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,61 +21,62 @@
22
21
  "directory": "packages/tools"
23
22
  },
24
23
  "dependencies": {
25
- "@babel/cli": "^7.1.2",
26
- "@babel/core": "^7.1.2",
27
- "@babel/plugin-proposal-object-rest-spread": "^7.3.2",
28
- "@babel/preset-env": "^7.1.0",
29
- "@wdio/cli": "^5.12.1",
30
- "@wdio/dot-reporter": "^5.12.1",
31
- "@wdio/local-runner": "^5.12.1",
32
- "@wdio/mocha-framework": "^5.12.1",
33
- "@wdio/spec-reporter": "^5.12.1",
34
- "@wdio/sync": "^5.12.1",
35
- "@webcomponents/webcomponentsjs": "^2.4.0",
36
- "chai": "^4.2.0",
37
- "chokidar-cli": "^2.0.0",
38
- "chromedriver": "^80.0.0",
39
- "clean-css": "^4.2.1",
24
+ "@babel/core": "^7.13.10",
25
+ "@babel/preset-env": "^7.13.10",
26
+ "@openui5/sap.ui.core": "1.95.0",
27
+ "@rollup/plugin-babel": "^5.3.0",
28
+ "@rollup/plugin-commonjs": "^21.0.1",
29
+ "@rollup/plugin-json": "^4.1.0",
30
+ "@rollup/plugin-node-resolve": "^13.0.5",
31
+ "@rollup/plugin-replace": "^3.0.0",
32
+ "@rollup/plugin-url": "^6.0.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",
38
+ "@webcomponents/webcomponentsjs": "^2.5.0",
39
+ "chai": "^4.3.4",
40
+ "child_process": "^1.0.2",
41
+ "chokidar": "^3.5.1",
42
+ "chokidar-cli": "^3.0.0",
43
+ "cli-color": "^2.0.1",
40
44
  "command-line-args": "^5.1.1",
41
- "concurrently": "^5.0.0",
42
- "copy-and-watch": "^0.1.4",
43
- "cross-env": "^5.2.0",
44
- "cssnano": "^4.1.10",
45
- "escodegen": "^1.11.0",
46
- "eslint": "^5.10.0",
47
- "eslint-config-airbnb-base": "^13.1.0",
48
- "eslint-plugin-import": "^2.14.0",
45
+ "concurrently": "^6.0.0",
46
+ "cross-env": "^7.0.3",
47
+ "cssnano": "^4.1.11",
48
+ "escodegen": "^2.0.0",
49
+ "eslint": "^7.22.0",
50
+ "eslint-config-airbnb-base": "^14.2.1",
51
+ "eslint-plugin-import": "^2.22.1",
49
52
  "esprima": "^4.0.1",
50
- "getopts": "^2.2.3",
51
- "glob": "^7.1.3",
52
- "handlebars": "^4.1.2",
53
- "jsdoc": "^3.6.3",
53
+ "folder-hash": "^4.0.1",
54
+ "getopts": "^2.3.0",
55
+ "glob": "^7.1.6",
56
+ "glob-parent": "^6.0.2",
57
+ "handlebars": "^4.7.7",
58
+ "is-port-reachable": "^3.1.0",
59
+ "jsdoc": "^3.6.6",
54
60
  "json-beautify": "^1.1.1",
55
- "mkdirp": "^0.5.1",
56
- "npm-run-all": "^4.1.3",
57
- "nps": "^5.9.8",
58
- "postcss": "^7.0.18",
59
- "postcss-cli": "^6.1.3",
60
- "postcss-combine-duplicated-selectors": "^7.0.0",
61
- "postcss-import": "^12.0.1",
62
- "properties-reader": "^0.3.1",
63
- "puppeteer": "^1.11.0",
64
- "rimraf": "^2.6.2",
65
- "rollup": "^1.1.2",
66
- "rollup-plugin-babel": "^4.0.3",
67
- "rollup-plugin-filesize": "^6.0.1",
68
- "rollup-plugin-less": "^1.1.2",
69
- "rollup-plugin-livereload": "^1.0.4",
70
- "rollup-plugin-node-resolve": "^4.0.0",
71
- "rollup-plugin-notify": "^1.1.0",
72
- "rollup-plugin-string": "^2.0.2",
73
- "rollup-plugin-terser": "^5.1.3",
74
- "rollup-plugin-url": "^2.2.0",
75
- "rollup-plugin-visualizer": "^0.9.2",
76
- "serve": "^10.1.1",
77
- "wdio-chromedriver-service": "^5.0.2"
61
+ "mkdirp": "^1.0.4",
62
+ "nps": "^5.10.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",
67
+ "properties-reader": "^2.2.0",
68
+ "recursive-readdir": "^2.2.2",
69
+ "resolve": "^1.20.0",
70
+ "rimraf": "^3.0.2",
71
+ "rollup": "^2.41.4",
72
+ "rollup-plugin-filesize": "^9.1.1",
73
+ "rollup-plugin-livereload": "^2.0.0",
74
+ "rollup-plugin-terser": "^7.0.2",
75
+ "serve": "^12.0.0",
76
+ "slash": "3.0.0",
77
+ "wdio-chromedriver-service": "^7.0.0"
78
78
  },
79
- "resolutions": {
80
- "rollup-plugin-livereload/livereload/chokidar": "^3.x"
79
+ "peerDependencies": {
80
+ "chromedriver": "*"
81
81
  }
82
82
  }
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- require("../lib/init-package/index.js");
@@ -1,119 +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 = 'ui5-demo';
21
- const BETA_VER = "0.18.0";
22
- const RC_VER = "1.0.0-rc.5";
23
-
24
- // from where all the files will be copied
25
- const RESOURCES_DIR = path.join(`${__dirname}`, `resources/`);
26
-
27
- // Command line options
28
- const options = commandLineArgs([
29
- {name: 'port', alias: 'p', type: Number},
30
- {name: 'tag', type: String},
31
- ]);
32
-
33
- // Ensure there is package.json
34
- try {
35
- packageContent = JSON.parse(fs.readFileSync("package.json"));
36
- } catch (err) {
37
- console.log("No package.json found, please run: 'npm init' first");
38
- process.exit(1);
39
- }
40
-
41
- // Ensure correct tag
42
- const tag = options.tag || DEFAULT_TAG;
43
- if (!tag.match(/^ui5-/)) {
44
- console.log("tag name should start with ui5-");
45
- process.exit(1);
46
- }
47
- const className = capitalizeFirst(kebabToCamelCase(tag.substr(4)));
48
-
49
- // All variables that will be replaced in the content of the resources/
50
- const vars = {
51
- INIT_PACKAGE_VAR_NAME: packageContent.name,
52
- INIT_PACKAGE_VAR_PORT: options.port || DEFAULT_PORT,
53
- INIT_PACKAGE_VAR_TAG: tag,
54
- INIT_PACKAGE_VAR_CLASS_NAME: className,
55
- };
56
- console.log(vars);
57
-
58
- const replaceVarsInFileContent = content => {
59
- for (let key in vars) {
60
- const re = new RegExp(key, "g");
61
- content = content.replace(re, vars[key]);
62
- }
63
- return content;
64
- };
65
-
66
- const replaceVarsInFileName = fileName => {
67
- return fileName.replace(/Demo/, vars.INIT_PACKAGE_VAR_CLASS_NAME) ;
68
- };
69
-
70
- const copyFile = (sourcePath, destPath) => {
71
- let content = fs.readFileSync(sourcePath, {encoding: "UTF-8"});
72
- content = replaceVarsInFileContent(content);
73
- destPath = replaceVarsInFileName(destPath);
74
- fs.writeFileSync(destPath, content);
75
- console.log(destPath);
76
- };
77
-
78
- const copyResources = sourcePath => {
79
- const destPath = sourcePath.substr(RESOURCES_DIR.length);
80
- const isDir = fs.lstatSync(sourcePath).isDirectory();
81
- if (isDir) {
82
- if (destPath) {
83
- mkdirp.sync(destPath);
84
- console.log(destPath);
85
- }
86
- fs.readdirSync(sourcePath).forEach(file => {
87
- copyResources(path.join(sourcePath, file));
88
- });
89
- } else {
90
- copyFile(sourcePath, destPath);
91
- }
92
- };
93
-
94
- const updatePackageFile = () => {
95
- packageContent.scripts = {
96
- "clean": "wc-dev clean",
97
- "lint": "wc-dev lint",
98
- "start": "wc-dev start",
99
- "build": "wc-dev build",
100
- "test": "wc-dev test",
101
- "create-ui5-element": "wc-create-ui5-element",
102
- "prepublishOnly": "npm run build"
103
- };
104
-
105
- packageContent.dependencies = packageContent.dependencies || {};
106
- packageContent.dependencies["@ui5/webcomponents-base"] = BETA_VER;
107
- packageContent.dependencies["@ui5/webcomponents-theme-base"] = RC_VER;
108
- packageContent.dependencies["@ui5/webcomponents-tools"] = RC_VER;
109
-
110
- fs.writeFileSync("package.json", beautify(packageContent, null, 2, 100));
111
- };
112
-
113
- // Copy files
114
- copyResources(RESOURCES_DIR);
115
-
116
- // Update package.json
117
- updatePackageFile();
118
-
119
- 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-base/dist/features/browsersupport/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,34 +0,0 @@
1
- // ESM bundle targets Edge + browsers with native support
2
- import "@ui5/webcomponents-base/dist/features/browsersupport/Edge.js";
3
-
4
- // used in test pages
5
- import RenderScheduler from "@ui5/webcomponents-base/dist/RenderScheduler.js";
6
-
7
- import { getAnimationMode } from "@ui5/webcomponents-base/dist/config/AnimationMode.js";
8
- import { getLanguage } from "@ui5/webcomponents-base/dist/config/Language.js";
9
- import { getCalendarType } from "@ui5/webcomponents-base/dist/config/CalendarType.js";
10
- import { getTheme, setTheme } from "@ui5/webcomponents-base/dist/config/Theme.js";
11
- import { getNoConflict, setNoConflict } from "@ui5/webcomponents-base/dist/config/NoConflict.js";
12
- import { getRTL } from "@ui5/webcomponents-base/dist/config/RTL.js";
13
- import { getFirstDayOfWeek } from "@ui5/webcomponents-base/dist/config/FormatSettings.js";
14
-
15
- // Enable additional themes and i18n texts
16
- import "./dist/Assets.js";
17
-
18
- // Import your web components here from the dist/ directory
19
- import "./dist/INIT_PACKAGE_VAR_CLASS_NAME.js";
20
-
21
- window.RenderScheduler = RenderScheduler;
22
- window["sap-ui-webcomponents-bundle"] = {
23
- configuration: {
24
- getAnimationMode,
25
- getLanguage,
26
- getTheme,
27
- setTheme,
28
- getNoConflict,
29
- setNoConflict,
30
- getCalendarType,
31
- getRTL,
32
- getFirstDayOfWeek,
33
- },
34
- };
@@ -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");