@ui5/webcomponents-tools 0.0.0-b6f02e4b3 → 0.0.0-b804b8982
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1674 -0
- package/README.md +6 -9
- package/assets-meta.js +11 -10
- package/bin/dev.js +1 -5
- package/components-package/eslint.js +66 -2
- package/components-package/nps.js +111 -61
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +9 -0
- package/components-package/wdio.js +61 -15
- package/icons-collection/nps.js +13 -8
- package/lib/amd-to-es6/index.js +102 -0
- package/lib/amd-to-es6/no-remaining-require.js +33 -0
- package/lib/cem/custom-elements-manifest.config.mjs +547 -0
- package/lib/cem/event.mjs +168 -0
- package/lib/cem/schema-internal.json +1422 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +808 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +423 -0
- package/lib/cem/validate.js +67 -0
- package/lib/copy-and-watch/index.js +0 -1
- package/lib/copy-list/index.js +2 -2
- package/lib/create-icons/index.js +65 -14
- package/lib/create-illustrations/index.js +51 -30
- package/lib/create-new-component/Component.js +74 -0
- package/lib/create-new-component/ComponentTemplate.js +12 -0
- package/lib/create-new-component/index.js +60 -101
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +74 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/css-processors/shared.mjs +56 -0
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/dev-server.mjs +66 -0
- package/lib/dev-server/virtual-index-html-plugin.js +56 -0
- package/lib/generate-js-imports/illustrations.js +86 -0
- package/lib/generate-json-imports/i18n.js +45 -61
- package/lib/generate-json-imports/themes.js +18 -35
- package/lib/hbs2lit/src/compiler.js +16 -5
- package/lib/hbs2lit/src/litVisitor2.js +85 -22
- package/lib/hbs2lit/src/svgProcessor.js +12 -5
- package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
- package/lib/hbs2ui5/index.js +23 -6
- package/lib/i18n/defaults.js +19 -2
- package/lib/i18n/toJSON.js +1 -1
- package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
- package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
- package/lib/scoping/get-all-tags.js +11 -11
- package/lib/scoping/lint-src.js +8 -7
- package/lib/scoping/scope-test-pages.js +2 -1
- package/lib/test-runner/test-runner.js +71 -0
- package/package.json +32 -22
- package/tsconfig.json +18 -0
- package/components-package/rollup-plugins/empty-module.js +0 -15
- package/components-package/rollup.js +0 -150
- package/components-package/wdio.sync.js +0 -360
- package/lib/documentation/index.js +0 -168
- package/lib/documentation/templates/api-component-since.js +0 -3
- package/lib/documentation/templates/api-css-variables-section.js +0 -24
- package/lib/documentation/templates/api-events-section.js +0 -35
- package/lib/documentation/templates/api-methods-section.js +0 -26
- package/lib/documentation/templates/api-properties-section.js +0 -42
- package/lib/documentation/templates/api-slots-section.js +0 -28
- package/lib/documentation/templates/template.js +0 -39
- package/lib/esm-abs-to-rel/index.js +0 -58
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2436
- package/lib/jsdoc/template/publish.js +0 -4112
- package/lib/postcss-css-to-esm/index.js +0 -45
- package/lib/postcss-css-to-json/index.js +0 -36
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -11
- package/lib/replace-global-core/index.js +0 -25
- package/lib/serve/index.js +0 -46
- package/lib/serve/serve.json +0 -3
- package/package-lock.json +0 -48
package/README.md
CHANGED
@@ -1,24 +1,21 @@
|
|
1
|
-
UI5 Web Components - Tools
|
2
2
|
|
3
|
-
# UI5 Web Components - Tools
|
4
|
-
|
5
|
-
[](https://travis-ci.org/SAP/ui5-webcomponents)
|
6
3
|
[](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/
|
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/
|
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/
|
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/
|
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/
|
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
CHANGED
@@ -1,20 +1,16 @@
|
|
1
1
|
const assetsMeta = {
|
2
2
|
"themes": {
|
3
|
-
"default": "
|
3
|
+
"default": "sap_horizon",
|
4
4
|
"all": [
|
5
5
|
"sap_fiori_3",
|
6
6
|
"sap_fiori_3_dark",
|
7
|
-
"sap_belize",
|
8
|
-
"sap_belize_hcb",
|
9
|
-
"sap_belize_hcw",
|
10
7
|
"sap_fiori_3_hcb",
|
11
8
|
"sap_fiori_3_hcw",
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
]
|
9
|
+
"sap_horizon",
|
10
|
+
"sap_horizon_dark",
|
11
|
+
"sap_horizon_hcb",
|
12
|
+
"sap_horizon_hcw",
|
13
|
+
],
|
18
14
|
},
|
19
15
|
"languages": {
|
20
16
|
"default": "en",
|
@@ -22,6 +18,7 @@ const assetsMeta = {
|
|
22
18
|
"ar",
|
23
19
|
"bg",
|
24
20
|
"ca",
|
21
|
+
"cnr",
|
25
22
|
"cs",
|
26
23
|
"cy",
|
27
24
|
"da",
|
@@ -49,6 +46,7 @@ const assetsMeta = {
|
|
49
46
|
"ko",
|
50
47
|
"lt",
|
51
48
|
"lv",
|
49
|
+
"mk",
|
52
50
|
"ms",
|
53
51
|
"nl",
|
54
52
|
"no",
|
@@ -60,6 +58,7 @@ const assetsMeta = {
|
|
60
58
|
"sh",
|
61
59
|
"sk",
|
62
60
|
"sl",
|
61
|
+
"sr",
|
63
62
|
"sv",
|
64
63
|
"th",
|
65
64
|
"tr",
|
@@ -77,6 +76,7 @@ const assetsMeta = {
|
|
77
76
|
"ar_SA",
|
78
77
|
"bg",
|
79
78
|
"ca",
|
79
|
+
"cnr",
|
80
80
|
"cs",
|
81
81
|
"da",
|
82
82
|
"de",
|
@@ -124,6 +124,7 @@ const assetsMeta = {
|
|
124
124
|
"lt",
|
125
125
|
"lv",
|
126
126
|
"ms",
|
127
|
+
"mk",
|
127
128
|
"nb",
|
128
129
|
"nl",
|
129
130
|
"nl_BE",
|
package/bin/dev.js
CHANGED
@@ -10,11 +10,7 @@ if (command === "watch") {
|
|
10
10
|
command = `watch.${argument}`;
|
11
11
|
}
|
12
12
|
} else if (command === "test") {
|
13
|
-
|
14
|
-
command = `test.run`;
|
15
|
-
} else if (argument) { // yarn test test/specs/Button.spec.js
|
16
|
-
command = `test.spec --spec ${argument}`;
|
17
|
-
}
|
13
|
+
command = `test ${process.argv.slice(3).join(" ")}`;
|
18
14
|
}
|
19
15
|
|
20
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,102 +1,152 @@
|
|
1
1
|
const path = require("path");
|
2
2
|
const fs = require("fs");
|
3
|
-
|
4
3
|
const LIB = path.join(__dirname, `../lib/`);
|
5
|
-
|
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
|
+
}
|
6
11
|
|
7
12
|
const getScripts = (options) => {
|
8
13
|
|
9
|
-
|
10
|
-
const
|
11
|
-
|
14
|
+
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
15
|
+
const illustrationsData = options.illustrationsData || [];
|
16
|
+
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
|
17
|
+
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
18
|
+
|
19
|
+
// The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
20
|
+
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(" && ");
|
21
|
+
|
22
|
+
const tsOption = !options.legacy || options.jsx;
|
23
|
+
const tsCommandOld = tsOption ? "tsc" : "";
|
24
|
+
let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
|
25
|
+
// this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
|
26
|
+
if (options.noWatchTS) {
|
27
|
+
tsWatchCommandStandalone = "";
|
28
|
+
}
|
29
|
+
const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
|
30
|
+
|
31
|
+
if (tsOption) {
|
32
|
+
try {
|
33
|
+
require("typescript");
|
34
|
+
} catch(e) {
|
35
|
+
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.`);
|
36
|
+
process.exit(e.code);
|
37
|
+
}
|
38
|
+
}
|
12
39
|
|
13
|
-
|
40
|
+
let viteConfig;
|
41
|
+
if (fs.existsSync("config/vite.config.js")) {
|
42
|
+
// old project setup where config file is in separate folder
|
43
|
+
viteConfig = "-c config/vite.config.js";
|
44
|
+
} else if (fs.existsSync("vite.config.js")) {
|
45
|
+
// preferred way of custom configuration in root project folder
|
46
|
+
viteConfig = "";
|
47
|
+
} else {
|
48
|
+
// no custom configuration - use default from tools project
|
49
|
+
viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
|
50
|
+
}
|
14
51
|
|
15
|
-
let
|
52
|
+
let eslintConfig;
|
53
|
+
if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
|
54
|
+
// preferred way of custom configuration in root project folder
|
55
|
+
eslintConfig = "";
|
56
|
+
} else {
|
57
|
+
// no custom configuration - use default from tools project
|
58
|
+
eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
|
59
|
+
}
|
16
60
|
|
17
61
|
const scripts = {
|
18
|
-
clean:
|
19
|
-
lint:
|
20
|
-
lintfix:
|
62
|
+
clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
63
|
+
lint: `eslint . ${eslintConfig}`,
|
64
|
+
lintfix: `eslint . ${eslintConfig} --fix`,
|
65
|
+
generate: {
|
66
|
+
default: `${tsCrossEnv} nps prepare.all`,
|
67
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copyProps" "nps build.illustrations"',
|
68
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
69
|
+
},
|
21
70
|
prepare: {
|
22
|
-
default:
|
23
|
-
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps
|
24
|
-
styleRelated: "nps build.styles build.jsonImports",
|
71
|
+
default: `${tsCrossEnv} nps clean prepare.all ${options.legacy ? "copy" : ""} copyProps prepare.typescript generateAPI`,
|
72
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
|
73
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
74
|
+
typescript: tsCommandOld,
|
25
75
|
},
|
26
76
|
build: {
|
27
|
-
default: "nps lint
|
28
|
-
templates: `mkdirp
|
77
|
+
default: "nps prepare lint build.bundle", // build.bundle2
|
78
|
+
templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
|
29
79
|
styles: {
|
30
|
-
default: "nps build.styles.themes build.styles.components"
|
31
|
-
themes: `node "${LIB}/
|
32
|
-
components: "
|
80
|
+
default: `concurrently "nps build.styles.themes" "nps build.styles.components"`,
|
81
|
+
themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
|
82
|
+
components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
|
33
83
|
},
|
34
84
|
i18n: {
|
35
85
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
36
|
-
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n
|
86
|
+
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
37
87
|
json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
38
88
|
},
|
39
89
|
jsonImports: {
|
40
|
-
default: "mkdirp
|
41
|
-
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes
|
42
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n
|
90
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
|
91
|
+
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
|
92
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
|
43
93
|
},
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
api: `jsdoc -c "${LIB}/jsdoc/config.json"`,
|
48
|
-
docs: `node "${LIB}/documentation/index.js" dist/api.json`,
|
94
|
+
jsImports: {
|
95
|
+
default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
96
|
+
illustrationsLoaders: createIllustrationsLoadersScript,
|
49
97
|
},
|
50
|
-
|
98
|
+
bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
|
99
|
+
bundle2: ``,
|
100
|
+
illustrations: createIllustrationsJSImportsScript,
|
51
101
|
},
|
102
|
+
copyProps: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
|
52
103
|
copy: {
|
53
|
-
default: "nps copy.src copy.props
|
54
|
-
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
55
|
-
props: `node "${LIB}/copy-and-watch/index.js" --silent "src
|
56
|
-
test: `node "${LIB}/copy-and-watch/index.js" --silent "test/**/*.*" dist/test-resources`,
|
104
|
+
default: "nps copy.src copy.props",
|
105
|
+
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
|
106
|
+
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
|
57
107
|
},
|
58
108
|
watch: {
|
59
|
-
default:
|
109
|
+
default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" ${options.legacy ? '"nps watch.src"' : ""} "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
|
110
|
+
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
60
111
|
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
61
|
-
|
62
|
-
|
63
|
-
bundle:
|
112
|
+
typescript: tsWatchCommandStandalone,
|
113
|
+
props: 'nps "copyProps --watch --safe --skip-initial-copy"',
|
114
|
+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
|
64
115
|
styles: {
|
65
116
|
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
|
66
117
|
themes: 'nps "build.styles.themes -w"',
|
67
|
-
components:
|
68
|
-
default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
|
69
|
-
existingFiles: `nps "build.styles.components -w"`,
|
70
|
-
newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
|
71
|
-
},
|
118
|
+
components: `nps "build.styles.components -w"`,
|
72
119
|
},
|
73
|
-
templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
|
74
|
-
samples: 'chokidar "test/**/*.sample.html" -c "nps build.samples"',
|
120
|
+
templates: 'chokidar "src/**/*.hbs" -i "src/generated" -c "nps build.templates"',
|
75
121
|
i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
|
76
122
|
},
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
test:
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
startWithScope: "nps scope.prepare scope.dev",
|
123
|
+
start: "nps prepare watch.devServer",
|
124
|
+
test: `node "${LIB}/test-runner/test-runner.js"`,
|
125
|
+
"test-cy-ci": `cross-env CYPRESS_COVERAGE=true yarn cypress run --component --browser chrome`,
|
126
|
+
"test-cy-ci-suite-1": `cross-env CYPRESS_COVERAGE=true TEST_SUITE=SUITE1 yarn cypress run --component --browser chrome`,
|
127
|
+
"test-cy-ci-suite-2": `cross-env CYPRESS_COVERAGE=true TEST_SUITE=SUITE2 yarn cypress run --component --browser chrome`,
|
128
|
+
"test-cy-open": `cross-env CYPRESS_COVERAGE=true yarn cypress open --component --browser chrome`,
|
129
|
+
"test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
|
130
|
+
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
131
|
+
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
87
132
|
scope: {
|
88
|
-
prepare: "nps scope.lint
|
133
|
+
prepare: "nps scope.lint scope.testPages",
|
89
134
|
lint: `node "${LIB}/scoping/lint-src.js"`,
|
90
135
|
testPages: {
|
91
136
|
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
92
|
-
clean: "rimraf
|
93
|
-
copy: `node "${LIB}/copy-and-watch/index.js" --silent "
|
94
|
-
replace: `node "${LIB}/scoping/scope-test-pages.js"
|
137
|
+
clean: "rimraf test/pages/scoped",
|
138
|
+
copy: `node "${LIB}/copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
|
139
|
+
replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
|
95
140
|
},
|
96
|
-
|
97
|
-
watch: 'concurrently "nps watch.templates" "nps watch.
|
98
|
-
bundle:
|
99
|
-
}
|
141
|
+
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
|
142
|
+
watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
|
143
|
+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
|
144
|
+
},
|
145
|
+
generateAPI: {
|
146
|
+
default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
|
147
|
+
generateCEM: `${options.dev ? "cross-env UI5_CEM_MODE='dev'" : ""} cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs"`,
|
148
|
+
validateCEM: `${options.dev ? "cross-env UI5_CEM_MODE='dev'" : ""} node "${LIB}/cem/validate.js"`,
|
149
|
+
},
|
100
150
|
};
|
101
151
|
|
102
152
|
return scripts;
|
@@ -1,21 +1 @@
|
|
1
|
-
|
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,26 +1 @@
|
|
1
|
-
|
2
|
-
const combineSelectors = require('../lib/postcss-combine-duplicated-selectors/index.js');
|
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
|
-
const fs = require("fs");
|
7
|
-
|
8
|
-
const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
|
9
|
-
|
10
|
-
module.exports = {
|
11
|
-
plugins: [
|
12
|
-
postcssImport(),
|
13
|
-
combineSelectors({
|
14
|
-
removeDuplicatedProperties: true
|
15
|
-
}),
|
16
|
-
cssnano({
|
17
|
-
preset: [
|
18
|
-
'default', {
|
19
|
-
mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
|
20
|
-
},
|
21
|
-
]
|
22
|
-
},),
|
23
|
-
postcssCSStoJSON({toReplace: 'src', packageName}),
|
24
|
-
postcssCSStoESM({toReplace: 'src', packageName}),
|
25
|
-
]
|
26
|
-
};
|
1
|
+
module.exports = {};
|
@@ -1,3 +1,6 @@
|
|
1
|
+
const dns = require("node:dns");
|
2
|
+
const assert = require("chai").assert;
|
3
|
+
|
1
4
|
exports.config = {
|
2
5
|
//
|
3
6
|
// ====================
|
@@ -50,13 +53,22 @@ exports.config = {
|
|
50
53
|
// maxInstances can get overwritten per capability. So if you have an in-house Selenium
|
51
54
|
// grid with only 5 firefox instances available you can make sure that not more than
|
52
55
|
// 5 instances get started at a time.
|
53
|
-
maxInstances:
|
56
|
+
maxInstances: 5,
|
54
57
|
//
|
55
58
|
browserName: 'chrome',
|
56
59
|
'goog:chromeOptions': {
|
57
60
|
// to run chrome headless the following flags are required
|
58
61
|
// (see https://developers.google.com/web/updates/2017/04/headless-chrome)
|
59
|
-
args: [
|
62
|
+
args: [
|
63
|
+
'--headless',
|
64
|
+
'--disable-search-engine-choice-screen',
|
65
|
+
'--start-maximized',
|
66
|
+
'--no-sandbox',
|
67
|
+
'--disable-gpu',
|
68
|
+
'--disable-infobars',
|
69
|
+
'--disable-extensions',
|
70
|
+
'--disable-dev-shm-usage',
|
71
|
+
],
|
60
72
|
// args: ['--disable-gpu'],
|
61
73
|
}
|
62
74
|
}],
|
@@ -82,7 +94,7 @@ exports.config = {
|
|
82
94
|
// with `/`, the base url gets prepended, not including the path portion of your baseUrl.
|
83
95
|
// If your `url` parameter starts without a scheme or `/` (like `some/path`), the base url
|
84
96
|
// gets prepended directly.
|
85
|
-
baseUrl:
|
97
|
+
baseUrl: 'http://localhost:4567', // This is important since WDIO 7+ does not accept an empty string for baseUrl
|
86
98
|
path: '',
|
87
99
|
//
|
88
100
|
// Default timeout for all waitFor* commands.
|
@@ -99,7 +111,13 @@ exports.config = {
|
|
99
111
|
// Services take over a specific job you don't want to take care of. They enhance
|
100
112
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
101
113
|
// commands. Instead, they hook themselves up into the test process.
|
102
|
-
services: ['chromedriver'
|
114
|
+
services: ['chromedriver', ['static-server', {
|
115
|
+
folders: [
|
116
|
+
{ mount: '/', path: './dist' },
|
117
|
+
],
|
118
|
+
port: '4567',
|
119
|
+
}],
|
120
|
+
],
|
103
121
|
// options
|
104
122
|
chromeDriverArgs: ['--port=9515'], // default
|
105
123
|
// Framework you want to run your specs with.
|
@@ -146,6 +164,9 @@ exports.config = {
|
|
146
164
|
*/
|
147
165
|
// beforeSession: function (config, capabilities, specs) {
|
148
166
|
// },
|
167
|
+
beforeSession: () => {
|
168
|
+
dns.setDefaultResultOrder('ipv4first');
|
169
|
+
},
|
149
170
|
/**
|
150
171
|
* Gets executed before test execution begins. At this point you can access to all global
|
151
172
|
* variables like `browser`. It is the perfect place to define custom commands.
|
@@ -210,12 +231,17 @@ exports.config = {
|
|
210
231
|
}, this, className);
|
211
232
|
}, true);
|
212
233
|
|
213
|
-
await browser.addCommand("
|
214
|
-
return browser.executeAsync(
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
234
|
+
await browser.addCommand("hasAttribute", async function(attrName) {
|
235
|
+
return browser.executeAsync((elem, attrName, done) => {
|
236
|
+
done(elem.hasAttribute(attrName));
|
237
|
+
}, this, attrName);
|
238
|
+
}, true);
|
239
|
+
|
240
|
+
await browser.addCommand("matches", async function(selector) {
|
241
|
+
return browser.executeAsync((elem, selector, done) => {
|
242
|
+
done(elem.matches(selector));
|
243
|
+
}, this, selector);
|
244
|
+
}, true);
|
219
245
|
|
220
246
|
await browser.addLocatorStrategy('activeElement', (selector) => {
|
221
247
|
return document.querySelector(selector).shadowRoot.activeElement;
|
@@ -231,11 +257,12 @@ exports.config = {
|
|
231
257
|
"$",
|
232
258
|
"$$",
|
233
259
|
"getAttribute",
|
260
|
+
"hasAttribute", // custom
|
261
|
+
"matches", // custom
|
234
262
|
"getCSSProperty",
|
235
263
|
"getHTML",
|
236
264
|
"getProperty",
|
237
265
|
"getSize",
|
238
|
-
"getStaticAreaItemClassName", // custom
|
239
266
|
"getText",
|
240
267
|
"getValue",
|
241
268
|
"hasClass", // custom
|
@@ -247,7 +274,7 @@ exports.config = {
|
|
247
274
|
"isFocusedDeep", // custom
|
248
275
|
"isFocusedDeepElement", // custom
|
249
276
|
"shadow$",
|
250
|
-
"shadow$$"
|
277
|
+
"shadow$$"
|
251
278
|
];
|
252
279
|
if (waitFor.includes(commandName)) {
|
253
280
|
await browser.executeAsync(function (done) {
|
@@ -284,8 +311,17 @@ exports.config = {
|
|
284
311
|
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
285
312
|
* @param {Object} test test details
|
286
313
|
*/
|
287
|
-
|
288
|
-
|
314
|
+
afterTest: async function (test) {
|
315
|
+
// fetch the browser logs and fail the test if there are `console.error` messages with the `[UI5-FWK]` marker
|
316
|
+
const logs = await browser.getLogs('browser');
|
317
|
+
const severeLogs = logs
|
318
|
+
.filter(l => l.level === "SEVERE" && l.message.includes("[UI5-FWK]"))
|
319
|
+
.map(l => l.message);
|
320
|
+
|
321
|
+
if (severeLogs.length) {
|
322
|
+
test.callback(new Error(`[${test.title}]\n\n ${severeLogs.join("\n ")}`));
|
323
|
+
}
|
324
|
+
},
|
289
325
|
/**
|
290
326
|
* Hook that gets executed after the suite has ended
|
291
327
|
* @param {Object} suite suite details
|
@@ -316,7 +352,6 @@ exports.config = {
|
|
316
352
|
"click",
|
317
353
|
"doubleClick",
|
318
354
|
"dragAndDrop",
|
319
|
-
"keys",
|
320
355
|
"pause",
|
321
356
|
"removeAttribute", // custom
|
322
357
|
"scrollIntoView",
|
@@ -327,10 +362,21 @@ exports.config = {
|
|
327
362
|
"touchAction",
|
328
363
|
"url",
|
329
364
|
];
|
365
|
+
|
366
|
+
const waitForWithDelay = [
|
367
|
+
"keys",
|
368
|
+
];
|
369
|
+
|
330
370
|
if (waitFor.includes(commandName)) {
|
331
371
|
await browser.executeAsync(function (done) {
|
332
372
|
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
333
373
|
});
|
374
|
+
} else if (waitForWithDelay.includes(commandName)) {
|
375
|
+
await browser.executeAsync(function (done) {
|
376
|
+
setTimeout(() => {
|
377
|
+
window["sap-ui-webcomponents-bundle"].renderFinished().then(done);
|
378
|
+
}, 10);
|
379
|
+
});
|
334
380
|
}
|
335
381
|
},
|
336
382
|
/**
|