@ui5/webcomponents-tools 0.0.0-7a547f8cc → 0.0.0-7c7170d4a
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 +1019 -0
- package/README.md +2 -1
- package/assets-meta.js +15 -10
- package/components-package/eslint.js +36 -28
- package/components-package/nps.js +55 -46
- package/components-package/postcss.components.js +1 -21
- package/components-package/postcss.themes.js +1 -26
- package/components-package/vite.config.js +6 -5
- package/components-package/wdio.js +34 -13
- package/icons-collection/nps.js +9 -7
- 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 +501 -0
- package/lib/cem/event.mjs +131 -0
- package/lib/cem/schema-internal.json +1357 -0
- package/lib/cem/schema.json +1098 -0
- package/lib/cem/types-internal.d.ts +796 -0
- package/lib/cem/types.d.ts +736 -0
- package/lib/cem/utils.mjs +384 -0
- package/lib/cem/validate.js +70 -0
- package/lib/create-icons/index.js +38 -13
- package/lib/create-illustrations/index.js +51 -30
- package/lib/create-new-component/index.js +61 -101
- package/lib/create-new-component/tsFileContentTemplate.js +71 -0
- package/lib/css-processors/css-processor-component-styles.mjs +48 -0
- package/lib/css-processors/css-processor-components.mjs +77 -0
- package/lib/css-processors/css-processor-themes.mjs +79 -0
- package/lib/css-processors/scope-variables.mjs +49 -0
- package/lib/{postcss-css-to-esm/index.js → css-processors/shared.mjs} +36 -50
- package/lib/dev-server/custom-hot-update-plugin.js +39 -0
- package/lib/dev-server/ssr-dom-shim-loader.js +26 -0
- package/lib/dev-server/virtual-index-html-plugin.js +1 -2
- package/lib/generate-js-imports/illustrations.js +78 -64
- package/lib/generate-json-imports/i18n.js +10 -37
- package/lib/generate-json-imports/themes.js +9 -31
- 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 +32 -4
- package/lib/hbs2ui5/index.js +21 -4
- package/lib/i18n/defaults.js +1 -1
- 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 +1 -1
- 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 +19 -11
- 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 -327
- 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-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,5 +1,6 @@
|
|
1
1
|

|
2
2
|
|
3
|
+
|
3
4
|
# UI5 Web Components - Tools
|
4
5
|
|
5
6
|
[](https://www.npmjs.com/package/@ui5/webcomponents)
|
@@ -13,7 +14,7 @@ used by other UI5 Web Components packages, such as `main` and `fiori`.
|
|
13
14
|
- [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
|
14
15
|
|
15
16
|
## 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://
|
17
|
+
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
18
|
|
18
19
|
## Contribute
|
19
20
|
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,20 @@
|
|
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
|
+
"sap_horizon_exp",
|
14
|
+
"sap_horizon_dark_exp",
|
15
|
+
"sap_horizon_hcb_exp",
|
16
|
+
"sap_horizon_hcw_exp",
|
17
|
+
],
|
18
18
|
},
|
19
19
|
"languages": {
|
20
20
|
"default": "en",
|
@@ -22,6 +22,7 @@ const assetsMeta = {
|
|
22
22
|
"ar",
|
23
23
|
"bg",
|
24
24
|
"ca",
|
25
|
+
"cnr",
|
25
26
|
"cs",
|
26
27
|
"cy",
|
27
28
|
"da",
|
@@ -49,6 +50,7 @@ const assetsMeta = {
|
|
49
50
|
"ko",
|
50
51
|
"lt",
|
51
52
|
"lv",
|
53
|
+
"mk",
|
52
54
|
"ms",
|
53
55
|
"nl",
|
54
56
|
"no",
|
@@ -60,6 +62,7 @@ const assetsMeta = {
|
|
60
62
|
"sh",
|
61
63
|
"sk",
|
62
64
|
"sl",
|
65
|
+
"sr",
|
63
66
|
"sv",
|
64
67
|
"th",
|
65
68
|
"tr",
|
@@ -77,6 +80,7 @@ const assetsMeta = {
|
|
77
80
|
"ar_SA",
|
78
81
|
"bg",
|
79
82
|
"ca",
|
83
|
+
"cnr",
|
80
84
|
"cs",
|
81
85
|
"da",
|
82
86
|
"de",
|
@@ -124,6 +128,7 @@ const assetsMeta = {
|
|
124
128
|
"lt",
|
125
129
|
"lv",
|
126
130
|
"ms",
|
131
|
+
"mk",
|
127
132
|
"nb",
|
128
133
|
"nl",
|
129
134
|
"nl_BE",
|
@@ -1,3 +1,38 @@
|
|
1
|
+
const fs = require("fs");
|
2
|
+
const path = require("path");
|
3
|
+
const tsMode = fs.existsSync(path.join(process.cwd(), "tsconfig.json"));
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Typescript Rules
|
7
|
+
*/
|
8
|
+
const overrides = tsMode ? [{
|
9
|
+
files: ["*.ts"],
|
10
|
+
parser: "@typescript-eslint/parser",
|
11
|
+
plugins: ["@typescript-eslint"],
|
12
|
+
extends: [
|
13
|
+
"plugin:@typescript-eslint/recommended",
|
14
|
+
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
15
|
+
],
|
16
|
+
parserOptions: {
|
17
|
+
"project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
|
18
|
+
EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
|
19
|
+
},
|
20
|
+
rules: {
|
21
|
+
"no-shadow": "off",
|
22
|
+
"@typescript-eslint/no-shadow": ["error"],
|
23
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
24
|
+
"@typescript-eslint/no-floating-promises": "off",
|
25
|
+
"@typescript-eslint/no-explicit-any": "off",
|
26
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
27
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
28
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
29
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
30
|
+
"@typescript-eslint/no-empty-function": "off",
|
31
|
+
"@typescript-eslint/no-empty-interface": "off",
|
32
|
+
"lines-between-class-members": "off",
|
33
|
+
}
|
34
|
+
}] : [];
|
35
|
+
|
1
36
|
module.exports = {
|
2
37
|
"env": {
|
3
38
|
"browser": true,
|
@@ -5,34 +40,7 @@ module.exports = {
|
|
5
40
|
},
|
6
41
|
"root": true,
|
7
42
|
"extends": "airbnb-base",
|
8
|
-
overrides
|
9
|
-
files: ["*.ts"],
|
10
|
-
parser: "@typescript-eslint/parser",
|
11
|
-
plugins: ["@typescript-eslint"],
|
12
|
-
extends: [
|
13
|
-
"plugin:@typescript-eslint/recommended",
|
14
|
-
"plugin:@typescript-eslint/recommended-requiring-type-checking"
|
15
|
-
],
|
16
|
-
parserOptions: {
|
17
|
-
"project": ["./tsconfig.json", "./packages/*/tsconfig.json"],
|
18
|
-
},
|
19
|
-
/**
|
20
|
-
* Typescript Rules
|
21
|
-
*/
|
22
|
-
rules: {
|
23
|
-
"no-shadow": "off",
|
24
|
-
"@typescript-eslint/no-shadow": ["error"],
|
25
|
-
"@typescript-eslint/no-unsafe-member-access": "off",
|
26
|
-
"@typescript-eslint/no-floating-promises": "off",
|
27
|
-
"@typescript-eslint/no-explicit-any": "off",
|
28
|
-
"@typescript-eslint/no-unsafe-assignment": "off",
|
29
|
-
"@typescript-eslint/ban-ts-comment": "off",
|
30
|
-
"@typescript-eslint/no-unsafe-call": "off",
|
31
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
32
|
-
"@typescript-eslint/no-empty-function": "off",
|
33
|
-
"lines-between-class-members": "off",
|
34
|
-
}
|
35
|
-
}],
|
43
|
+
overrides,
|
36
44
|
"parserOptions": {
|
37
45
|
"ecmaVersion": 2018,
|
38
46
|
"sourceType": "module"
|
@@ -1,24 +1,35 @@
|
|
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
|
-
const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
|
6
4
|
|
7
5
|
const getScripts = (options) => {
|
8
6
|
|
9
7
|
// The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
|
10
8
|
const illustrationsData = options.illustrationsData || [];
|
11
|
-
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath}`);
|
9
|
+
const illustrations = illustrationsData.map(illustration => `node "${LIB}/create-illustrations/index.js" ${illustration.path} ${illustration.defaultText} ${illustration.illustrationsPrefix} ${illustration.set} ${illustration.destinationPath} ${illustration.collection}`);
|
12
10
|
const createIllustrationsJSImportsScript = illustrations.join(" && ");
|
13
11
|
|
14
|
-
// The script creates the "
|
15
|
-
|
16
|
-
|
17
|
-
const tsOption = options.
|
18
|
-
const
|
19
|
-
|
12
|
+
// The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
|
13
|
+
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(" && ");
|
14
|
+
|
15
|
+
const tsOption = !options.legacy;
|
16
|
+
const tsCommandOld = tsOption ? "tsc" : "";
|
17
|
+
let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
|
18
|
+
// this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
|
19
|
+
if (options.noWatchTS) {
|
20
|
+
tsWatchCommandStandalone = "";
|
21
|
+
}
|
20
22
|
const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
|
21
23
|
|
24
|
+
if (tsOption) {
|
25
|
+
try {
|
26
|
+
require("typescript");
|
27
|
+
} catch(e) {
|
28
|
+
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.`);
|
29
|
+
process.exit(e.code);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
22
33
|
let viteConfig;
|
23
34
|
if (fs.existsSync("config/vite.config.js")) {
|
24
35
|
// old project setup where config file is in separate folder
|
@@ -32,10 +43,7 @@ const getScripts = (options) => {
|
|
32
43
|
}
|
33
44
|
|
34
45
|
let eslintConfig;
|
35
|
-
if (fs.existsSync("
|
36
|
-
// old project setup where config file is in separate folder
|
37
|
-
eslintConfig = "--config config/.eslintrc.js";
|
38
|
-
} else if (fs.existsSync(".eslintrc.js")) {
|
46
|
+
if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
|
39
47
|
// preferred way of custom configuration in root project folder
|
40
48
|
eslintConfig = "";
|
41
49
|
} else {
|
@@ -44,22 +52,28 @@ const getScripts = (options) => {
|
|
44
52
|
}
|
45
53
|
|
46
54
|
const scripts = {
|
47
|
-
clean: 'rimraf
|
55
|
+
clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
|
48
56
|
lint: `eslint . ${eslintConfig}`,
|
49
|
-
lintfix: `eslint . ${eslintConfig}`,
|
50
|
-
|
51
|
-
default: `${tsCrossEnv} nps
|
57
|
+
lintfix: `eslint . ${eslintConfig} --fix`,
|
58
|
+
generate: {
|
59
|
+
default: `${tsCrossEnv} nps prepare.all`,
|
52
60
|
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
|
53
61
|
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
54
62
|
},
|
55
|
-
|
63
|
+
prepare: {
|
64
|
+
default: `${tsCrossEnv} nps clean prepare.all copy prepare.typescript generateAPI`,
|
65
|
+
all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
|
66
|
+
styleRelated: "nps build.styles build.jsonImports build.jsImports",
|
67
|
+
typescript: tsCommandOld,
|
68
|
+
},
|
56
69
|
build: {
|
57
|
-
default: "nps prepare lint build.bundle",
|
58
|
-
templates: `mkdirp
|
70
|
+
default: "nps prepare lint build.bundle", // build.bundle2
|
71
|
+
templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
|
59
72
|
styles: {
|
60
|
-
default: "nps build.styles.themes build.styles.components"
|
61
|
-
themes: `node "${LIB}/
|
62
|
-
components: "
|
73
|
+
default: `concurrently "nps build.styles.themes" "nps build.styles.components" "nps build.styles.componentStyles"`,
|
74
|
+
themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
|
75
|
+
components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
|
76
|
+
componentStyles: `node "${LIB}/css-processors/css-processor-component-styles.mjs"`,
|
63
77
|
},
|
64
78
|
i18n: {
|
65
79
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
@@ -67,40 +81,38 @@ const getScripts = (options) => {
|
|
67
81
|
json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
|
68
82
|
},
|
69
83
|
jsonImports: {
|
70
|
-
default: "mkdirp
|
71
|
-
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes
|
72
|
-
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n
|
84
|
+
default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
|
85
|
+
themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
|
86
|
+
i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
|
73
87
|
},
|
74
88
|
jsImports: {
|
75
|
-
default: "mkdirp
|
89
|
+
default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
|
76
90
|
illustrationsLoaders: createIllustrationsLoadersScript,
|
77
91
|
},
|
78
|
-
bundle: `vite build ${viteConfig}`,
|
92
|
+
bundle: `vite build ${viteConfig} --mode testing`,
|
93
|
+
bundle2: ``,
|
79
94
|
illustrations: createIllustrationsJSImportsScript,
|
80
95
|
},
|
81
96
|
copy: {
|
82
97
|
default: "nps copy.src copy.props",
|
83
|
-
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
|
98
|
+
src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
|
99
|
+
// srcGenerated2: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
|
84
100
|
props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
|
85
101
|
},
|
86
102
|
watch: {
|
87
|
-
default:
|
103
|
+
default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
|
88
104
|
devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
|
89
105
|
src: 'nps "copy.src --watch --safe --skip-initial-copy"',
|
90
|
-
typescript:
|
106
|
+
typescript: tsWatchCommandStandalone,
|
91
107
|
props: 'nps "copy.props --watch --safe --skip-initial-copy"',
|
92
108
|
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
93
109
|
styles: {
|
94
|
-
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
|
110
|
+
default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components" "nps watch.styles.componentStyles" ',
|
95
111
|
themes: 'nps "build.styles.themes -w"',
|
96
|
-
components:
|
97
|
-
|
98
|
-
existingFiles: `nps "build.styles.components -w"`,
|
99
|
-
newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
|
100
|
-
},
|
112
|
+
components: `nps "build.styles.components -w"`,
|
113
|
+
componentStyles: `nps "build.styles.componentStyles -w"`,
|
101
114
|
},
|
102
115
|
templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
|
103
|
-
api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
|
104
116
|
i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
|
105
117
|
},
|
106
118
|
start: "nps prepare watch.devServer",
|
@@ -109,7 +121,7 @@ const getScripts = (options) => {
|
|
109
121
|
"test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
|
110
122
|
startWithScope: "nps scope.prepare scope.watchWithBundle",
|
111
123
|
scope: {
|
112
|
-
prepare: "nps scope.lint
|
124
|
+
prepare: "nps scope.lint scope.testPages",
|
113
125
|
lint: `node "${LIB}/scoping/lint-src.js"`,
|
114
126
|
testPages: {
|
115
127
|
default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
|
@@ -118,16 +130,13 @@ const getScripts = (options) => {
|
|
118
130
|
replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
|
119
131
|
},
|
120
132
|
watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
|
121
|
-
watch: 'concurrently "nps watch.templates" "nps watch.
|
133
|
+
watch: 'concurrently "nps watch.templates" "nps watch.src" "nps watch.props" "nps watch.styles"',
|
122
134
|
bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
|
123
135
|
},
|
124
136
|
generateAPI: {
|
125
|
-
default: "nps generateAPI.
|
126
|
-
|
127
|
-
|
128
|
-
preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
|
129
|
-
jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
|
130
|
-
cleanup: "rimraf jsdoc-dist/"
|
137
|
+
default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
|
138
|
+
generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
|
139
|
+
validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
|
131
140
|
},
|
132
141
|
};
|
133
142
|
|
@@ -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,13 @@
|
|
1
1
|
// vite.config.js
|
2
|
-
|
3
|
-
|
2
|
+
import { defineConfig } from 'vite';
|
3
|
+
import virtualIndex from '../lib/dev-server/virtual-index-html-plugin.js';
|
4
4
|
|
5
|
-
|
5
|
+
export default defineConfig(async () => {
|
6
|
+
const data = await virtualIndex();
|
6
7
|
return {
|
7
8
|
build: {
|
8
9
|
emptyOutDir: false,
|
9
10
|
},
|
10
|
-
plugins: [
|
11
|
+
plugins: [data],
|
11
12
|
}
|
12
|
-
})
|
13
|
+
})
|
@@ -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,15 @@ 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
|
+
'--start-maximized',
|
65
|
+
'--no-sandbox',
|
66
|
+
'--disable-gpu',
|
67
|
+
'--disable-infobars',
|
68
|
+
'--disable-extensions',
|
69
|
+
'--disable-dev-shm-usage',
|
70
|
+
],
|
60
71
|
// args: ['--disable-gpu'],
|
61
72
|
}
|
62
73
|
}],
|
@@ -99,8 +110,7 @@ exports.config = {
|
|
99
110
|
// Services take over a specific job you don't want to take care of. They enhance
|
100
111
|
// your test setup with almost no effort. Unlike plugins, they don't add new
|
101
112
|
// commands. Instead, they hook themselves up into the test process.
|
102
|
-
services: ['chromedriver', '
|
103
|
-
['static-server', {
|
113
|
+
services: ['chromedriver', ['static-server', {
|
104
114
|
folders: [
|
105
115
|
{ mount: '/', path: './dist' },
|
106
116
|
],
|
@@ -153,6 +163,9 @@ exports.config = {
|
|
153
163
|
*/
|
154
164
|
// beforeSession: function (config, capabilities, specs) {
|
155
165
|
// },
|
166
|
+
beforeSession: () => {
|
167
|
+
dns.setDefaultResultOrder('ipv4first');
|
168
|
+
},
|
156
169
|
/**
|
157
170
|
* Gets executed before test execution begins. At this point you can access to all global
|
158
171
|
* variables like `browser`. It is the perfect place to define custom commands.
|
@@ -223,12 +236,11 @@ exports.config = {
|
|
223
236
|
}, this, attrName);
|
224
237
|
}, true);
|
225
238
|
|
226
|
-
await browser.addCommand("
|
227
|
-
return browser.executeAsync(
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
}, false);
|
239
|
+
await browser.addCommand("matches", async function(selector) {
|
240
|
+
return browser.executeAsync((elem, selector, done) => {
|
241
|
+
done(elem.matches(selector));
|
242
|
+
}, this, selector);
|
243
|
+
}, true);
|
232
244
|
|
233
245
|
await browser.addLocatorStrategy('activeElement', (selector) => {
|
234
246
|
return document.querySelector(selector).shadowRoot.activeElement;
|
@@ -245,11 +257,11 @@ exports.config = {
|
|
245
257
|
"$$",
|
246
258
|
"getAttribute",
|
247
259
|
"hasAttribute", // custom
|
260
|
+
"matches", // custom
|
248
261
|
"getCSSProperty",
|
249
262
|
"getHTML",
|
250
263
|
"getProperty",
|
251
264
|
"getSize",
|
252
|
-
"getStaticAreaItemClassName", // custom
|
253
265
|
"getText",
|
254
266
|
"getValue",
|
255
267
|
"hasClass", // custom
|
@@ -261,7 +273,7 @@ exports.config = {
|
|
261
273
|
"isFocusedDeep", // custom
|
262
274
|
"isFocusedDeepElement", // custom
|
263
275
|
"shadow$",
|
264
|
-
"shadow$$"
|
276
|
+
"shadow$$"
|
265
277
|
];
|
266
278
|
if (waitFor.includes(commandName)) {
|
267
279
|
await browser.executeAsync(function (done) {
|
@@ -298,8 +310,17 @@ exports.config = {
|
|
298
310
|
* Function to be executed after a test (in Mocha/Jasmine) or a step (in Cucumber) starts.
|
299
311
|
* @param {Object} test test details
|
300
312
|
*/
|
301
|
-
|
302
|
-
|
313
|
+
afterTest: async function (test, context) {
|
314
|
+
// fetch the browser logs and fail the test if there are `console.error` messages with the `[UI5-FWK]` marker
|
315
|
+
const logs = await browser.getLogs('browser');
|
316
|
+
const severeLogs = logs
|
317
|
+
.filter(l => l.level === "SEVERE" && l.message.includes("[UI5-FWK]"))
|
318
|
+
.map(l => l.message);
|
319
|
+
assert.equal(severeLogs.length, 0, `[${test.title}]\n\n ${severeLogs.join("\n ")}`)
|
320
|
+
if (severeLogs.length) {
|
321
|
+
test.callback(new Error('Framework errors detected.'))
|
322
|
+
}
|
323
|
+
},
|
303
324
|
/**
|
304
325
|
* Hook that gets executed after the suite has ended
|
305
326
|
* @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,22 +41,24 @@ const copyIconAssetsCommand = (options) => {
|
|
41
41
|
const getScripts = (options) => {
|
42
42
|
const createJSImportsCmd = createIconImportsCommand(options);
|
43
43
|
const copyAssetsCmd = copyIconAssetsCommand(options);
|
44
|
-
const tsCommand = options.
|
45
|
-
const tsCrossEnv = options.
|
44
|
+
const tsCommand = !options.legacy ? "tsc --build" : "";
|
45
|
+
const tsCrossEnv = !options.legacy ? "cross-env UI5_TS=true" : "";
|
46
46
|
|
47
47
|
const scripts = {
|
48
48
|
clean: "rimraf dist && rimraf src/generated",
|
49
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/",
|
50
52
|
build: {
|
51
53
|
default: `${tsCrossEnv} nps clean copy build.i18n typescript build.icons build.jsonImports`,
|
52
54
|
i18n: {
|
53
55
|
default: "nps build.i18n.defaultsjs build.i18n.json",
|
54
56
|
defaultsjs: `mkdirp dist/generated/i18n && node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
|
55
|
-
json: `mkdirp
|
57
|
+
json: `mkdirp src/generated/assets/i18n && node "${LIB}/i18n/toJSON.js" src/i18n src/generated/assets/i18n`,
|
56
58
|
},
|
57
59
|
jsonImports: {
|
58
|
-
default: "mkdirp
|
59
|
-
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`,
|
60
62
|
},
|
61
63
|
icons: createJSImportsCmd,
|
62
64
|
},
|