@ui5/webcomponents-tools 0.0.0-f651a470c → 0.0.0-f6676abdd

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/CHANGELOG.md +1346 -0
  2. package/README.md +3 -5
  3. package/assets-meta.js +11 -10
  4. package/components-package/cypress/support/commands.js +66 -0
  5. package/components-package/cypress/support/component-index.html +17 -0
  6. package/components-package/cypress/support/component.d.ts +22 -0
  7. package/components-package/cypress/support/component.js +46 -0
  8. package/components-package/cypress/support/cypress-ct-preact.js +11 -0
  9. package/components-package/cypress.config.js +33 -0
  10. package/components-package/eslint.js +94 -28
  11. package/components-package/nps.js +58 -47
  12. package/components-package/postcss.components.js +1 -21
  13. package/components-package/postcss.themes.js +1 -26
  14. package/components-package/vite.config.js +7 -11
  15. package/components-package/wdio.js +415 -393
  16. package/icons-collection/nps.js +9 -7
  17. package/lib/amd-to-es6/index.js +102 -0
  18. package/lib/amd-to-es6/no-remaining-require.js +33 -0
  19. package/lib/cem/custom-elements-manifest.config.mjs +544 -0
  20. package/lib/cem/event.mjs +168 -0
  21. package/lib/cem/schema-internal.json +1413 -0
  22. package/lib/cem/schema.json +1098 -0
  23. package/lib/cem/types-internal.d.ts +808 -0
  24. package/lib/cem/types.d.ts +736 -0
  25. package/lib/cem/utils.mjs +423 -0
  26. package/lib/cem/validate.js +70 -0
  27. package/lib/create-icons/index.js +8 -6
  28. package/lib/create-illustrations/index.js +51 -30
  29. package/lib/create-new-component/{tsFileContentTemplate.js → Component.js} +15 -25
  30. package/lib/create-new-component/ComponentTemplate.js +12 -0
  31. package/lib/create-new-component/index.js +35 -73
  32. package/lib/css-processors/css-processor-components.mjs +77 -0
  33. package/lib/css-processors/css-processor-themes.mjs +74 -0
  34. package/lib/css-processors/scope-variables.mjs +49 -0
  35. package/lib/css-processors/shared.mjs +56 -0
  36. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  37. package/lib/dev-server/{dev-server.js → dev-server.mjs} +4 -4
  38. package/lib/dev-server/virtual-index-html-plugin.js +24 -20
  39. package/lib/generate-js-imports/illustrations.js +78 -64
  40. package/lib/generate-json-imports/i18n.js +45 -61
  41. package/lib/generate-json-imports/themes.js +16 -33
  42. package/lib/hbs2lit/src/compiler.js +9 -6
  43. package/lib/hbs2lit/src/litVisitor2.js +42 -17
  44. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  45. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +39 -6
  46. package/lib/hbs2ui5/index.js +23 -6
  47. package/lib/i18n/defaults.js +3 -2
  48. package/lib/postcss-combine-duplicated-selectors/index.js +12 -5
  49. package/lib/remove-dev-mode/remove-dev-mode.mjs +37 -0
  50. package/lib/scoping/get-all-tags.js +10 -3
  51. package/lib/scoping/lint-src.js +8 -7
  52. package/lib/scoping/scope-test-pages.js +2 -1
  53. package/lib/test-runner/test-runner.js +2 -2
  54. package/package.json +25 -13
  55. package/tsconfig.json +18 -0
  56. package/types/index.d.ts +1 -0
  57. package/components-package/wdio.sync.js +0 -360
  58. package/lib/create-new-component/jsFileContentTemplate.js +0 -77
  59. package/lib/esm-abs-to-rel/index.js +0 -58
  60. package/lib/generate-custom-elements-manifest/index.js +0 -327
  61. package/lib/jsdoc/config.json +0 -29
  62. package/lib/jsdoc/configTypescript.json +0 -29
  63. package/lib/jsdoc/plugin.js +0 -2468
  64. package/lib/jsdoc/preprocess.js +0 -146
  65. package/lib/jsdoc/template/publish.js +0 -4120
  66. package/lib/postcss-css-to-esm/index.js +0 -90
  67. package/lib/postcss-css-to-json/index.js +0 -47
  68. package/lib/postcss-new-files/index.js +0 -36
  69. package/lib/postcss-p/postcss-p.mjs +0 -14
  70. package/lib/replace-global-core/index.js +0 -25
package/README.md CHANGED
@@ -1,6 +1,4 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
-
3
- # UI5 Web Components - Tools
1
+ # ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_water.png)UI5 Web Components - Tools
4
2
 
5
3
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](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/playground/)
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://join-ui5-slack.herokuapp.com/).
14
+ We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/SUPPORT.md#-content) on how to report an issue, or chat with us in the `#webcomponents` channel of the [OpenUI5 Community Slack](https://ui5-slack-invite.cfapps.eu10.hana.ondemand.com/).
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": "sap_fiori_3",
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
- "sap_horizon",
13
- "sap_horizon_dark",
14
- "sap_horizon_hcb",
15
- "sap_horizon_hcw",
16
- "sap_horizon_exp"
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",
@@ -0,0 +1,66 @@
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
+ });
@@ -0,0 +1,17 @@
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>
@@ -0,0 +1,22 @@
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
+
@@ -0,0 +1,46 @@
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)
@@ -0,0 +1,11 @@
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
+ };
@@ -0,0 +1,33 @@
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
+ })
@@ -3,33 +3,98 @@ const path = require("path");
3
3
  const tsMode = fs.existsSync(path.join(process.cwd(), "tsconfig.json"));
4
4
 
5
5
  /**
6
- * Typescript Rules
6
+ * Returns eslint rules specific to typescript files
7
+ * @returns
7
8
  */
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
- },
19
- rules: {
20
- "no-shadow": "off",
21
- "@typescript-eslint/no-shadow": ["error"],
22
- "@typescript-eslint/no-unsafe-member-access": "off",
23
- "@typescript-eslint/no-floating-promises": "off",
24
- "@typescript-eslint/no-explicit-any": "off",
25
- "@typescript-eslint/no-unsafe-assignment": "off",
26
- "@typescript-eslint/ban-ts-comment": "off",
27
- "@typescript-eslint/no-unsafe-call": "off",
28
- "@typescript-eslint/no-non-null-assertion": "off",
29
- "@typescript-eslint/no-empty-function": "off",
30
- "lines-between-class-members": "off",
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
+ "./cypress/tsconfig.json",
22
+ ],
23
+ EXPERIMENTAL_useSourceOfProjectReferenceRedirect: true,
24
+ },
25
+ rules: {
26
+ "no-shadow": "off",
27
+ "@typescript-eslint/consistent-type-imports": "error",
28
+ "import/consistent-type-specifier-style": ["error", "prefer-top-level"],
29
+ "@typescript-eslint/no-shadow": ["error"],
30
+ "@typescript-eslint/no-unsafe-member-access": "off",
31
+ "@typescript-eslint/no-floating-promises": "off",
32
+ "@typescript-eslint/no-explicit-any": "off",
33
+ "@typescript-eslint/no-unsafe-assignment": "off",
34
+ "@typescript-eslint/ban-ts-comment": "off",
35
+ "@typescript-eslint/no-unsafe-call": "off",
36
+ "@typescript-eslint/no-non-null-assertion": "off",
37
+ "@typescript-eslint/no-empty-function": "off",
38
+ "@typescript-eslint/no-empty-interface": "off",
39
+ "lines-between-class-members": "off",
40
+ }
41
+ };
42
+
43
+ const tsxConfiguration = JSON.parse(JSON.stringify(tsConfiguration));
44
+ tsxConfiguration.files = ["*.tsx"];
45
+ tsxConfiguration.plugins.push("jsx-no-leaked-values");
46
+ tsxConfiguration.rules = {
47
+ ...tsxConfiguration.rules,
48
+ "jsx-no-leaked-values/jsx-no-leaked-values": "error",
49
+ "@typescript-eslint/unbound-method": "off", // to be able to attach on* listeners
50
+ "@typescript-eslint/no-misused-promises": "off", // to be able to have async event listeners
51
+ "operator-linebreak": "off",
52
+ "no-nested-ternary": "off",
53
+ "implicit-arrow-linebreak": "off",
54
+ "function-paren-newline": "off",
55
+ "comma-dangle": "off"
56
+ };
57
+
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
+ }
31
90
  }
32
- }] : [];
91
+
92
+ return [
93
+ tsConfiguration,
94
+ tsxConfiguration,
95
+ cypressConfiguration,
96
+ ];
97
+ }
33
98
 
34
99
  module.exports = {
35
100
  "env": {
@@ -38,7 +103,7 @@ module.exports = {
38
103
  },
39
104
  "root": true,
40
105
  "extends": "airbnb-base",
41
- overrides,
106
+ "overrides": tsMode ? getTsModeOverrides() : [],
42
107
  "parserOptions": {
43
108
  "ecmaVersion": 2018,
44
109
  "sourceType": "module"
@@ -81,6 +146,7 @@ module.exports = {
81
146
  "curly": [2, "all"],
82
147
  // "default-case": 1, // removed for UI5 WebComponents
83
148
  "import/extensions": ["error", "always"], // override for UI5 WebComponents
149
+ "import/order": "off",
84
150
  "no-alert": 2,
85
151
  "no-caller": 2,
86
152
  "no-div-regex": 2,
@@ -122,7 +188,7 @@ module.exports = {
122
188
  "no-shadow-restricted-names": 2,
123
189
  "no-undef-init": 2,
124
190
  "no-undef": 2,
125
- "no-unused-vars": [2, {"vars":"all", "args":"none"}],
191
+ "no-unused-vars": [2, { "vars": "all", "args": "none" }],
126
192
 
127
193
  "brace-style": [2, "1tbs", { "allowSingleLine": true }],
128
194
  "camelcase": [1, { "properties": "never" }], // added for UI5 WebComponents
@@ -138,7 +204,7 @@ module.exports = {
138
204
  "no-new-object": 2,
139
205
  "no-spaced-func": 2,
140
206
  "quote-props": [2, "as-needed", { "keywords": true, "unnecessary": false }],
141
- "semi-spacing": [1, {"before": false, "after": true}],
207
+ "semi-spacing": [1, { "before": false, "after": true }],
142
208
  "semi": 2,
143
209
  "keyword-spacing": 2,
144
210
  "space-infix-ops": 2,
@@ -1,24 +1,32 @@
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");
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
- const 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 "dist/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
15
- const illustrationDestinationPaths = illustrationsData.map(illustrations => illustrations.destinationPath);
16
- const createIllustrationsLoadersScript = options.fioriPackage ? `node ${LIB}/generate-js-imports/illustrations.js ${illustrationDestinationPaths[0]} ${illustrationDestinationPaths[1]} dist/generated/js-imports` : "";
17
- const tsOption = options.typescript;
18
- const tsCommand = tsOption ? "tsc" : "";
19
- const tsWatchCommand = tsOption ? "tsc --watch" : "";
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
+ }
20
29
  const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
21
- const copySrcGenerated = tsOption ? "" : "copy.srcGenerated";
22
30
 
23
31
  if (tsOption) {
24
32
  try {
@@ -51,22 +59,27 @@ const getScripts = (options) => {
51
59
  }
52
60
 
53
61
  const scripts = {
54
- clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
62
+ clean: 'rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
55
63
  lint: `eslint . ${eslintConfig}`,
56
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
+ },
57
70
  prepare: {
58
- default: `${tsCrossEnv} nps clean prepare.all typescript generateAPI`,
59
- all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
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"',
60
73
  styleRelated: "nps build.styles build.jsonImports build.jsImports",
74
+ typescript: tsCommandOld,
61
75
  },
62
- typescript: tsCommand,
63
76
  build: {
64
- default: "nps prepare lint build.bundle",
65
- templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
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`,
66
79
  styles: {
67
- default: `nps build.styles.themes build.styles.components ${copySrcGenerated}`,
68
- themes: `node "${LIB}/postcss-p/postcss-p.mjs"`,
69
- components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
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"`,
70
83
  },
71
84
  i18n: {
72
85
  default: "nps build.i18n.defaultsjs build.i18n.json",
@@ -74,50 +87,51 @@ const getScripts = (options) => {
74
87
  json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
75
88
  },
76
89
  jsonImports: {
77
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
78
- themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
79
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
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`,
80
93
  },
81
94
  jsImports: {
82
- default: "mkdirp dist/generated/js-imports && nps build.jsImports.illustrationsLoaders",
95
+ default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
83
96
  illustrationsLoaders: createIllustrationsLoadersScript,
84
97
  },
85
- bundle: `vite build ${viteConfig}`,
98
+ bundle: `vite build ${viteConfig} --mode testing --base ${websiteBaseUrl}`,
99
+ bundle2: ``,
86
100
  illustrations: createIllustrationsJSImportsScript,
87
101
  },
102
+ copyProps: `node "${LIB}/copy-and-watch/index.js" --silent "src/i18n/*.properties" dist/`,
88
103
  copy: {
89
104
  default: "nps copy.src copy.props",
90
- src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
91
- srcGenerated: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.js" dist/generated/`,
92
- props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
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/`,
93
107
  },
94
108
  watch: {
95
- default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.typescript" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
109
+ default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" ${options.legacy ? '"nps watch.src"' : ""} "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
96
110
  devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
97
111
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
98
- typescript: tsWatchCommand,
99
- props: 'nps "copy.props --watch --safe --skip-initial-copy"',
100
- bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
112
+ typescript: tsWatchCommandStandalone,
113
+ props: 'nps "copyProps --watch --safe --skip-initial-copy"',
114
+ bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
101
115
  styles: {
102
116
  default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
103
117
  themes: 'nps "build.styles.themes -w"',
104
- components: {
105
- default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
106
- existingFiles: `nps "build.styles.components -w"`,
107
- newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
108
- },
118
+ components: `nps "build.styles.components -w"`,
109
119
  },
110
- templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
111
- api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
120
+ templates: 'chokidar "src/**/*.hbs" -i "src/generated" -c "nps build.templates"',
112
121
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
113
122
  },
114
123
  start: "nps prepare watch.devServer",
115
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-cy-single": `cross-env yarn cypress run --component --browser chrome --spec ${process.argv[3]}`,
116
130
  "test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
117
131
  "test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
118
132
  startWithScope: "nps scope.prepare scope.watchWithBundle",
119
133
  scope: {
120
- prepare: "nps scope.lint prepare scope.testPages",
134
+ prepare: "nps scope.lint scope.testPages",
121
135
  lint: `node "${LIB}/scoping/lint-src.js"`,
122
136
  testPages: {
123
137
  default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
@@ -126,16 +140,13 @@ const getScripts = (options) => {
126
140
  replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
127
141
  },
128
142
  watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
129
- watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
130
- bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
143
+ watch: 'concurrently "nps watch.templates" "nps watch.props" "nps watch.styles"',
144
+ bundle: `node ${LIB}/dev-server/dev-server.mjs ${viteConfig}`,
131
145
  },
132
146
  generateAPI: {
133
- default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
134
- prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
135
- prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
136
- preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
137
- jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
138
- cleanup: "rimraf jsdoc-dist/"
147
+ default: tsOption ? "nps generateAPI.generateCEM generateAPI.validateCEM" : "",
148
+ generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
149
+ validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
139
150
  },
140
151
  };
141
152
 
@@ -1,21 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const postcssCSStoESM = require('../lib/postcss-css-to-esm/index.js');
3
- const cssnano = require('cssnano');
4
- const fs = require("fs");
5
-
6
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
7
-
8
- module.exports = {
9
- plugins: [
10
- postcssImport(),
11
- cssnano({
12
- preset: [
13
- 'default', {
14
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
15
- mergeRules: false, // https://github.com/cssnano/cssnano/issues/730
16
- },
17
- ]
18
- }),
19
- postcssCSStoESM({ toReplace: 'src', includeDefaultTheme: true, packageName }),
20
- ]
21
- }
1
+ module.exports = {}