@ui5/webcomponents-tools 0.0.0-c6d8872f3 → 0.0.0-c8721b8d2

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 (93) hide show
  1. package/CHANGELOG.md +896 -1
  2. package/README.md +6 -6
  3. package/assets-meta.js +162 -0
  4. package/bin/dev.js +12 -1
  5. package/components-package/eslint.js +35 -0
  6. package/components-package/nps.js +118 -45
  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 -333
  11. package/components-package/wdio.sync.js +368 -0
  12. package/icons-collection/nps.js +71 -28
  13. package/lib/copy-and-watch/index.js +145 -0
  14. package/lib/copy-list/index.js +28 -0
  15. package/lib/create-icons/index.js +124 -54
  16. package/lib/create-illustrations/index.js +175 -0
  17. package/lib/create-new-component/index.js +72 -93
  18. package/lib/create-new-component/jsFileContentTemplate.js +73 -0
  19. package/lib/create-new-component/tsFileContentTemplate.js +80 -0
  20. package/lib/css-processors/css-processor-components.mjs +77 -0
  21. package/lib/css-processors/css-processor-themes.mjs +79 -0
  22. package/lib/css-processors/scope-variables.mjs +46 -0
  23. package/lib/css-processors/shared.mjs +76 -0
  24. package/lib/dev-server/custom-hot-update-plugin.js +39 -0
  25. package/lib/dev-server/dev-server.js +66 -0
  26. package/lib/dev-server/virtual-index-html-plugin.js +52 -0
  27. package/lib/esm-abs-to-rel/index.js +61 -0
  28. package/lib/generate-custom-elements-manifest/index.js +327 -0
  29. package/lib/generate-js-imports/illustrations.js +86 -0
  30. package/lib/generate-json-imports/i18n.js +103 -47
  31. package/lib/generate-json-imports/themes.js +76 -18
  32. package/lib/hbs2lit/index.js +2 -4
  33. package/lib/hbs2lit/src/compiler.js +30 -9
  34. package/lib/hbs2lit/src/includesReplacer.js +23 -17
  35. package/lib/hbs2lit/src/litVisitor2.js +125 -26
  36. package/lib/hbs2lit/src/svgProcessor.js +12 -5
  37. package/lib/hbs2ui5/RenderTemplates/LitRenderer.js +35 -7
  38. package/lib/hbs2ui5/index.js +69 -30
  39. package/lib/i18n/defaults.js +77 -50
  40. package/lib/i18n/toJSON.js +25 -13
  41. package/lib/jsdoc/config.json +1 -1
  42. package/lib/jsdoc/configTypescript.json +29 -0
  43. package/lib/jsdoc/plugin.js +65 -4
  44. package/lib/jsdoc/preprocess.js +146 -0
  45. package/lib/jsdoc/template/publish.js +32 -4
  46. package/lib/postcss-combine-duplicated-selectors/index.js +185 -0
  47. package/lib/replace-global-core/index.js +25 -0
  48. package/lib/scoping/get-all-tags.js +37 -0
  49. package/lib/scoping/lint-src.js +31 -0
  50. package/lib/scoping/missing-dependencies.js +65 -0
  51. package/lib/scoping/report-tags-usage.js +28 -0
  52. package/lib/scoping/scope-test-pages.js +41 -0
  53. package/lib/test-runner/test-runner.js +71 -0
  54. package/package.json +52 -55
  55. package/bin/init-ui5-package.js +0 -3
  56. package/components-package/rollup.js +0 -134
  57. package/components-package/serve.json +0 -3
  58. package/lib/documentation/index.js +0 -143
  59. package/lib/documentation/templates/api-component-since.js +0 -3
  60. package/lib/documentation/templates/api-css-variables-section.js +0 -24
  61. package/lib/documentation/templates/api-events-section.js +0 -35
  62. package/lib/documentation/templates/api-methods-section.js +0 -26
  63. package/lib/documentation/templates/api-properties-section.js +0 -40
  64. package/lib/documentation/templates/api-slots-section.js +0 -28
  65. package/lib/documentation/templates/template.js +0 -38
  66. package/lib/init-package/index.js +0 -119
  67. package/lib/init-package/resources/.eslintignore +0 -3
  68. package/lib/init-package/resources/bundle.es5.js +0 -25
  69. package/lib/init-package/resources/bundle.esm.js +0 -34
  70. package/lib/init-package/resources/config/.eslintrc.js +0 -1
  71. package/lib/init-package/resources/config/postcss.components/postcss.config.js +0 -1
  72. package/lib/init-package/resources/config/postcss.themes/postcss.config.js +0 -1
  73. package/lib/init-package/resources/config/rollup.config.js +0 -1
  74. package/lib/init-package/resources/config/wdio.conf.js +0 -1
  75. package/lib/init-package/resources/package-scripts.js +0 -11
  76. package/lib/init-package/resources/src/Assets.js +0 -6
  77. package/lib/init-package/resources/src/Demo.hbs +0 -1
  78. package/lib/init-package/resources/src/Demo.js +0 -56
  79. package/lib/init-package/resources/src/i18n/messagebundle.properties +0 -2
  80. package/lib/init-package/resources/src/i18n/messagebundle_de.properties +0 -1
  81. package/lib/init-package/resources/src/i18n/messagebundle_en.properties +0 -1
  82. package/lib/init-package/resources/src/i18n/messagebundle_es.properties +0 -1
  83. package/lib/init-package/resources/src/i18n/messagebundle_fr.properties +0 -1
  84. package/lib/init-package/resources/src/themes/Demo.css +0 -11
  85. package/lib/init-package/resources/src/themes/sap_belize/parameters-bundle.css +0 -3
  86. package/lib/init-package/resources/src/themes/sap_belize_hcb/parameters-bundle.css +0 -3
  87. package/lib/init-package/resources/src/themes/sap_belize_hcw/parameters-bundle.css +0 -3
  88. package/lib/init-package/resources/src/themes/sap_fiori_3/parameters-bundle.css +0 -3
  89. package/lib/init-package/resources/src/themes/sap_fiori_3_dark/parameters-bundle.css +0 -3
  90. package/lib/init-package/resources/test/pages/index.html +0 -51
  91. package/lib/init-package/resources/test/specs/Demo.spec.js +0 -12
  92. package/lib/postcss-css-to-esm/index.js +0 -33
  93. package/lib/postcss-css-to-json/index.js +0 -20
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 ADDED
@@ -0,0 +1,162 @@
1
+ const assetsMeta = {
2
+ "themes": {
3
+ "default": "sap_horizon",
4
+ "all": [
5
+ "sap_fiori_3",
6
+ "sap_fiori_3_dark",
7
+ "sap_belize",
8
+ "sap_belize_hcb",
9
+ "sap_belize_hcw",
10
+ "sap_fiori_3_hcb",
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
+ ],
21
+ },
22
+ "languages": {
23
+ "default": "en",
24
+ "all": [
25
+ "ar",
26
+ "bg",
27
+ "ca",
28
+ "cnr",
29
+ "cs",
30
+ "cy",
31
+ "da",
32
+ "de",
33
+ "el",
34
+ "en",
35
+ "en_GB",
36
+ "en_US_sappsd",
37
+ "en_US_saprigi",
38
+ "en_US_saptrc",
39
+ "es",
40
+ "es_MX",
41
+ "et",
42
+ "fi",
43
+ "fr",
44
+ "fr_CA",
45
+ "hi",
46
+ "hr",
47
+ "hu",
48
+ "in",
49
+ "it",
50
+ "iw",
51
+ "ja",
52
+ "kk",
53
+ "ko",
54
+ "lt",
55
+ "lv",
56
+ "mk",
57
+ "ms",
58
+ "nl",
59
+ "no",
60
+ "pl",
61
+ "pt_PT",
62
+ "pt",
63
+ "ro",
64
+ "ru",
65
+ "sh",
66
+ "sk",
67
+ "sl",
68
+ "sr",
69
+ "sv",
70
+ "th",
71
+ "tr",
72
+ "uk",
73
+ "vi",
74
+ "zh_CN",
75
+ "zh_TW"
76
+ ]
77
+ },
78
+ "locales": {
79
+ "default": "en",
80
+ "all": [
81
+ "ar",
82
+ "ar_EG",
83
+ "ar_SA",
84
+ "bg",
85
+ "ca",
86
+ // "cnr_ME" - cldr for not available yet
87
+ "cs",
88
+ "da",
89
+ "de",
90
+ "de_AT",
91
+ "de_CH",
92
+ "el",
93
+ "el_CY",
94
+ "en",
95
+ "en_AU",
96
+ "en_GB",
97
+ "en_HK",
98
+ "en_IE",
99
+ "en_IN",
100
+ "en_NZ",
101
+ "en_PG",
102
+ "en_SG",
103
+ "en_ZA",
104
+ "es",
105
+ "es_AR",
106
+ "es_BO",
107
+ "es_CL",
108
+ "es_CO",
109
+ "es_MX",
110
+ "es_PE",
111
+ "es_UY",
112
+ "es_VE",
113
+ "et",
114
+ "fa",
115
+ "fi",
116
+ "fr",
117
+ "fr_BE",
118
+ "fr_CA",
119
+ "fr_CH",
120
+ "fr_LU",
121
+ "he",
122
+ "hi",
123
+ "hr",
124
+ "hu",
125
+ "id",
126
+ "it",
127
+ "it_CH",
128
+ "ja",
129
+ "kk",
130
+ "ko",
131
+ "lt",
132
+ "lv",
133
+ "ms",
134
+ // "mk_MK" cldr not available yet
135
+ "nb",
136
+ "nl",
137
+ "nl_BE",
138
+ "pl",
139
+ "pt",
140
+ "pt_PT",
141
+ "ro",
142
+ "ru",
143
+ "ru_UA",
144
+ "sk",
145
+ "sl",
146
+ "sr",
147
+ // "sr_Cyrl_RS" - cldr not available yet
148
+ "sr_Latn",
149
+ "sv",
150
+ "th",
151
+ "tr",
152
+ "uk",
153
+ "vi",
154
+ "zh_CN",
155
+ "zh_HK",
156
+ "zh_SG",
157
+ "zh_TW"
158
+ ]
159
+ }
160
+ };
161
+
162
+ module.exports = assetsMeta;
package/bin/dev.js CHANGED
@@ -2,4 +2,15 @@
2
2
 
3
3
  const child_process = require("child_process");
4
4
 
5
- child_process.execSync(`npx nps ${process.argv[2]}`, {stdio: 'inherit'});
5
+ let command = process.argv[2];
6
+ const argument = process.argv[3];
7
+
8
+ if (command === "watch") {
9
+ if (["src", "test", "bundles", "styles", "templates", "samples"].includes(argument)) {
10
+ command = `watch.${argument}`;
11
+ }
12
+ } else if (command === "test") {
13
+ command = `test ${process.argv.slice(3).join(" ")}`;
14
+ }
15
+
16
+ child_process.execSync(`npx nps "${command}"`, {stdio: 'inherit'});
@@ -1,3 +1,37 @@
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
+ "lines-between-class-members": "off",
32
+ }
33
+ }] : [];
34
+
1
35
  module.exports = {
2
36
  "env": {
3
37
  "browser": true,
@@ -5,6 +39,7 @@ module.exports = {
5
39
  },
6
40
  "root": true,
7
41
  "extends": "airbnb-base",
42
+ overrides,
8
43
  "parserOptions": {
9
44
  "ecmaVersion": 2018,
10
45
  "sourceType": "module"
@@ -1,73 +1,146 @@
1
1
  const path = require("path");
2
-
2
+ const fs = require("fs");
3
+ const resolve = require("resolve");
3
4
  const LIB = path.join(__dirname, `../lib/`);
4
- const NODE_MODULES_PATH = path.join(__dirname, `../../../node_modules/`);
5
- const serveConfig = path.join(__dirname, `serve.json`);
6
- const polyfillPath = path.join(NODE_MODULES_PATH, `/@webcomponents/webcomponentsjs/**/*.*`);
5
+ const preprocessJSDocScript = resolve.sync("@ui5/webcomponents-tools/lib/jsdoc/preprocess.js");
7
6
 
8
7
  const getScripts = (options) => {
9
8
 
10
- const port = options.port;
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.collection} ${illustrations.dynamicImports.location} ${illustrations.dynamicImports.prefix || '\"\"'} ${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
+ }
11
55
 
12
56
  const scripts = {
13
- clean: "rimraf dist",
14
- lint: "eslint . --config config/.eslintrc.js",
15
- prepare: "nps clean build.templates build.styles build.i18n build.jsonImports copy build.samples",
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
+ },
65
+ prepare: {
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,
70
+ },
16
71
  build: {
17
- default: "nps lint prepare build.bundle",
18
- 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`,
19
74
  styles: {
20
- default: "nps build.styles.themes build.styles.components",
21
- themes: "postcss src/**/parameters-bundle.css --config config/postcss.themes --base src --dir dist/css/",
22
- components: "postcss src/themes/*.css --config config/postcss.components --base src --dir dist/css/",
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"`,
23
78
  },
24
79
  i18n: {
25
80
  default: "nps build.i18n.defaultsjs build.i18n.json",
26
- defaultsjs: `mkdirp dist/generated/i18n && node ${LIB}/i18n/defaults.js src/i18n dist/generated/i18n`,
27
- json: `mkdirp dist/generated/assets/i18n && node ${LIB}/i18n/toJSON.js src/i18n dist/generated/assets/i18n`,
81
+ defaultsjs: `node "${LIB}/i18n/defaults.js" src/i18n src/generated/i18n`,
82
+ json: `node "${LIB}/i18n/toJSON.js" src/i18n dist/generated/assets/i18n`,
28
83
  },
29
84
  jsonImports: {
30
- default: "mkdirp dist/generated/json-imports && nps build.jsonImports.themes build.jsonImports.i18n",
31
- themes: `node ${LIB}/generate-json-imports/themes.js`,
32
- i18n: `node ${LIB}/generate-json-imports/i18n.js`,
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`,
33
88
  },
34
- bundle: "rollup --config config/rollup.config.js --environment ES5_BUILD",
35
- samples: {
36
- default: "nps build.samples.api build.samples.docs",
37
- api: `jsdoc -c ${LIB}/jsdoc/config.json`,
38
- docs: `node ${LIB}/documentation/index.js dist/api.json`,
39
- }
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,
40
96
  },
41
97
  copy: {
42
- default: "nps copy.src copy.test copy.webcomponents-polyfill",
43
- src: "copy-and-watch \"src/**/*.js\" dist/",
44
- test: "copy-and-watch \"test/**/*.*\" dist/test-resources",
45
- "webcomponents-polyfill": `copy-and-watch "${polyfillPath}" dist/webcomponentsjs/`,
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/`,
101
+ props: `node "${LIB}/copy-and-watch/index.js" --silent "src/**/*.properties" dist/`,
46
102
  },
47
103
  watch: {
48
- default: 'concurrently "nps watch.templates" "nps watch.samples" "nps watch.test" "nps watch.src" "nps watch.bundle" "nps watch.styles"',
49
- src: 'nps "copy.src --watch --skip-initial-copy"',
50
- test: 'nps "copy.test --watch --skip-initial-copy"',
51
- bundle: "rollup --config config/rollup.config.js -w --environment ES5_BUILD,DEV",
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"',
106
+ src: 'nps "copy.src --watch --safe --skip-initial-copy"',
107
+ typescript: tsWatchCommandStandalone,
108
+ props: 'nps "copy.props --watch --safe --skip-initial-copy"',
109
+ bundle: `node ${LIB}/dev-server/dev-server.js ${viteConfig}`,
52
110
  styles: {
53
111
  default: 'concurrently "nps watch.styles.themes" "nps watch.styles.components"',
54
112
  themes: 'nps "build.styles.themes -w"',
55
- components: 'nps "build.styles.components -w"',
113
+ components: `nps "build.styles.components -w"`,
56
114
  },
57
- templates: "chokidar \"src/**/*.hbs\" -c \"nps build.templates\"",
58
- samples: "chokidar \"test/**/*.sample.html\" -c \"nps build.samples\"",
115
+ templates: 'chokidar "src/**/*.hbs" -c "nps build.templates"',
116
+ api: 'chokidar "test/**/*.sample.html" -c "nps generateAPI"',
117
+ i18n: 'chokidar "src/i18n/messagebundle.properties" -c "nps build.i18n.defaultsjs"'
59
118
  },
60
- dev: 'concurrently "nps serve" "nps watch"',
61
- start: "nps prepare dev",
62
- serve: {
63
- default: "nps serve.prepare serve.run",
64
- prepare: `copy-and-watch "${serveConfig}" dist/`,
65
- run: `serve --no-clipboard -l ${port} dist`,
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",
124
+ scope: {
125
+ prepare: "nps scope.lint scope.testPages",
126
+ lint: `node "${LIB}/scoping/lint-src.js"`,
127
+ testPages: {
128
+ default: "nps scope.testPages.clean scope.testPages.copy scope.testPages.replace",
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`,
132
+ },
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}`,
66
136
  },
67
- test: {
68
- // --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
69
- default: 'concurrently "nps serve" "nps test.run" --kill-others --success first',
70
- run: "cross-env WDIO_LOG_LEVEL=error FORCE_COLOR=0 wdio config/wdio.conf.js",
137
+ generateAPI: {
138
+ default: "nps generateAPI.prepare generateAPI.preprocess generateAPI.jsdoc generateAPI.cleanup generateAPI.prepareManifest",
139
+ prepare: `node "${LIB}/copy-and-watch/index.js" --silent "dist/**/*.js" jsdoc-dist/`,
140
+ prepareManifest: `node "${LIB}/generate-custom-elements-manifest/index.js" dist dist`,
141
+ preprocess: `node "${preprocessJSDocScript}" jsdoc-dist/ src`,
142
+ jsdoc: `jsdoc -c "${LIB}/jsdoc/configTypescript.json"`,
143
+ cleanup: "rimraf jsdoc-dist/"
71
144
  },
72
145
  };
73
146
 
@@ -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
+ })