@ui5/webcomponents-tools 0.0.0-51202adee → 0.0.0-51cc8ba74
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 +1560 -0
- package/README.md +3 -5
- package/assets-meta.js +11 -10
- package/components-package/eslint.js +51 -15
- package/components-package/nps.js +70 -49
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +7 -10
- package/components-package/wdio.js +35 -13
- package/icons-collection/nps.js +13 -9
- 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 +1413 -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 +66 -0
- package/lib/create-icons/index.js +43 -17
- 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.js → dev-server.mjs} +4 -4
- package/lib/dev-server/virtual-index-html-plugin.js +24 -21
- package/lib/generate-js-imports/illustrations.js +78 -64
- package/lib/generate-json-imports/i18n.js +45 -61
- package/lib/generate-json-imports/themes.js +16 -33
- package/lib/hbs2lit/src/compiler.js +9 -6
- package/lib/hbs2lit/src/litVisitor2.js +42 -17
- 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 +11 -3
- 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 +10 -3
- package/lib/scoping/lint-src.js +8 -7
- package/lib/scoping/scope-test-pages.js +2 -1
- package/lib/test-runner/test-runner.js +10 -2
- package/package.json +23 -13
- package/tsconfig.json +18 -0
- package/components-package/wdio.sync.js +0 -360
- package/lib/esm-abs-to-rel/index.js +0 -58
- package/lib/generate-custom-elements-manifest/index.js +0 -373
- package/lib/jsdoc/config.json +0 -29
- package/lib/jsdoc/configTypescript.json +0 -29
- package/lib/jsdoc/plugin.js +0 -2468
- package/lib/jsdoc/preprocess.js +0 -146
- package/lib/jsdoc/template/publish.js +0 -4120
- package/lib/postcss-css-to-esm/index.js +0 -57
- package/lib/postcss-css-to-json/index.js +0 -47
- package/lib/postcss-new-files/index.js +0 -36
- package/lib/postcss-p/postcss-p.mjs +0 -14
- package/lib/replace-global-core/index.js +0 -25
package/README.md
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
UI5 Web Components - Tools
|
4
2
|
|
5
3
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
6
4
|
|
@@ -10,10 +8,10 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
|
|
10
8
|
## Resources
|
11
9
|
- [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
|
12
10
|
- [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
|
13
|
-
- [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/)
|
14
12
|
|
15
13
|
## Support
|
16
|
-
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://
|
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/).
|
17
15
|
|
18
16
|
## Contribute
|
19
17
|
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
|
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",
|
@@ -1,11 +1,13 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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 = {
|
9
11
|
files: ["*.ts"],
|
10
12
|
parser: "@typescript-eslint/parser",
|
11
13
|
plugins: ["@typescript-eslint"],
|
@@ -14,13 +16,15 @@ module.exports = {
|
|
14
16
|
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
15
17
|
],
|
16
18
|
parserOptions: {
|
17
|
-
|
19
|
+
"project": [
|
20
|
+
"./tsconfig.json"
|
21
|
+
],
|
22
|
+
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
18
23
|
},
|
19
|
-
/**
|
20
|
-
* Typescript Rules
|
21
|
-
*/
|
22
24
|
rules: {
|
23
25
|
"no-shadow": "off",
|
26
|
+
"@typescript-eslint/consistent-type-imports": "error",
|
27
|
+
"import/consistent-type-specifier-style": ["error", "prefer-top-level"],
|
24
28
|
"@typescript-eslint/no-shadow": ["error"],
|
25
29
|
"@typescript-eslint/no-unsafe-member-access": "off",
|
26
30
|
"@typescript-eslint/no-floating-promises": "off",
|
@@ -30,9 +34,40 @@ module.exports = {
|
|
30
34
|
"@typescript-eslint/no-unsafe-call": "off",
|
31
35
|
"@typescript-eslint/no-non-null-assertion": "off",
|
32
36
|
"@typescript-eslint/no-empty-function": "off",
|
37
|
+
"@typescript-eslint/no-empty-interface": "off",
|
33
38
|
"lines-between-class-members": "off",
|
34
39
|
}
|
35
|
-
}
|
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
|
+
|
63
|
+
module.exports = {
|
64
|
+
"env": {
|
65
|
+
"browser": true,
|
66
|
+
"es6": true
|
67
|
+
},
|
68
|
+
"root": true,
|
69
|
+
"extends": "airbnb-base",
|
70
|
+
"overrides": tsMode ? getTsModeOverrides() : [],
|
36
71
|
"parserOptions": {
|
37
72
|
"ecmaVersion": 2018,
|
38
73
|
"sourceType": "module"
|
@@ -75,6 +110,7 @@ module.exports = {
|
|
75
110
|
"curly": [2, "all"],
|
76
111
|
// "default-case": 1, // removed for UI5 WebComponents
|
77
112
|
"import/extensions": ["error", "always"], // override for UI5 WebComponents
|
113
|
+
"import/order": "off",
|
78
114
|
"no-alert": 2,
|
79
115
|
"no-caller": 2,
|
80
116
|
"no-div-regex": 2,
|
@@ -116,7 +152,7 @@ module.exports = {
|
|
116
152
|
"no-shadow-restricted-names": 2,
|
117
153
|
"no-undef-init": 2,
|
118
154
|
"no-undef": 2,
|
119
|
-
"no-unused-vars": [2, {"vars":"all", "args":"none"}],
|
155
|
+
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
|
120
156
|
|
121
157
|
"brace-style": [2, "1tbs", { "allowSingleLine": true }],
|
122
158
|
"camelcase": [1, { "properties": "never" }], // added for UI5 WebComponents
|
@@ -132,7 +168,7 @@ module.exports = {
|
|
132
168
|
"no-new-object": 2,
|
133
169
|
"no-spaced-func": 2,
|
134
170
|
"quote-props": [2, "as-needed", { "keywords": true, "unnecessary": false }],
|
135
|
-
"semi-spacing": [1, {"before": false, "after": true}],
|
171
|
+
"semi-spacing": [1, { "before": false, "after": true }],
|
136
172
|
"semi": 2,
|
137
173
|
"keyword-spacing": 2,
|
138
174
|
"space-infix-ops": 2,
|
@@ -1,21 +1,41 @@
|
|
1
1
|
const path = require("path");
|
2
2
|
const fs = require("fs");
|
3
|
-
const resolve = require("resolve");
|
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
14
|
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
10
15
|
const illustrationsData = options.illustrationsData || [];
|
11
|
-
illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
|
16
|
+
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
|
12
17
|
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
18
|
|
14
|
-
// The script creates the "
|
15
|
-
|
16
|
-
|
17
|
-
const
|
18
|
-
const
|
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
|
+
}
|
19
39
|
|
20
40
|
let viteConfig;
|
21
41
|
if (fs.existsSync("config/vite.config.js")) {
|
@@ -30,10 +50,7 @@ const getScripts = (options) => {
|
|
30
50
|
}
|
31
51
|
|
32
52
|
let eslintConfig;
|
33
|
-
if (fs.existsSync("
|
34
|
-
// old project setup where config file is in separate folder
|
35
|
-
eslintConfig = "--config config/.eslintrc.js";
|
36
|
-
} else if (fs.existsSync(".eslintrc.js")) {
|
53
|
+
if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
|
37
54
|
// preferred way of custom configuration in root project folder
|
38
55
|
eslintConfig = "";
|
39
56
|
} else {
|
@@ -42,72 +59,78 @@ const getScripts = (options) => {
|
|
42
59
|
}
|
43
60
|
|
44
61
|
const scripts = {
|
45
|
-
clean: 'rimraf
|
62
|
+
clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
46
63
|
lint: `eslint . ${eslintConfig}`,
|
47
|
-
lintfix: `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
|
+
},
|
48
70
|
prepare: {
|
49
|
-
default:
|
50
|
-
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps
|
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"',
|
51
73
|
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
74
|
+
typescript: tsCommandOld,
|
52
75
|
},
|
53
|
-
typescript: tsCommand,
|
54
76
|
build: {
|
55
|
-
default: "nps lint
|
56
|
-
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`,
|
57
79
|
styles: {
|
58
|
-
default: "nps build.styles.themes build.styles.components"
|
59
|
-
themes: `node "${LIB}/
|
60
|
-
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"`,
|
61
83
|
},
|
62
84
|
i18n: {
|
63
85
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
64
|
-
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n
|
86
|
+
defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
65
87
|
json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
66
88
|
},
|
67
89
|
jsonImports: {
|
68
|
-
default: "mkdirp
|
69
|
-
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes
|
70
|
-
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`,
|
71
93
|
},
|
72
94
|
jsImports: {
|
73
|
-
default: "mkdirp
|
95
|
+
default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
74
96
|
illustrationsLoaders: createIllustrationsLoadersScript,
|
75
97
|
},
|
76
|
-
bundle: `vite build ${viteConfig}`,
|
98
|
+
bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
|
99
|
+
bundle2: ``,
|
77
100
|
illustrations: createIllustrationsJSImportsScript,
|
78
101
|
},
|
102
|
+
copyProps: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
|
79
103
|
copy: {
|
80
104
|
default: "nps copy.src copy.props",
|
81
|
-
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
82
|
-
props: `node "${LIB}/copy-and-watch/index.js" --silent "src
|
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/`,
|
83
107
|
},
|
84
108
|
watch: {
|
85
|
-
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"`,
|
86
110
|
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
87
111
|
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
88
|
-
typescript:
|
89
|
-
props: 'nps "
|
90
|
-
bundle: `node ${LIB}/dev-server/dev-server.
|
112
|
+
typescript: tsWatchCommandStandalone,
|
113
|
+
props: 'nps "copyProps --watch --safe --skip-initial-copy"',
|
114
|
+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
|
91
115
|
styles: {
|
92
116
|
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
|
93
117
|
themes: 'nps "build.styles.themes -w"',
|
94
|
-
components:
|
95
|
-
default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
|
96
|
-
existingFiles: `nps "build.styles.components -w"`,
|
97
|
-
newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
|
98
|
-
},
|
118
|
+
components: `nps "build.styles.components -w"`,
|
99
119
|
},
|
100
|
-
templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
|
101
|
-
api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
|
120
|
+
templates: 'chokidar "src/**/*.hbs" -i "src/generated" -c "nps build.templates"',
|
102
121
|
i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
|
103
122
|
},
|
104
123
|
start: "nps prepare watch.devServer",
|
105
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`,
|
106
129
|
"test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
|
107
130
|
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
108
131
|
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
109
132
|
scope: {
|
110
|
-
prepare: "nps scope.lint
|
133
|
+
prepare: "nps scope.lint scope.testPages",
|
111
134
|
lint: `node "${LIB}/scoping/lint-src.js"`,
|
112
135
|
testPages: {
|
113
136
|
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
@@ -116,15 +139,13 @@ const getScripts = (options) => {
|
|
116
139
|
replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
|
117
140
|
},
|
118
141
|
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
|
119
|
-
watch: 'concurrently "nps watch.templates" "nps watch.
|
120
|
-
bundle: `node ${LIB}/dev-server/dev-server.
|
142
|
+
watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
|
143
|
+
bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
|
121
144
|
},
|
122
145
|
generateAPI: {
|
123
|
-
default: "nps generateAPI.
|
124
|
-
|
125
|
-
|
126
|
-
jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
|
127
|
-
cleanup: "rimraf jsdoc-dist/"
|
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"`,
|
128
149
|
},
|
129
150
|
};
|
130
151
|
|
@@ -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,12 +1,9 @@
|
|
1
1
|
// vite.config.js
|
2
|
-
const
|
3
|
-
const virtualIndex = require("../lib/dev-server/virtual-index-html-plugin.js");
|
2
|
+
const virtualIndex = require('../lib/dev-server/virtual-index-html-plugin.js');
|
4
3
|
|
5
|
-
module.exports =
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
}
|
12
|
-
});
|
4
|
+
module.exports = {
|
5
|
+
build: {
|
6
|
+
emptyOutDir: false,
|
7
|
+
},
|
8
|
+
plugins: [virtualIndex()],
|
9
|
+
};
|
@@ -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
|
// ====================
|
@@ -56,7 +59,16 @@ exports.config = {
|
|
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
|
}],
|
@@ -99,8 +111,7 @@ 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', '
|
103
|
-
['static-server', {
|
114
|
+
services: ['chromedriver', ['static-server', {
|
104
115
|
folders: [
|
105
116
|
{ mount: '/', path: './dist' },
|
106
117
|
],
|
@@ -153,6 +164,9 @@ exports.config = {
|
|
153
164
|
*/
|
154
165
|
// beforeSession: function (config, capabilities, specs) {
|
155
166
|
// },
|
167
|
+
beforeSession: () => {
|
168
|
+
dns.setDefaultResultOrder('ipv4first');
|
169
|
+
},
|
156
170
|
/**
|
157
171
|
* Gets executed before test execution begins. At this point you can access to all global
|
158
172
|
* variables like `browser`. It is the perfect place to define custom commands.
|
@@ -223,12 +237,11 @@ exports.config = {
|
|
223
237
|
}, this, attrName);
|
224
238
|
}, true);
|
225
239
|
|
226
|
-
await browser.addCommand("
|
227
|
-
return browser.executeAsync(
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}, false);
|
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);
|
232
245
|
|
233
246
|
await browser.addLocatorStrategy('activeElement', (selector) => {
|
234
247
|
return document.querySelector(selector).shadowRoot.activeElement;
|
@@ -245,11 +258,11 @@ exports.config = {
|
|
245
258
|
"$$",
|
246
259
|
"getAttribute",
|
247
260
|
"hasAttribute", // custom
|
261
|
+
"matches", // custom
|
248
262
|
"getCSSProperty",
|
249
263
|
"getHTML",
|
250
264
|
"getProperty",
|
251
265
|
"getSize",
|
252
|
-
"getStaticAreaItemClassName", // custom
|
253
266
|
"getText",
|
254
267
|
"getValue",
|
255
268
|
"hasClass", // custom
|
@@ -261,7 +274,7 @@ exports.config = {
|
|
261
274
|
"isFocusedDeep", // custom
|
262
275
|
"isFocusedDeepElement", // custom
|
263
276
|
"shadow$",
|
264
|
-
"shadow$$"
|
277
|
+
"shadow$$"
|
265
278
|
];
|
266
279
|
if (waitFor.includes(commandName)) {
|
267
280
|
await browser.executeAsync(function (done) {
|
@@ -298,8 +311,17 @@ exports.config = {
|
|
298
311
|
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
299
312
|
* @param {Object} test test details
|
300
313
|
*/
|
301
|
-
|
302
|
-
|
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
|
+
},
|
303
325
|
/**
|
304
326
|
* Hook that gets executed after the suite has ended
|
305
327
|
* @param {Object} suite suite details
|
package/icons-collection/nps.js
CHANGED
@@ -21,7 +21,7 @@ const copyIconAssetsCommand = (options) => {
|
|
21
21
|
return {
|
22
22
|
default: "nps copy.json-imports copy.icon-collection",
|
23
23
|
"json-imports": `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
24
|
-
"icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json"
|
24
|
+
"icon-collection": `node "${LIB}/copy-and-watch/index.js" --silent "src/*.json" src/generated/assets/`,
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
@@ -32,7 +32,7 @@ const copyIconAssetsCommand = (options) => {
|
|
32
32
|
|
33
33
|
options.versions.forEach((v) => {
|
34
34
|
command.default += ` copy.icon-collection${v}`;
|
35
|
-
command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json"
|
35
|
+
command[`icon-collection${v}`] = `node "${LIB}/copy-and-watch/index.js" --silent "src/${v}/*.json" src/generated/assets/${v}/`;
|
36
36
|
});
|
37
37
|
|
38
38
|
return command;
|
@@ -41,24 +41,28 @@ const copyIconAssetsCommand = (options) => {
|
|
41
41
|
const getScripts = (options) => {
|
42
42
|
const createJSImportsCmd = createIconImportsCommand(options);
|
43
43
|
const copyAssetsCmd = copyIconAssetsCommand(options);
|
44
|
+
const tsCommand = !options.legacy ? "tsc --build" : "";
|
45
|
+
const tsCrossEnv = !options.legacy ? "cross-env UI5_TS=true" : "";
|
44
46
|
|
45
47
|
const scripts = {
|
46
|
-
clean: "rimraf dist",
|
48
|
+
clean: "rimraf dist && rimraf src/generated",
|
47
49
|
copy: copyAssetsCmd,
|
50
|
+
generate: `${tsCrossEnv} nps clean copy build.i18n build.icons build.jsonImports copyjson`,
|
51
|
+
copyjson: "copy-and-watch \"src/generated/**/*.json\" dist/generated/",
|
48
52
|
build: {
|
49
|
-
default:
|
53
|
+
default: `${tsCrossEnv} nps clean copy build.i18n typescript build.icons build.jsonImports`,
|
50
54
|
i18n: {
|
51
55
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
52
|
-
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n
|
53
|
-
json: `mkdirp
|
56
|
+
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
57
|
+
json: `mkdirp src/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
|
54
58
|
},
|
55
59
|
jsonImports: {
|
56
|
-
default: "mkdirp
|
57
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js"
|
60
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.i18n",
|
61
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" src/generated/assets/i18n src/generated/json-imports`,
|
58
62
|
},
|
59
63
|
icons: createJSImportsCmd,
|
60
64
|
},
|
61
|
-
typescript:
|
65
|
+
typescript: tsCommand,
|
62
66
|
};
|
63
67
|
|
64
68
|
return scripts;
|