@ui5/webcomponents-tools 0.0.0-f734ea2da → 0.0.0-f79db712b

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 (108) hide show
  1. package/CHANGELOG.md +808 -0
  2. package/README.md +6 -6
  3. package/assets-meta.js +18 -3
  4. package/bin/dev.js +1 -5
  5. package/components-package/eslint.js +36 -0
  6. package/components-package/nps.js +108 -66
  7. package/components-package/postcss.components.js +1 -21
  8. package/components-package/postcss.themes.js +1 -23
  9. package/components-package/vite.config.js +13 -0
  10. package/components-package/wdio.js +405 -344
  11. package/components-package/wdio.sync.js +368 -0
  12. package/icons-collection/nps.js +51 -18
  13. package/lib/cem/custom-elements-manifest.config.mjs +499 -0
  14. package/lib/cem/event.mjs +135 -0
  15. package/lib/cem/schema-internal.json +1354 -0
  16. package/lib/cem/schema.json +1098 -0
  17. package/lib/cem/types-internal.d.ts +801 -0
  18. package/lib/cem/types.d.ts +736 -0
  19. package/lib/cem/utils.mjs +354 -0
  20. package/lib/cem/validate.js +67 -0
  21. package/lib/copy-and-watch/index.js +24 -1
  22. package/lib/copy-list/index.js +17 -17
  23. package/lib/create-icons/index.js +124 -58
  24. package/lib/create-illustrations/index.js +165 -0
  25. package/lib/create-new-component/index.js +72 -97
  26. package/lib/create-new-component/jsFileContentTemplate.js +73 -0
  27. package/lib/create-new-component/tsFileContentTemplate.js +71 -0
  28. package/lib/css-processors/css-processor-components.mjs +77 -0
  29. package/lib/css-processors/css-processor-themes.mjs +79 -0
  30. package/lib/css-processors/scope-variables.mjs +46 -0
  31. package/lib/css-processors/shared.mjs +76 -0
  32. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  33. package/lib/dev-server/dev-server.js +66 -0
  34. package/lib/dev-server/virtual-index-html-plugin.js +52 -0
  35. package/lib/esm-abs-to-rel/index.js +17 -10
  36. package/lib/generate-custom-elements-manifest/index.js +327 -0
  37. package/lib/generate-js-imports/illustrations.js +86 -0
  38. package/lib/generate-json-imports/i18n.js +43 -31
  39. package/lib/generate-json-imports/themes.js +36 -24
  40. package/lib/hbs2lit/src/compiler.js +24 -4
  41. package/lib/hbs2lit/src/includesReplacer.js +5 -5
  42. package/lib/hbs2lit/src/litVisitor2.js +95 -24
  43. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  44. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +33 -11
  45. package/lib/hbs2ui5/index.js +56 -23
  46. package/lib/i18n/defaults.js +65 -57
  47. package/lib/i18n/toJSON.js +12 -11
  48. package/lib/jsdoc/configTypescript.json +29 -0
  49. package/lib/jsdoc/plugin.js +41 -0
  50. package/lib/jsdoc/preprocess.js +146 -0
  51. package/lib/jsdoc/template/publish.js +21 -2
  52. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  53. package/lib/replace-global-core/index.js +13 -8
  54. package/lib/scoping/get-all-tags.js +2 -9
  55. package/lib/scoping/lint-src.js +1 -1
  56. package/lib/scoping/missing-dependencies.js +65 -0
  57. package/lib/scoping/report-tags-usage.js +28 -0
  58. package/lib/scoping/scope-test-pages.js +2 -1
  59. package/lib/test-runner/test-runner.js +71 -0
  60. package/package.json +36 -38
  61. package/bin/init-ui5-package.js +0 -3
  62. package/components-package/rollup.js +0 -216
  63. package/lib/documentation/index.js +0 -165
  64. package/lib/documentation/templates/api-component-since.js +0 -3
  65. package/lib/documentation/templates/api-css-variables-section.js +0 -24
  66. package/lib/documentation/templates/api-events-section.js +0 -35
  67. package/lib/documentation/templates/api-methods-section.js +0 -26
  68. package/lib/documentation/templates/api-properties-section.js +0 -40
  69. package/lib/documentation/templates/api-slots-section.js +0 -28
  70. package/lib/documentation/templates/template.js +0 -38
  71. package/lib/hash/config.js +0 -10
  72. package/lib/hash/generate.js +0 -19
  73. package/lib/hash/upToDate.js +0 -31
  74. package/lib/init-package/index.js +0 -136
  75. package/lib/init-package/resources/.eslintignore +0 -3
  76. package/lib/init-package/resources/bundle.es5.js +0 -25
  77. package/lib/init-package/resources/bundle.esm.js +0 -31
  78. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  79. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  80. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  81. package/lib/init-package/resources/config/rollup.config.js +0 -1
  82. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  83. package/lib/init-package/resources/package-scripts.js +0 -11
  84. package/lib/init-package/resources/src/Assets.js +0 -5
  85. package/lib/init-package/resources/src/MyFirstComponent.hbs +0 -1
  86. package/lib/init-package/resources/src/MyFirstComponent.js +0 -56
  87. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  88. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  89. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  90. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  91. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  92. package/lib/init-package/resources/src/themes/MyFirstComponent.css +0 -11
  93. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  94. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  95. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  96. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  97. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  98. package/lib/init-package/resources/src/themes/sap_fiori_3_hcb/parameters-bundle.css +0 -3
  99. package/lib/init-package/resources/src/themes/sap_fiori_3_hcw/parameters-bundle.css +0 -3
  100. package/lib/init-package/resources/test/pages/index.html +0 -56
  101. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
  102. package/lib/polyfill-placeholder/index.js +0 -5
  103. package/lib/postcss-css-to-esm/index.js +0 -45
  104. package/lib/postcss-css-to-json/index.js +0 -31
  105. package/lib/postcss-new-files/index.js +0 -36
  106. package/lib/serve/index.js +0 -46
  107. package/lib/serve/serve.json +0 -3
  108. package/package-lock.json +0 -48
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/master/docs/images/UI5_logo_wide.png)
1
+ ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-webcomponents/main/docs/images/UI5_logo_wide.png)
2
+
2
3
 
3
4
  # UI5 Web Components - Tools
4
5
 
5
- [![Travis CI Build Status](https://travis-ci.org/SAP/ui5-webcomponents.svg?branch=master)](https://travis-ci.org/SAP/ui5-webcomponents)
6
6
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Fwebcomponents.svg)](https://www.npmjs.com/package/@ui5/webcomponents)
7
7
 
8
8
  Provides libraries, configuration files and build artifacts,
9
9
  used by other UI5 Web Components packages, such as `main` and `fiori`.
10
10
 
11
11
  ## Resources
12
- - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/master/README.md)
12
+ - [UI5 Web Components - README.md](https://github.com/SAP/ui5-webcomponents/blob/main/README.md)
13
13
  - [UI5 Web Components - Home Page](https://sap.github.io/ui5-webcomponents)
14
14
  - [UI5 Web Components - Playground and API Reference](https://sap.github.io/ui5-webcomponents/playground/)
15
15
 
16
16
  ## Support
17
- We welcome all comments, suggestions, questions, and bug reports. Please follow our [Support Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/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/).
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/).
18
18
 
19
19
  ## Contribute
20
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/master/CONTRIBUTING.md).
20
+ Please check our [Contribution Guidelines](https://github.com/SAP/ui5-webcomponents/blob/main/docs/6-contributing/02-conventions-and-guidelines.md).
21
21
 
22
22
  ## License
23
23
  Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
24
- This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/master/LICENSE.txt) file.
24
+ This file is licensed under the Apache Software License, Version 2.0 except as noted otherwise in the [LICENSE](https://github.com/SAP/ui5-webcomponents/blob/main/LICENSE.txt) file.
package/assets-meta.js CHANGED
@@ -1,6 +1,6 @@
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",
@@ -8,8 +8,16 @@ const assetsMeta = {
8
8
  "sap_belize_hcb",
9
9
  "sap_belize_hcw",
10
10
  "sap_fiori_3_hcb",
11
- "sap_fiori_3_hcw"
12
- ]
11
+ "sap_fiori_3_hcw",
12
+ "sap_horizon",
13
+ "sap_horizon_dark",
14
+ "sap_horizon_hcb",
15
+ "sap_horizon_hcw",
16
+ "sap_horizon_exp",
17
+ "sap_horizon_dark_exp",
18
+ "sap_horizon_hcb_exp",
19
+ "sap_horizon_hcw_exp",
20
+ ],
13
21
  },
14
22
  "languages": {
15
23
  "default": "en",
@@ -17,6 +25,7 @@ const assetsMeta = {
17
25
  "ar",
18
26
  "bg",
19
27
  "ca",
28
+ "cnr",
20
29
  "cs",
21
30
  "cy",
22
31
  "da",
@@ -44,6 +53,7 @@ const assetsMeta = {
44
53
  "ko",
45
54
  "lt",
46
55
  "lv",
56
+ "mk",
47
57
  "ms",
48
58
  "nl",
49
59
  "no",
@@ -55,6 +65,7 @@ const assetsMeta = {
55
65
  "sh",
56
66
  "sk",
57
67
  "sl",
68
+ "sr",
58
69
  "sv",
59
70
  "th",
60
71
  "tr",
@@ -72,6 +83,7 @@ const assetsMeta = {
72
83
  "ar_SA",
73
84
  "bg",
74
85
  "ca",
86
+ // "cnr_ME" - cldr for not available yet
75
87
  "cs",
76
88
  "da",
77
89
  "de",
@@ -119,6 +131,7 @@ const assetsMeta = {
119
131
  "lt",
120
132
  "lv",
121
133
  "ms",
134
+ // "mk_MK" cldr not available yet
122
135
  "nb",
123
136
  "nl",
124
137
  "nl_BE",
@@ -131,6 +144,8 @@ const assetsMeta = {
131
144
  "sk",
132
145
  "sl",
133
146
  "sr",
147
+ // "sr_Cyrl_RS" - cldr not available yet
148
+ "sr_Latn",
134
149
  "sv",
135
150
  "th",
136
151
  "tr",
package/bin/dev.js CHANGED
@@ -10,11 +10,7 @@ if (command === "watch") {
10
10
  command = `watch.${argument}`;
11
11
  }
12
12
  } else if (command === "test") {
13
- if (argument === "--no-server") { // yarn test --no-server
14
- command = `test.run`;
15
- } else if (argument) { // yarn test test/specs/Button.spec.js
16
- command = `test.spec --spec ${argument}`;
17
- }
13
+ command = `test ${process.argv.slice(3).join(" ")}`;
18
14
  }
19
15
 
20
16
  child_process.execSync(`npx nps "${command}"`, {stdio: 'inherit'});
@@ -1,3 +1,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,6 +40,7 @@ module.exports = {
5
40
  },
6
41
  "root": true,
7
42
  "extends": "airbnb-base",
43
+ overrides,
8
44
  "parserOptions": {
9
45
  "ecmaVersion": 2018,
10
46
  "sourceType": "module"
@@ -1,107 +1,149 @@
1
1
  const path = require("path");
2
2
  const fs = require("fs");
3
-
3
+ const resolve = require("resolve");
4
4
  const LIB = path.join(__dirname, `../lib/`);
5
- const polyfillDir = path.dirname(require.resolve("@webcomponents/webcomponentsjs"));
6
- const polyfillPath = path.join(polyfillDir, "{*.js,*.map,*.md,bundles/**/*.*}");
7
- const packageName = JSON.parse(fs.readFileSync("./package.json")).name;
5
+ const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
8
6
 
9
7
  const getScripts = (options) => {
10
8
 
11
- const port = options.port || 8080; // preferred port
12
- const portStep = options.portStep || 1; // step to check for available ports, if preferred port is already used
9
+ // The script creates all JS modules (dist/illustrations/{illustrationName}.js) out of the existing SVGs
10
+ 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} ${illustration.collection}`);
12
+ const createIllustrationsJSImportsScript = illustrations.join(" && ");
13
+
14
+ // The script creates the "src/generated/js-imports/Illustration.js" file that registers loaders (dynamic JS imports) for each illustration
15
+ 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(" && ");
16
+
17
+ const tsOption = options.typescript;
18
+ const tsCommandOld = tsOption ? "tsc" : "";
19
+ let tsWatchCommandStandalone = tsOption ? "tsc --watch" : "";
20
+ // this command is only used for standalone projects. monorepo projects get their watch from vite, so opt-out here
21
+ if (options.noWatchTS) {
22
+ tsWatchCommandStandalone = "";
23
+ }
24
+ const tsCrossEnv = tsOption ? "cross-env UI5_TS=true" : "";
25
+
26
+ if (tsOption) {
27
+ try {
28
+ require("typescript");
29
+ } catch(e) {
30
+ 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.`);
31
+ process.exit(e.code);
32
+ }
33
+ }
34
+
35
+ let viteConfig;
36
+ if (fs.existsSync("config/vite.config.js")) {
37
+ // old project setup where config file is in separate folder
38
+ viteConfig = "-c config/vite.config.js";
39
+ } else if (fs.existsSync("vite.config.js")) {
40
+ // preferred way of custom configuration in root project folder
41
+ viteConfig = "";
42
+ } else {
43
+ // no custom configuration - use default from tools project
44
+ viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
45
+ }
46
+
47
+ let eslintConfig;
48
+ if (fs.existsSync(".eslintrc.js") || fs.existsSync(".eslintrc.cjs")) {
49
+ // preferred way of custom configuration in root project folder
50
+ eslintConfig = "";
51
+ } else {
52
+ // no custom configuration - use default from tools project
53
+ eslintConfig = `--config "${require.resolve("@ui5/webcomponents-tools/components-package/eslint.js")}"`;
54
+ }
13
55
 
14
56
  const scripts = {
15
- clean: "rimraf dist && rimraf .port",
16
- lint: "eslint . --config config/.eslintrc.js",
17
- lintfix: "eslint . --config config/.eslintrc.js --fix",
57
+ clean: 'rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port && nps "scope.testPages.clean"',
58
+ lint: `eslint . ${eslintConfig}`,
59
+ lintfix: `eslint . ${eslintConfig} --fix`,
60
+ generate: {
61
+ default: `${tsCrossEnv} nps prepare.all`,
62
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps copy" "nps build.illustrations"',
63
+ styleRelated: "nps build.styles build.jsonImports build.jsImports",
64
+ },
18
65
  prepare: {
19
- default: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples",
20
- es5: "nps clean build.templates build.styles build.i18n build.jsonImports copy.es5 build.samples"
66
+ default: `${tsCrossEnv} nps clean prepare.all copy prepare.typescript generateAPI`,
67
+ all: 'concurrently "nps build.templates" "nps build.i18n" "nps prepare.styleRelated" "nps build.illustrations"',
68
+ styleRelated: "nps build.styles build.jsonImports build.jsImports",
69
+ typescript: tsCommandOld,
21
70
  },
22
71
  build: {
23
- default: "nps lint prepare.es5 build.bundle",
24
- templates: `mkdirp dist/generated/templates && node "${LIB}/hbs2ui5/index.js" -d src/ -o dist/generated/templates`,
72
+ default: "nps prepare lint build.bundle", // build.bundle2
73
+ templates: `mkdirp src/generated/templates && ${tsCrossEnv} node "${LIB}/hbs2ui5/index.js" -d src/ -o src/generated/templates`,
25
74
  styles: {
26
- default: "nps build.styles.themes build.styles.components",
27
- themes: "postcss src/**/parameters-bundle.css --config config/postcss.themes --base src --dir dist/css/",
28
- components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/", // When updating this, also update the new files script
75
+ default: `concurrently "nps build.styles.themes" "nps build.styles.components"`,
76
+ themes: `node "${LIB}/css-processors/css-processor-themes.mjs"`,
77
+ components: `node "${LIB}/css-processors/css-processor-components.mjs"`,
29
78
  },
30
79
  i18n: {
31
80
  default: "nps build.i18n.defaultsjs build.i18n.json",
32
- defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n dist/generated/i18n`,
81
+ defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
33
82
  json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
34
83
  },
35
84
  jsonImports: {
36
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
37
- themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes dist/generated/json-imports`,
38
- i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n dist/generated/json-imports`,
85
+ default: "mkdirp src/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
86
+ themes: `node "${LIB}/generate-json-imports/themes.js" dist/generated/assets/themes src/generated/json-imports`,
87
+ i18n: `node "${LIB}/generate-json-imports/i18n.js" dist/generated/assets/i18n src/generated/json-imports`,
39
88
  },
40
- bundle: "rollup --config config/rollup.config.js --environment ES5_BUILD",
41
- samples: {
42
- default: "nps build.samples.api build.samples.docs",
43
- api: `jsdoc -c "${LIB}/jsdoc/config.json"`,
44
- docs: `node "${LIB}/documentation/index.js" dist/api.json`,
45
- }
89
+ jsImports: {
90
+ default: "mkdirp src/generated/js-imports && nps build.jsImports.illustrationsLoaders",
91
+ illustrationsLoaders: createIllustrationsLoadersScript,
92
+ },
93
+ bundle: `vite build ${viteConfig}`,
94
+ bundle2: ``,
95
+ illustrations: createIllustrationsJSImportsScript,
46
96
  },
47
97
  copy: {
48
- default: "nps copy.src copy.props copy.test copy.webcomponents-polyfill-placeholder",
49
- es5: "nps copy.src copy.props copy.test copy.webcomponents-polyfill",
50
- src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.js" dist/`,
98
+ default: "nps copy.src copy.props",
99
+ src: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.{js,json}" dist/`,
100
+ // srcGenerated2: `node "${LIB}/copy-and-watch/index.js" --silent "src/generated/**/*.{js,json}" dist/generated/`,
51
101
  props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
52
- test: `node "${LIB}/copy-and-watch/index.js" --silent "test/**/*.*" dist/test-resources`,
53
- "webcomponents-polyfill": `node "${LIB}/copy-and-watch/index.js" --silent "${polyfillPath}" dist/webcomponentsjs/`,
54
- "webcomponents-polyfill-placeholder": `node ${LIB}/polyfill-placeholder/index.js`
55
102
  },
56
103
  watch: {
57
- default: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle" "nps watch.styles" "nps watch.i18n"',
58
- es5: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle.es5" "nps watch.styles" "nps watch.i18n"',
104
+ default: `${tsCrossEnv} concurrently "nps watch.templates" "nps watch.typescript" "nps watch.api" "nps watch.src" "nps watch.styles" "nps watch.i18n" "nps watch.props"`,
105
+ devServer: 'concurrently "nps watch.default" "nps watch.bundle"',
59
106
  src: 'nps "copy.src --watch --safe --skip-initial-copy"',
107
+ typescript: tsWatchCommandStandalone,
60
108
  props: 'nps "copy.props --watch --safe --skip-initial-copy"',
61
- test: 'nps "copy.test --watch --safe --skip-initial-copy"',
62
- bundle: {
63
- default: 'rollup --config config/rollup.config.js -w --environment DEV,DEPLOY_PUBLIC_PATH:/resources/',
64
- es5: 'rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV,DEPLOY_PUBLIC_PATH:/resources/'
65
- },
109
+ bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
66
110
  styles: {
67
111
  default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
68
112
  themes: 'nps "build.styles.themes -w"',
69
- components: {
70
- default: 'concurrently "nps watch.styles.components.existingFiles" "nps watch.styles.components.newFiles"',
71
- existingFiles: `nps "build.styles.components -w"`,
72
- newFiles: `node "${LIB}/postcss-new-files/index.js" --srcFiles="src/themes/*.css"`,
73
- },
113
+ components: `nps "build.styles.components -w"`,
74
114
  },
75
115
  templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
76
- samples: 'chokidar "test/**/*.sample.html" -c "nps build.samples"',
116
+ api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
77
117
  i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
78
118
  },
79
- dev: {
80
- default: 'concurrently "nps serve" "nps watch"',
81
- es5: 'concurrently "nps serve" "nps watch.es5"'
82
- },
83
- start: "nps prepare dev",
84
- serve: `node "${LIB}/serve/index.js" --dir="dist/" --port=${port} --portStep=${portStep} --packageName="${packageName}"`,
85
- test: {
86
- // --success first - report the exit code of the test run (first command to finish), as serve is always terminated and has a non-0 exit code
87
- default: 'concurrently "nps serve" "nps test.run" --kill-others --success first',
88
- run: "cross-env WDIO_LOG_LEVEL=error wdio config/wdio.conf.js",
89
- spec: "wdio run config/wdio.conf.js",
90
- },
91
- startWithScope: "nps scope.prepare scope.dev",
119
+ start: "nps prepare watch.devServer",
120
+ test: `node "${LIB}/test-runner/test-runner.js"`,
121
+ "test-suite-1": `node "${LIB}/test-runner/test-runner.js" --suite suite1`,
122
+ "test-suite-2": `node "${LIB}/test-runner/test-runner.js" --suite suite2`,
123
+ startWithScope: "nps scope.prepare scope.watchWithBundle",
92
124
  scope: {
93
- prepare: "nps scope.lint prepare scope.testPages",
125
+ prepare: "nps scope.lint scope.testPages",
94
126
  lint: `node "${LIB}/scoping/lint-src.js"`,
95
127
  testPages: {
96
128
  default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
97
- clean: "rimraf dist/test-resources/pages/scoped",
98
- copy: `node "${LIB}/copy-and-watch/index.js" --silent "dist/test-resources/pages/**/*" dist/test-resources/scoped`,
99
- replace: `node "${LIB}/scoping/scope-test-pages.js" dist/test-resources/scoped demo`,
129
+ clean: "rimraf test/pages/scoped",
130
+ copy: `node "${LIB}/copy-and-watch/index.js" --silent "test/pages/**/*" test/pages/scoped`,
131
+ replace: `node "${LIB}/scoping/scope-test-pages.js" test/pages/scoped demo`,
100
132
  },
101
- dev: 'concurrently "nps serve" "nps scope.watch"',
102
- watch: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.props" "nps scope.bundle" "nps watch.styles"',
103
- bundle: 'rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV,SCOPE'
104
- }
133
+ watchWithBundle: 'concurrently "nps scope.watch" "nps scope.bundle" ',
134
+ watch: 'concurrently "nps watch.templates" "nps watch.api" "nps watch.src" "nps watch.props" "nps watch.styles"',
135
+ bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
136
+ },
137
+ generateAPI: {
138
+ default: `nps ${ tsOption ? "generateAPI.generateCEM generateAPI.validateCEM" : "generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest"}`,
139
+ generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" ${ options.dev ? "--dev" : "" }`,
140
+ validateCEM: `node "${LIB}/cem/validate.js" ${ options.dev ? "--dev" : "" }`,
141
+ prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
142
+ prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
143
+ preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
144
+ jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
145
+ cleanup: "rimraf jsdoc-dist/"
146
+ },
105
147
  };
106
148
 
107
149
  return scripts;
@@ -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 = {}
@@ -1,23 +1 @@
1
- const postcssImport = require('postcss-import');
2
- const combineSelectors = require('postcss-combine-duplicated-selectors');
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
-
7
- module.exports = {
8
- plugins: [
9
- postcssImport(),
10
- combineSelectors({
11
- removeDuplicatedProperties: true
12
- }),
13
- cssnano({
14
- preset: [
15
- 'default', {
16
- mergeLonghand: false, // https://github.com/cssnano/cssnano/issues/675
17
- },
18
- ]
19
- },),
20
- postcssCSStoJSON({toReplace: 'src'}),
21
- postcssCSStoESM({toReplace: 'src'}),
22
- ]
23
- };
1
+ module.exports = {};
@@ -0,0 +1,13 @@
1
+ // vite.config.js
2
+ import { defineConfig } from 'vite';
3
+ import virtualIndex from '../lib/dev-server/virtual-index-html-plugin.js';
4
+
5
+ export default defineConfig(async () => {
6
+ const data = await virtualIndex();
7
+ return {
8
+ build: {
9
+ emptyOutDir: false,
10
+ },
11
+ plugins: [data],
12
+ }
13
+ })