@ui5/webcomponents-tools 0.0.0-d0bcf47c7 → 0.0.0-d160e83dd

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 (62) hide show
  1. package/CHANGELOG.md +1915 -1
  2. package/README.md +6 -9
  3. package/assets-meta.js +154 -0
  4. package/bin/dev.js +12 -1
  5. package/components-package/eslint.js +66 -2
  6. package/components-package/nps.js +142 -45
  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 +9 -0
  10. package/components-package/wdio.js +153 -65
  11. package/icons-collection/nps.js +71 -28
  12. package/lib/amd-to-es6/index.js +102 -0
  13. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  14. package/lib/cem/custom-elements-manifest.config.mjs +547 -0
  15. package/lib/cem/event.mjs +168 -0
  16. package/lib/cem/schema-internal.json +1422 -0
  17. package/lib/cem/schema.json +1098 -0
  18. package/lib/cem/types-internal.d.ts +808 -0
  19. package/lib/cem/types.d.ts +736 -0
  20. package/lib/cem/utils.mjs +423 -0
  21. package/lib/cem/validate.js +67 -0
  22. package/lib/copy-and-watch/index.js +145 -0
  23. package/lib/copy-list/index.js +28 -0
  24. package/lib/create-icons/index.js +127 -0
  25. package/lib/create-illustrations/index.js +182 -0
  26. package/lib/create-new-component/Component.js +74 -0
  27. package/lib/create-new-component/ComponentTemplate.js +12 -0
  28. package/lib/create-new-component/index.js +113 -0
  29. package/lib/css-processors/css-processor-components.mjs +77 -0
  30. package/lib/css-processors/css-processor-themes.mjs +74 -0
  31. package/lib/css-processors/scope-variables.mjs +49 -0
  32. package/lib/css-processors/shared.mjs +56 -0
  33. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  34. package/lib/dev-server/dev-server.mjs +66 -0
  35. package/lib/dev-server/virtual-index-html-plugin.js +56 -0
  36. package/lib/generate-js-imports/illustrations.js +86 -0
  37. package/lib/generate-json-imports/i18n.js +82 -0
  38. package/lib/generate-json-imports/themes.js +63 -0
  39. package/lib/hbs2lit/index.js +3 -0
  40. package/lib/hbs2lit/src/compiler.js +60 -0
  41. package/lib/hbs2lit/src/extendedAttributeMapping.js +12 -0
  42. package/lib/hbs2lit/src/includesReplacer.js +31 -0
  43. package/lib/hbs2lit/src/litVisitor2.js +278 -0
  44. package/lib/hbs2lit/src/partials2.js +51 -0
  45. package/lib/hbs2lit/src/partialsVisitor.js +187 -0
  46. package/lib/hbs2lit/src/svgProcessor.js +76 -0
  47. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +45 -0
  48. package/lib/hbs2ui5/index.js +119 -0
  49. package/lib/i18n/defaults.js +83 -0
  50. package/lib/i18n/toJSON.js +43 -0
  51. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  52. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  53. package/lib/scoping/get-all-tags.js +44 -0
  54. package/lib/scoping/lint-src.js +32 -0
  55. package/lib/scoping/missing-dependencies.js +65 -0
  56. package/lib/scoping/report-tags-usage.js +28 -0
  57. package/lib/scoping/scope-test-pages.js +41 -0
  58. package/lib/test-runner/test-runner.js +71 -0
  59. package/package.json +58 -55
  60. package/tsconfig.json +18 -0
  61. package/bin/init-ui5-package.js +0 -3
  62. package/package-lock.json +0 -9994
package/README.md CHANGED
@@ -1,24 +1,21 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/master/docs/images/UI5_logo_wide.png)
1
+ # ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_water.png)UI5 Web Components - Tools
2
2
 
3
- # UI5 Web Components - Tools
4
-
5
- [![Travis CI Build Status](https://travis-ci.org/SAP/ui5-webcomponents.svg?branch=master)](https://travis-ci.org/SAP/ui5-webcomponents)
6
3
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
7
4
 
8
5
  Provides libraries, configuration files and build artifacts,
9
6
  used by other UI5 Web Components packages, such as `main` and `fiori`.
10
7
 
11
8
  ## Resources
12
- - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/master/README.md)
9
+ - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
13
10
  - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
14
- - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
11
+ - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/play/)
15
12
 
16
13
  ## Support
17
- We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://join-ui5-slack.herokuapp.com/).
14
+ We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://ui5-slack-invite.cfapps.eu10.hana.ondemand.com/).
18
15
 
19
16
  ## Contribute
20
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/CONTRIBUTING.md).
17
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
21
18
 
22
19
  ## License
23
20
  Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
24
- This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/master/LICENSE.txt) file.
21
+ This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/main/LICENSE.txt) file.
package/assets-meta.js ADDED
@@ -0,0 +1,154 @@
1
+ const assetsMeta = {
2
+ "themes": {
3
+ "default": "sap_horizon",
4
+ "all": [
5
+ "sap_fiori_3",
6
+ "sap_fiori_3_dark",
7
+ "sap_fiori_3_hcb",
8
+ "sap_fiori_3_hcw",
9
+ "sap_horizon",
10
+ "sap_horizon_dark",
11
+ "sap_horizon_hcb",
12
+ "sap_horizon_hcw",
13
+ ],
14
+ },
15
+ "languages": {
16
+ "default": "en",
17
+ "all": [
18
+ "ar",
19
+ "bg",
20
+ "ca",
21
+ "cnr",
22
+ "cs",
23
+ "cy",
24
+ "da",
25
+ "de",
26
+ "el",
27
+ "en",
28
+ "en_GB",
29
+ "en_US_sappsd",
30
+ "en_US_saprigi",
31
+ "en_US_saptrc",
32
+ "es",
33
+ "es_MX",
34
+ "et",
35
+ "fi",
36
+ "fr",
37
+ "fr_CA",
38
+ "hi",
39
+ "hr",
40
+ "hu",
41
+ "in",
42
+ "it",
43
+ "iw",
44
+ "ja",
45
+ "kk",
46
+ "ko",
47
+ "lt",
48
+ "lv",
49
+ "mk",
50
+ "ms",
51
+ "nl",
52
+ "no",
53
+ "pl",
54
+ "pt_PT",
55
+ "pt",
56
+ "ro",
57
+ "ru",
58
+ "sh",
59
+ "sk",
60
+ "sl",
61
+ "sr",
62
+ "sv",
63
+ "th",
64
+ "tr",
65
+ "uk",
66
+ "vi",
67
+ "zh_CN",
68
+ "zh_TW"
69
+ ]
70
+ },
71
+ "locales": {
72
+ "default": "en",
73
+ "all": [
74
+ "ar",
75
+ "ar_EG",
76
+ "ar_SA",
77
+ "bg",
78
+ "ca",
79
+ "cnr",
80
+ "cs",
81
+ "da",
82
+ "de",
83
+ "de_AT",
84
+ "de_CH",
85
+ "el",
86
+ "el_CY",
87
+ "en",
88
+ "en_AU",
89
+ "en_GB",
90
+ "en_HK",
91
+ "en_IE",
92
+ "en_IN",
93
+ "en_NZ",
94
+ "en_PG",
95
+ "en_SG",
96
+ "en_ZA",
97
+ "es",
98
+ "es_AR",
99
+ "es_BO",
100
+ "es_CL",
101
+ "es_CO",
102
+ "es_MX",
103
+ "es_PE",
104
+ "es_UY",
105
+ "es_VE",
106
+ "et",
107
+ "fa",
108
+ "fi",
109
+ "fr",
110
+ "fr_BE",
111
+ "fr_CA",
112
+ "fr_CH",
113
+ "fr_LU",
114
+ "he",
115
+ "hi",
116
+ "hr",
117
+ "hu",
118
+ "id",
119
+ "it",
120
+ "it_CH",
121
+ "ja",
122
+ "kk",
123
+ "ko",
124
+ "lt",
125
+ "lv",
126
+ "ms",
127
+ "mk",
128
+ "nb",
129
+ "nl",
130
+ "nl_BE",
131
+ "pl",
132
+ "pt",
133
+ "pt_PT",
134
+ "ro",
135
+ "ru",
136
+ "ru_UA",
137
+ "sk",
138
+ "sl",
139
+ "sr",
140
+ "sr_Latn",
141
+ "sv",
142
+ "th",
143
+ "tr",
144
+ "uk",
145
+ "vi",
146
+ "zh_CN",
147
+ "zh_HK",
148
+ "zh_SG",
149
+ "zh_TW"
150
+ ]
151
+ }
152
+ };
153
+
154
+ module.exports = assetsMeta;
package/bin/dev.js CHANGED
@@ -2,4 +2,15 @@
2
2
 
3
3
  const child_process = require("child_process");
4
4
 
5
- child_process.execSync(`npx nps ${process.argv[2]}`, {stdio: 'inherit'});
5
+ let command = process.argv[2];
6
+ const argument = process.argv[3];
7
+
8
+ if (command === "watch") {
9
+ if (["src", "test", "bundles", "styles", "templates", "samples"].includes(argument)) {
10
+ command = `watch.${argument}`;
11
+ }
12
+ } else if (command === "test") {
13
+ command = `test ${process.argv.slice(3).join(" ")}`;
14
+ }
15
+
16
+ child_process.execSync(`npx nps "${command}"`, {stdio: 'inherit'});
@@ -1,3 +1,65 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const tsMode = fs.existsSync(path.join(process.cwd(), "tsconfig.json"));
4
+
5
+ /**
6
+ * Returns eslint rules specific to typescript files
7
+ * @returns
8
+ */
9
+ const getTsModeOverrides = () => {
10
+ const tsConfiguration = {
11
+ files: ["*.ts"],
12
+ parser: "@typescript-eslint/parser",
13
+ plugins: ["@typescript-eslint"],
14
+ extends: [
15
+ "plugin:@typescript-eslint/recommended",
16
+ "plugin:@typescript-eslint/recommended-requiring-type-checking"
17
+ ],
18
+ parserOptions: {
19
+ "project": [
20
+ "./tsconfig.json"
21
+ ],
22
+ EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
23
+ },
24
+ rules: {
25
+ "no-shadow": "off",
26
+ "@typescript-eslint/consistent-type-imports": "error",
27
+ "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
28
+ "@typescript-eslint/no-shadow": ["error"],
29
+ "@typescript-eslint/no-unsafe-member-access": "off",
30
+ "@typescript-eslint/no-floating-promises": "off",
31
+ "@typescript-eslint/no-explicit-any": "off",
32
+ "@typescript-eslint/no-unsafe-assignment": "off",
33
+ "@typescript-eslint/ban-ts-comment": "off",
34
+ "@typescript-eslint/no-unsafe-call": "off",
35
+ "@typescript-eslint/no-non-null-assertion": "off",
36
+ "@typescript-eslint/no-empty-function": "off",
37
+ "@typescript-eslint/no-empty-interface": "off",
38
+ "lines-between-class-members": "off",
39
+ }
40
+ };
41
+
42
+ const tsxConfiguration = JSON.parse(JSON.stringify(tsConfiguration));
43
+ tsxConfiguration.files = ["*.tsx"];
44
+ tsxConfiguration.plugins.push("jsx-no-leaked-values");
45
+ tsxConfiguration.rules = {
46
+ ...tsxConfiguration.rules,
47
+ "jsx-no-leaked-values/jsx-no-leaked-values": "error",
48
+ "@typescript-eslint/unbound-method": "off", // to be able to attach on* listeners
49
+ "@typescript-eslint/no-misused-promises": "off", // to be able to have async event listeners
50
+ "operator-linebreak": "off",
51
+ "no-nested-ternary": "off",
52
+ "implicit-arrow-linebreak": "off",
53
+ "function-paren-newline": "off",
54
+ "comma-dangle": "off"
55
+ };
56
+
57
+ return [
58
+ tsConfiguration,
59
+ tsxConfiguration
60
+ ];
61
+ }
62
+
1
63
  module.exports = {
2
64
  "env": {
3
65
  "browser": true,
@@ -5,6 +67,7 @@ module.exports = {
5
67
  },
6
68
  "root": true,
7
69
  "extends": "airbnb-base",
70
+ "overrides": tsMode ? getTsModeOverrides() : [],
8
71
  "parserOptions": {
9
72
  "ecmaVersion": 2018,
10
73
  "sourceType": "module"
@@ -47,6 +110,7 @@ module.exports = {
47
110
  "curly": [2, "all"],
48
111
  // "default-case": 1, // removed for UI5 WebComponents
49
112
  "import/extensions": ["error", "always"], // override for UI5 WebComponents
113
+ "import/order": "off",
50
114
  "no-alert": 2,
51
115
  "no-caller": 2,
52
116
  "no-div-regex": 2,
@@ -88,7 +152,7 @@ module.exports = {
88
152
  "no-shadow-restricted-names": 2,
89
153
  "no-undef-init": 2,
90
154
  "no-undef": 2,
91
- "no-unused-vars": [2, {"vars":"all", "args":"none"}],
155
+ "no-unused-vars": [2, { "vars": "all", "args": "none" }],
92
156
 
93
157
  "brace-style": [2, "1tbs", { "allowSingleLine": true }],
94
158
  "camelcase": [1, { "properties": "never" }], // added for UI5 WebComponents
@@ -104,7 +168,7 @@ module.exports = {
104
168
  "no-new-object": 2,
105
169
  "no-spaced-func": 2,
106
170
  "quote-props": [2, "as-needed", { "keywords": true, "unnecessary": false }],
107
- "semi-spacing": [1, {"before": false, "after": true}],
171
+ "semi-spacing": [1, { "before": false, "after": true }],
108
172
  "semi": 2,
109
173
  "keyword-spacing": 2,
110
174
  "space-infix-ops": 2,
@@ -1,73 +1,170 @@
1
1
  const path = require("path");
2
-
2
+ const fs = require("fs");
3
3
  const LIB = path.join(__dirname, `../lib/`);
4
- const NODE_MODULES_PATH = path.join(__dirname, `../../../node_modules/`);
5
- const serveConfig = path.join(__dirname, `serve.json`);
6
- const polyfillPath = path.join(NODE_MODULES_PATH, `/@webcomponents/webcomponentsjs/**/*.*`);
4
+ let websiteBaseUrl = "/";
5
+
6
+ if (process.env.DEPLOY) {
7
+ websiteBaseUrl = "/ui5-webcomponents/";
8
+ } else if (process.env.DEPLOY_NIGHTLY) {
9
+ websiteBaseUrl = "/ui5-webcomponents/nightly/";
10
+ }
11
+
12
+ const cypressEnvVariables = (options, predefinedVars) => {
13
+ let variables = [];
14
+ const { cypress_code_coverage, cypress_acc_tests } = options.internal ?? {};
15
+
16
+ // Handle environment variables like TEST_SUITE
17
+ if (predefinedVars) {
18
+ variables = [...predefinedVars];
19
+ }
20
+
21
+ // The coverage task is always registered and requires an explicit variable whether to generate a report or not
22
+ variables.push(`CYPRESS_COVERAGE=${!!cypress_code_coverage}`);
23
+
24
+ if (cypress_acc_tests) {
25
+ variables.push("CYPRESS_UI5_ACC=true");
26
+ }
27
+
28
+ return variables.length ? `cross-env ${variables.join(" ")}` : "";
29
+ }
7
30
 
8
31
  const getScripts = (options) => {
9
32
 
10
- const port = options.port;
33
+ // The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
34
+ const illustrationsData = options.illustrationsData || [];
35
+ const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
36
+ const createIllustrationsJSImportsScript = illustrations.join(" && ");
37
+
38
+ // The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
39
+ const createIllustrationsLoadersScript = illustrationsData.map(illustrations => `node ${LIB}/generate-js-imports/illustrations.js ${illustrations.destinationPath} ${illustrations.dynamicImports.outputFile} ${illustrations.set} ${illustrations.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.filterOut.join(" ")}`).join(" && ");
40
+
41
+ const tsOption = !options.legacy || options.jsx;
42
+ const tsCommandOld = tsOption ? "tsc" : "";
43
+ let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
44
+ // this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
45
+ if (options.noWatchTS) {
46
+ tsWatchCommandStandalone = "";
47
+ }
48
+ const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
49
+
50
+ if (tsOption) {
51
+ try {
52
+ require("typescript");
53
+ } catch (e) {
54
+ console.error(`TypeScript is not found. Try to install it by running \`npm install --save-dev typescript\` if you are using npm or by running \`yarn add --dev typescript\` if you are using yarn.`);
55
+ process.exit(e.code);
56
+ }
57
+ }
58
+
59
+ let viteConfig;
60
+ if (fs.existsSync("config/vite.config.js")) {
61
+ // old project setup where config file is in separate folder
62
+ viteConfig = "-c config/vite.config.js";
63
+ } else if (fs.existsSync("vite.config.js")) {
64
+ // preferred way of custom configuration in root project folder
65
+ viteConfig = "";
66
+ } else {
67
+ // no custom configuration - use default from tools project
68
+ viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
69
+ }
70
+
71
+ let eslintConfig;
72
+ if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
73
+ // preferred way of custom configuration in root project folder
74
+ eslintConfig = "";
75
+ } else {
76
+ // no custom configuration - use default from tools project
77
+ eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
78
+ }
11
79
 
12
80
  const scripts = {
13
- clean: "rimraf dist",
14
- lint: "eslint . --config config/.eslintrc.js",
15
- prepare: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples",
81
+ clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
82
+ lint: `eslint . ${eslintConfig}`,
83
+ lintfix: `eslint . ${eslintConfig} --fix`,
84
+ generate: {
85
+ default: `${tsCrossEnv} nps prepare.all`,
86
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copyProps" "nps build.illustrations"',
87
+ styleRelated: "nps build.styles build.jsonImports build.jsImports",
88
+ },
89
+ prepare: {
90
+ default: `${tsCrossEnv} nps clean prepare.all ${options.legacy ? "copy" : ""} copyProps prepare.typescript generateAPI`,
91
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
92
+ styleRelated: "nps build.styles build.jsonImports build.jsImports",
93
+ typescript: tsCommandOld,
94
+ },
16
95
  build: {
17
- default: "nps lint prepare build.bundle",
18
- templates: `mkdirp dist/generated/templates && node ${LIB}/hbs2ui5/index.js -d src/ -o dist/generated/templates`,
96
+ default: "nps prepare lint build.bundle", // build.bundle2
97
+ templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
19
98
  styles: {
20
- default: "nps build.styles.themes build.styles.components",
21
- themes: "postcss src/**/parameters-bundle.css --config config/postcss.themes --base src --dir dist/css/",
22
- components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/",
99
+ default: `concurrently "nps build.styles.themes" "nps build.styles.components"`,
100
+ themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
101
+ components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
23
102
  },
24
103
  i18n: {
25
104
  default: "nps build.i18n.defaultsjs build.i18n.json",
26
- defaultsjs: `mkdirp dist/generated/i18n && node ${LIB}/i18n/defaults.js src/i18n dist/generated/i18n`,
27
- json: `mkdirp dist/generated/assets/i18n && node ${LIB}/i18n/toJSON.js src/i18n dist/generated/assets/i18n`,
105
+ defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
106
+ json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
28
107
  },
29
108
  jsonImports: {
30
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
31
- themes: `node ${LIB}/generate-json-imports/themes.js`,
32
- i18n: `node ${LIB}/generate-json-imports/i18n.js`,
109
+ default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
110
+ themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
111
+ i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
33
112
  },
34
- bundle: "rollup --config config/rollup.config.js --environment ES5_BUILD",
35
- samples: {
36
- default: "nps build.samples.api build.samples.docs",
37
- api: `jsdoc -c ${LIB}/jsdoc/config.json`,
38
- docs: `node ${LIB}/documentation/index.js dist/api.json`,
39
- }
113
+ jsImports: {
114
+ default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
115
+ illustrationsLoaders: createIllustrationsLoadersScript,
116
+ },
117
+ bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
118
+ bundle2: ``,
119
+ illustrations: createIllustrationsJSImportsScript,
40
120
  },
121
+ copyProps: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
41
122
  copy: {
42
- default: "nps copy.src copy.test copy.webcomponents-polyfill",
43
- src: "copy-and-watch \"src/**/*.js\" dist/",
44
- test: "copy-and-watch \"test/**/*.*\" dist/test-resources",
45
- "webcomponents-polyfill": `copy-and-watch "${polyfillPath}" dist/webcomponentsjs/`,
123
+ default: "nps copy.src copy.props",
124
+ src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
125
+ props: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
46
126
  },
47
127
  watch: {
48
- default: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle" "nps watch.styles"',
49
- src: 'nps "copy.src --watch --skip-initial-copy"',
50
- test: 'nps "copy.test --watch --skip-initial-copy"',
51
- bundle: "rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV",
128
+ default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" ${options.legacy ? '"nps watch.src"' : ""} "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
129
+ devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
130
+ src: 'nps "copy.src --watch --safe --skip-initial-copy"',
131
+ typescript: tsWatchCommandStandalone,
132
+ props: 'nps "copyProps --watch --safe --skip-initial-copy"',
133
+ bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
52
134
  styles: {
53
135
  default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
54
136
  themes: 'nps "build.styles.themes -w"',
55
- components: 'nps "build.styles.components -w"',
137
+ components: `nps "build.styles.components -w"`,
56
138
  },
57
- templates: "chokidar \"src/**/*.hbs\" -c \"nps build.templates\"",
58
- samples: "chokidar \"test/**/*.sample.html\" -c \"nps build.samples\"",
139
+ templates: 'chokidar "src/**/*.hbs" -i "src/generated" -c "nps build.templates"',
140
+ i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
59
141
  },
60
- dev: 'concurrently "nps serve" "nps watch"',
61
- start: "nps prepare dev",
62
- serve: {
63
- default: "nps serve.prepare serve.run",
64
- prepare: `copy-and-watch "${serveConfig}" dist/`,
65
- run: `serve --no-clipboard -l ${port} dist`,
142
+ start: "nps prepare watch.devServer",
143
+ test: `node "${LIB}/test-runner/test-runner.js"`,
144
+ "test-cy-ci": `${cypressEnvVariables(options)} yarn cypress run --component --browser chrome`,
145
+ "test-cy-ci-suite-1": `${cypressEnvVariables(options, ["TEST_SUITE=SUITE1"])} yarn cypress run --component --browser chrome`,
146
+ "test-cy-ci-suite-2": `${cypressEnvVariables(options, ["TEST_SUITE=SUITE2"])} yarn cypress run --component --browser chrome`,
147
+ "test-cy-open": `${cypressEnvVariables(options)} yarn cypress open --component --browser chrome`,
148
+ "test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
149
+ "test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
150
+ startWithScope: "nps scope.prepare scope.watchWithBundle",
151
+ scope: {
152
+ prepare: "nps scope.lint scope.testPages",
153
+ lint: `node "${LIB}/scoping/lint-src.js"`,
154
+ testPages: {
155
+ default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
156
+ clean: "rimraf test/pages/scoped",
157
+ copy: `node "${LIB}/copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
158
+ replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
159
+ },
160
+ watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
161
+ watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
162
+ bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
66
163
  },
67
- test: {
68
- // --success first - report the exit code of the test run (first command to finish), as serve is always terminated and has a non-0 exit code
69
- default: 'concurrently "nps serve" "nps test.run" --kill-others --success first',
70
- run: "cross-env WDIO_LOG_LEVEL=error FORCE_COLOR=0 wdio config/wdio.conf.js",
164
+ generateAPI: {
165
+ default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
166
+ generateCEM: `${options.dev ? "cross-env UI5_CEM_MODE='dev'" : ""} cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs"`,
167
+ validateCEM: `${options.dev ? "cross-env UI5_CEM_MODE='dev'" : ""} node "${LIB}/cem/validate.js"`,
71
168
  },
72
169
  };
73
170
 
@@ -1,21 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
3
- const cssnano = require('cssnano');
4
- const fs = require("fs");
5
-
6
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
7
-
8
- module.exports = {
9
- plugins: [
10
- postcssImport(),
11
- cssnano({
12
- preset: [
13
- 'default', {
14
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
15
- mergeRules: false, // https://github.com/cssnano/cssnano/issues/730
16
- },
17
- ]
18
- }),
19
- postcssCSStoESM({toReplace: 'src', includeDefaultTheme: true, packageName}),
20
- ]
21
- };
1
+ module.exports = {}
@@ -1,23 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const combineSelectors = require('postcss-combine-duplicated-selectors');
3
- const postcssCSStoJSON = require('../lib/postcss-css-to-json/index.js');
4
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
5
- const cssnano = require('cssnano');
6
-
7
- module.exports = {
8
- plugins: [
9
- postcssImport(),
10
- combineSelectors({
11
- removeDuplicatedProperties: true
12
- }),
13
- cssnano({
14
- preset: [
15
- 'default', {
16
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
17
- },
18
- ]
19
- },),
20
- postcssCSStoJSON({toReplace: 'src'}),
21
- postcssCSStoESM({toReplace: 'src'}),
22
- ]
23
- };
1
+ module.exports = {};
@@ -0,0 +1,9 @@
1
+ // vite.config.js
2
+ const virtualIndex = require('../lib/dev-server/virtual-index-html-plugin.js');
3
+
4
+ module.exports = {
5
+ build: {
6
+ emptyOutDir: false,
7
+ },
8
+ plugins: [virtualIndex()],
9
+ };