@ui5/webcomponents-tools 2.8.1-rc.0 → 2.9.0-rc.0

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.9.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.8.1-rc.0...v2.9.0-rc.0) (2025-03-13)
7
+
8
+ **Note:** Version bump only for package @ui5/webcomponents-tools
9
+
10
+
11
+
12
+
13
+
6
14
  ## [2.8.1-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v2.8.0...v2.8.1-rc.0) (2025-03-06)
7
15
 
8
16
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -17,8 +17,7 @@ const getTsModeOverrides = () => {
17
17
  ],
18
18
  parserOptions: {
19
19
  "project": [
20
- "./tsconfig.json",
21
- "./cypress/tsconfig.json",
20
+ "./tsconfig.json"
22
21
  ],
23
22
  EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
24
23
  },
@@ -55,44 +54,9 @@ const getTsModeOverrides = () => {
55
54
  "comma-dangle": "off"
56
55
  };
57
56
 
58
- const cypressConfiguration = {
59
- "files": ["**/cypress/**/*.ts", "**/cypress/**/*.tsx"],
60
-
61
- "plugins": [
62
- "cypress"
63
- ],
64
- extends: [
65
- "plugin:cypress/recommended"
66
- ],
67
- "env": {
68
- "cypress/globals": true
69
- },
70
- "rules": {
71
- "max-nested-callbacks": 0,
72
- "no-unused-expressions": 0,
73
- "@typescript-eslint/no-namespace": "off",
74
- "cypress/no-assigning-return-values": "error",
75
- "cypress/no-unnecessary-waiting": "error",
76
- "cypress/assertion-before-screenshot": "warn",
77
- "cypress/no-force": "warn",
78
- "cypress/no-async-tests": "error",
79
- "cypress/no-async-before": "error",
80
- "cypress/no-pause": "error",
81
- "import/no-extraneous-dependencies": [
82
- "error",
83
- {
84
- "devDependencies": [
85
- "**/cypress/**/*.ts"
86
- ]
87
- }
88
- ]
89
- }
90
- }
91
-
92
57
  return [
93
58
  tsConfiguration,
94
- tsxConfiguration,
95
- cypressConfiguration,
59
+ tsxConfiguration
96
60
  ];
97
61
  }
98
62
 
@@ -144,8 +144,8 @@ const getScripts = (options) => {
144
144
  },
145
145
  generateAPI: {
146
146
  default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
147
- generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
148
- validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
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
149
  },
150
150
  };
151
151
 
@@ -27,6 +27,7 @@ import { generateCustomData } from "cem-plugin-vs-code-custom-data-generator";
27
27
  import { customElementJetBrainsPlugin } from "custom-element-jet-brains-integration";
28
28
 
29
29
  const packageJSON = JSON.parse(fs.readFileSync("./package.json"));
30
+ const devMode = process.env.UI5_CEM_MODE === "dev";
30
31
 
31
32
  const extractClassNodeJSDoc = node => {
32
33
  const fileContent = node.getFullText();
@@ -532,8 +533,8 @@ export default {
532
533
  }
533
534
  })
534
535
  },
535
- packageLinkPhase({ context }) {
536
- if (context.dev) {
536
+ packageLinkPhase() {
537
+ if (devMode) {
537
538
  displayDocumentationErrors();
538
539
  }
539
540
  }
@@ -1,11 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const Ajv = require('ajv');
3
3
  const path = require('path');
4
- const yargs = require('yargs/yargs')
5
- const { hideBin } = require('yargs/helpers')
6
- const argv = yargs(hideBin(process.argv))
7
- .argv;
8
-
9
4
  // Load your JSON schema
10
5
  const extenalSchema = require('./schema.json');
11
6
  const internalSchema = require('./schema-internal.json');
@@ -14,47 +9,48 @@ const internalSchema = require('./schema-internal.json');
14
9
  const inputFilePath = path.join(process.cwd(), "dist/custom-elements.json"); // Update with your file path
15
10
  const customManifest = fs.readFileSync(inputFilePath, 'utf8');
16
11
  const inputDataInternal = JSON.parse(customManifest);
12
+ const devMode = process.env.UI5_CEM_MODE === "dev";
17
13
 
18
14
  inputDataInternal.modules.forEach(moduleDoc => {
19
- moduleDoc.exports = moduleDoc.exports.
20
- filter(e => moduleDoc.declarations.find(d => d.name === e.declaration.name && ["class", "function", "variable", "enum"].includes(d.kind)) || e.name === "default");
15
+ moduleDoc.exports = moduleDoc.exports.
16
+ filter(e => moduleDoc.declarations.find(d => d.name === e.declaration.name && ["class", "function", "variable", "enum"].includes(d.kind)) || e.name === "default");
21
17
  })
22
18
 
23
19
  const clearProps = (data) => {
24
- if (Array.isArray(data)) {
25
- for (let i = 0; i < data.length; i++) {
26
- if (typeof data[i] === "object") {
27
- if (["enum", "interface"].includes(data[i].kind)) {
28
- data.splice(i, 1);
29
- i--;
30
- } else {
31
- clearProps(data[i]);
32
- }
33
- }
34
- }
35
- } else if (typeof data === "object") {
36
- Object.keys(data).forEach(prop => {
37
- if (prop.startsWith("_ui5")) {
38
- delete data[prop];
39
- } else if (typeof data[prop] === "object") {
40
- clearProps(data[prop]);
41
- }
42
- });
43
- }
20
+ if (Array.isArray(data)) {
21
+ for (let i = 0; i < data.length; i++) {
22
+ if (typeof data[i] === "object") {
23
+ if (["enum", "interface"].includes(data[i].kind)) {
24
+ data.splice(i, 1);
25
+ i--;
26
+ } else {
27
+ clearProps(data[i]);
28
+ }
29
+ }
30
+ }
31
+ } else if (typeof data === "object") {
32
+ Object.keys(data).forEach(prop => {
33
+ if (prop.startsWith("_ui5")) {
34
+ delete data[prop];
35
+ } else if (typeof data[prop] === "object") {
36
+ clearProps(data[prop]);
37
+ }
38
+ });
39
+ }
44
40
 
45
- return data;
41
+ return data;
46
42
  }
47
43
 
48
44
  const ajv = new Ajv({ allowUnionTypes: true, allError: true })
49
45
  let validate = ajv.compile(internalSchema)
50
46
 
51
47
  // Validate the JSON data against the schema
52
- if (argv.dev) {
53
- if (validate(inputDataInternal)) {
54
- console.log('Internal custom element manifest is validated successfully');
55
- } else {
56
- throw new Error(`Validation of internal custom elements manifest failed: ${validate.errors}`);
57
- }
48
+ if (devMode) {
49
+ if (validate(inputDataInternal)) {
50
+ console.log('Internal custom element manifest is validated successfully');
51
+ } else {
52
+ throw new Error(`Validation of internal custom elements manifest failed: ${validate.errors}`);
53
+ }
58
54
  }
59
55
 
60
56
  const inputDataExternal = clearProps(JSON.parse(JSON.stringify(inputDataInternal)));
@@ -62,9 +58,9 @@ validate = ajv.compile(extenalSchema)
62
58
 
63
59
  // Validate the JSON data against the schema
64
60
  if (validate(inputDataExternal)) {
65
- console.log('Custom element manifest is validated successfully');
66
- fs.writeFileSync(inputFilePath, JSON.stringify(inputDataExternal, null, 2), 'utf8');
67
- fs.writeFileSync(inputFilePath.replace("custom-elements", "custom-elements-internal"), JSON.stringify(inputDataInternal, null, 2), 'utf8');
68
- } else if (argv.dev) {
69
- throw new Error(`Validation of public custom elements manifest failed: ${validate.errors}`);
70
- }
61
+ console.log('Custom element manifest is validated successfully');
62
+ fs.writeFileSync(inputFilePath, JSON.stringify(inputDataExternal, null, 2), 'utf8');
63
+ fs.writeFileSync(inputFilePath.replace("custom-elements", "custom-elements-internal"), JSON.stringify(inputDataInternal, null, 2), 'utf8');
64
+ } else if (devMode) {
65
+ throw new Error(`Validation of public custom elements manifest failed: ${validate.errors}`);
66
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "2.8.1-rc.0",
3
+ "version": "2.9.0-rc.0",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -10,7 +10,6 @@
10
10
  "sapui5",
11
11
  "ui5"
12
12
  ],
13
- "types": "./types/index.d.ts",
14
13
  "scripts": {},
15
14
  "bin": {
16
15
  "wc-dev": "bin/dev.js",
@@ -23,7 +22,6 @@
23
22
  },
24
23
  "dependencies": {
25
24
  "@custom-elements-manifest/analyzer": "^0.8.4",
26
- "@cypress/code-coverage": "^3.13.10",
27
25
  "@typescript-eslint/eslint-plugin": "^6.9.0",
28
26
  "@typescript-eslint/parser": "^6.9.0",
29
27
  "@wdio/cli": "^7.19.7",
@@ -43,12 +41,9 @@
43
41
  "concurrently": "^6.0.0",
44
42
  "cross-env": "^7.0.3",
45
43
  "custom-element-jet-brains-integration": "^1.4.4",
46
- "cypress": "^13.11.0",
47
- "cypress-real-events": "^1.12.0",
48
44
  "escodegen": "^2.0.0",
49
45
  "eslint": "^7.22.0",
50
46
  "eslint-config-airbnb-base": "^14.2.1",
51
- "eslint-plugin-cypress": "^3.4.0",
52
47
  "eslint-plugin-import": "^2.31.0",
53
48
  "eslint-plugin-jsx-no-leaked-values": "^0.1.24",
54
49
  "esprima": "^4.0.1",
@@ -64,7 +59,6 @@
64
59
  "postcss": "^8.4.5",
65
60
  "postcss-cli": "^9.1.0",
66
61
  "postcss-selector-parser": "^6.0.10",
67
- "preact": "^10.25.4",
68
62
  "prompts": "^2.4.2",
69
63
  "properties-reader": "^2.2.0",
70
64
  "recursive-readdir": "^2.2.2",
@@ -85,10 +79,8 @@
85
79
  }
86
80
  },
87
81
  "devDependencies": {
88
- "@cypress/mount-utils": "^4.1.2",
89
- "cypress-real-events": "^1.12.0",
90
82
  "esbuild": "^0.25.0",
91
83
  "yargs": "^17.5.1"
92
84
  },
93
- "gitHead": "b6e950c0969283cb35ce43bf1bb21af4fb22e0f4"
85
+ "gitHead": "7b5afeeb1f94c3ad54b2e79ac79d0d9e36f0cb7d"
94
86
  }
@@ -1,66 +0,0 @@
1
- /// <reference types="cypress" />
2
- // ***********************************************
3
- // This example commands.ts shows you how to
4
- // create various custom commands and overwrite
5
- // existing commands.
6
- //
7
- // For more comprehensive examples of custom
8
- // commands please read more here:
9
- // https://on.cypress.io/custom-commands
10
- // ***********************************************
11
- //
12
- //
13
- // -- This is a parent command --
14
- // Cypress.Commands.add('login', (email, password) => { ... })
15
- //
16
- //
17
- // -- This is a child command --
18
- // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
19
- //
20
- //
21
- // -- This is a dual command --
22
- // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
23
- //
24
- //
25
- // -- This will overwrite an existing command --
26
- // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
27
- //
28
- // declare global {
29
- // namespace Cypress {
30
- // interface Chainable {
31
- // login(email: string, password: string): Chainable<void>
32
- // drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
33
- // dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
34
- // visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
35
- // }
36
- // }
37
- // }
38
-
39
- import "cypress-real-events";
40
-
41
- const realEventCmdCallback = (originalFn, element, ...args) => {
42
- cy.get(element)
43
- .should($el => {
44
- if ($el[0].tagName.includes("-") && $el[0].shadowRoot) {
45
- expect($el[0].shadowRoot.hasChildNodes(), "Custom elements with shadow DOM have content in their shadow DOM").to.be.true;
46
- }
47
- })
48
- .and("be.visible")
49
- .then(() => {
50
- return originalFn(element, ...args)
51
- });
52
- };
53
-
54
- const commands = [
55
- "realClick",
56
- "realHover",
57
- "realTouch",
58
- "realSwipe",
59
- "realMouseDown",
60
- "realMouseUp",
61
- "realMouseMove"
62
- ];
63
-
64
- commands.forEach(cmd => {
65
- Cypress.Commands.overwrite(cmd, realEventCmdCallback)
66
- });
@@ -1,17 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <meta charset="utf-8">
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
8
- <meta name="sap-allowedThemeOrigins" content="https://example.com">
9
- <title>Components App</title>
10
- <script data-ui5-config type="application/json">{}</script>
11
- </head>
12
-
13
- <body>
14
- <div data-cy-root></div>
15
- </body>
16
-
17
- </html>
@@ -1,22 +0,0 @@
1
- /// <reference types="cypress" />
2
- import "cypress-real-events";
3
-
4
- export type Renderable = HTMLTemplateResult;
5
- export interface MountUI5Options extends MountLitTemplateOptions {
6
- ui5Configuration: object;
7
- }
8
- export type MountOptions = Partial<MountUI5Options>;
9
- export declare function mount(component: JSX.Element, options?: MountOptions): CypressChainable<JQuery<HTMLElement>>;
10
- declare global {
11
- namespace Cypress {
12
- interface Chainable {
13
- /**
14
- * Mount your component into Cypress sandbox
15
- * @param component content to render by preact render function
16
- * @param options render options for custom rendering
17
- */
18
- mount: typeof mount;
19
- }
20
- }
21
- }
22
-
@@ -1,46 +0,0 @@
1
- import "@cypress/code-coverage/support";
2
- import { setupHooks, getContainerEl } from "@cypress/mount-utils";
3
- import { mount as preactMount } from "./cypress-ct-preact.js";
4
- import "./commands.js";
5
-
6
- function applyConfiguration(options) {
7
- const configurationScript = document.head.querySelector("script[data-ui5-config]");
8
-
9
- if (options.ui5Configuration) {
10
- configurationScript.innerHTML = JSON.stringify(options.ui5Configuration);
11
- }
12
- }
13
-
14
- function cleanup() {
15
- preactMount(null, getContainerEl());
16
- }
17
-
18
- function mount(component, options = {}) {
19
- const container = getContainerEl();
20
-
21
- // Apply custom configuration
22
- applyConfiguration(options);
23
-
24
- // Mount JSX Element
25
- preactMount(component, container);
26
-
27
- cy.get(container)
28
- .find("*")
29
- .should($el => {
30
- const shadowrootsExist = [...$el].every(el => {
31
- if (el.tagName.includes("-") && el.shadowRoot) {
32
- return el.shadowRoot.hasChildNodes();
33
- }
34
-
35
- return true;
36
- })
37
-
38
- expect(shadowrootsExist, "Custom elements with shadow DOM have content in their shadow DOM").to.be.true;
39
- })
40
-
41
- return cy.get(container);
42
- }
43
-
44
- setupHooks(cleanup);
45
-
46
- Cypress.Commands.add('mount', mount)
@@ -1,11 +0,0 @@
1
- import { render } from 'preact';
2
-
3
- function mount(component, container) {
4
- render(null, container);
5
-
6
- return render(component, container);
7
- }
8
-
9
- export {
10
- mount,
11
- };
@@ -1,33 +0,0 @@
1
- const { defineConfig } = require('cypress')
2
- const path = require("path");
3
- const coverageTask = require('@cypress/code-coverage/task');
4
-
5
- const suites = {
6
- SUITE1: [
7
- "**/specs/base/*.cy.{jsx,tsx}",
8
- "**/specs/[A-I]*.cy.{js,jsx,ts,tsx}",
9
- ],
10
- SUITE2: [
11
- "**/specs/[^A-I]*.cy.{js,jsx,ts,tsx}",
12
- ],
13
- };
14
-
15
- module.exports = defineConfig({
16
- component: {
17
- setupNodeEvents(on, config) {
18
- coverageTask(on, config)
19
- return config
20
- },
21
- supportFile: path.join(__dirname, "cypress/support/component.js"),
22
- indexHtmlFile: path.join(__dirname, "cypress/support/component-index.html"),
23
- specPattern: suites[process.env.TEST_SUITE] || ["**/specs/**/*.cy.{js,ts,jsx,tsx}"],
24
- devServer: {
25
- bundler: 'vite',
26
- }
27
- },
28
- video: false,
29
- screenshotOnRunFailure: false,
30
- scrollBehavior: false,
31
- viewportHeight: 1080,
32
- viewportWidth: 1440,
33
- })
package/types/index.d.ts DELETED
@@ -1 +0,0 @@
1
- import "../components-package/cypress/support/component"