@ui5/webcomponents-tools 1.20.0-rc.2 → 1.20.0-rc.3

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,17 @@
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
+ # [1.20.0-rc.3](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.2...v1.20.0-rc.3) (2023-11-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * register custom theme properties ([#7750](https://github.com/SAP/ui5-webcomponents/issues/7750)) ([c6c04c6](https://github.com/SAP/ui5-webcomponents/commit/c6c04c609d82a7442bdf79ef5bba46a406859a27))
12
+
13
+
14
+
15
+
16
+
6
17
  # [1.20.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.20.0-rc.1...v1.20.0-rc.2) (2023-11-23)
7
18
 
8
19
  **Note:** Version bump only for package @ui5/webcomponents-tools
@@ -1,10 +1,45 @@
1
+ const path = require("path");
1
2
  const name = "postcss-scope-vars";
2
3
 
4
+ const escapeVersion = version => "v" + version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");
5
+
6
+ /**
7
+ * Tries to detect an override for a package
8
+ * @param {*} filePath For example: /my_project/src/themes/overrides/@ui5/webcomponents/my_custom_theme/parameters-bundle.css
9
+ * @returns
10
+ */
11
+ const getOverrideVersion = filePath => {
12
+ console.log(filePath);
13
+ if (!filePath.includes(`overrides${path.sep}`)) {
14
+ return; // The "overrides/" directory is the marker
15
+ }
16
+ const override = filePath.split(`overrides${path.sep}`)[1]; // For example, this will be: @ui5/webcomponents/my_custom_theme/parameters-bundle.css
17
+ if (!override) {
18
+ return; // There must be other directories after overrides/, the path can't end with it
19
+ }
20
+ const parts = override.split(path.sep);
21
+ if (parts.length < 3) {
22
+ return; // There must be at least a directory for the theme that is being overridden (my_custom_theme) and the name of the CSS file after the name of the package that is overridden
23
+ }
24
+ const packageName = parts.slice(0, -2).join(path.sep); // After the last 2 parts are removed (my_custom_theme and parameters-bundle.css from the example), the rest is the package
25
+
26
+ let overrideVersion;
27
+ try {
28
+ overrideVersion = require(`${packageName}${path.sep}package.json`).version;
29
+ } catch (e) {
30
+ console.log(`Error requiring package ${packageName}: ${e.message}`);
31
+ }
32
+
33
+ return overrideVersion;
34
+ }
35
+
3
36
  module.exports = (options) => {
4
- const versionStr = "v" + options?.version?.replaceAll(/[^0-9A-Za-z\-_]/g, "-");
5
37
  return {
6
38
  postcssPlugin: name,
7
- prepare() {
39
+ prepare(opts) {
40
+ const filePath = opts.root.source.input.file;
41
+ const versionStr = escapeVersion(getOverrideVersion(filePath) || options?.version);
42
+
8
43
  return {
9
44
  Declaration: (declaration) => {
10
45
  if (declaration.__ui5_replaced) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui5/webcomponents-tools",
3
- "version": "1.20.0-rc.2",
3
+ "version": "1.20.0-rc.3",
4
4
  "description": "UI5 Web Components: webcomponents.tools",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -78,5 +78,5 @@
78
78
  "devDependencies": {
79
79
  "yargs": "^17.5.1"
80
80
  },
81
- "gitHead": "1d9acab8af658e34d3fd5abebf8f8a744ba0b1ab"
81
+ "gitHead": "db65adba918cc8605bcd8e0096778a63bf8ca8c2"
82
82
  }