@ui5/logger 4.0.1 → 5.0.0-alpha.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
@@ -2,10 +2,29 @@
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
4
4
 
5
- A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v4.0.1...HEAD).
5
+ A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v4.0.2...HEAD).
6
+
7
+ <a name="5.0.0-alpha.0"></a>
8
+ ## [5.0.0-alpha.0](https://github.com/UI5/cli/compare/logger-v4.0.2...logger-v5.0.0-alpha.0) (2025-11-25)
9
+
10
+
11
+ ### Breaking Changes
12
+
13
+ * **logger:** Require Node.js 22.20.0 || >= 24.0.0
14
+
15
+
16
+ ### Features
17
+
18
+ * **logger:** Add module filtering, task-skip event ([5a1b071](https://github.com/UI5/cli/commit/5a1b07127ad91ba27deaface060235ddb16a9e21))
19
+
20
+ ## [v4.0.2] - 2025-09-11
21
+ ### Bug Fixes
22
+ - Rename project to UI5 CLI [`18d935a`](https://github.com/SAP/ui5-logger/commit/18d935a7caf7d53312b4f3976b0075aeae608902)
23
+ - **Console:** Handle consequitive builds correctly [`20e303a`](https://github.com/SAP/ui5-logger/commit/20e303ac157778aa1be0e20bb203e713fff2299c)
24
+
6
25
 
7
26
  <a name="v4.0.1"></a>
8
- ## [v4.0.1] - 2024-07-17
27
+ ## [v4.0.1] - 2024-07-23
9
28
 
10
29
  <a name="v4.0.0"></a>
11
30
  ## [v4.0.0] - 2024-07-16
@@ -111,6 +130,7 @@ Only Node.js v10 or higher is supported.
111
130
 
112
131
  <a name="v0.0.1"></a>
113
132
  ## v0.0.1 - 2018-06-06
133
+ [v4.0.2]: https://github.com/SAP/ui5-logger/compare/v4.0.1...v4.0.2
114
134
  [v4.0.1]: https://github.com/SAP/ui5-logger/compare/v4.0.0...v4.0.1
115
135
  [v4.0.0]: https://github.com/SAP/ui5-logger/compare/v3.0.1-rc.3...v4.0.0
116
136
  [v3.0.0]: https://github.com/SAP/ui5-logger/compare/v2.0.1...v3.0.0
package/LICENSE.txt CHANGED
@@ -186,7 +186,7 @@
186
186
  same "printed page" as the copyright notice for easier
187
187
  identification within third-party archives.
188
188
 
189
- Copyright 2018-2024 SAP SE or an SAP affiliate company and UI5 Tooling contributors
189
+ Copyright [yyyy] [name of copyright owner]
190
190
 
191
191
  Licensed under the Apache License, Version 2.0 (the "License");
192
192
  you may not use this file except in compliance with the License.
package/README.md CHANGED
@@ -1,27 +1,26 @@
1
- ![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-tooling/main/docs/images/UI5_logo_wide.png)
1
+ ![UI5 icon](https://raw.githubusercontent.com/UI5/cli/main/docs/images/UI5_logo_wide.png)
2
2
 
3
- # ui5-logger
4
- > Providing logging functionality for all UI5 Tooling modules and extensions.
3
+ # @ui5/logger
4
+ > Providing logging functionality for all UI5 CLI modules and extensions.
5
5
  > Features log levels and rendering of a progress bar.
6
- > Part of [UI5 Tooling](https://github.com/SAP/ui5-tooling)
6
+ > Part of [UI5 CLI](https://github.com/UI5/cli)
7
7
 
8
- [![REUSE status](https://api.reuse.software/badge/github.com/SAP/ui5-logger)](https://api.reuse.software/info/github.com/SAP/ui5-logger)
9
- [![Build Status](https://dev.azure.com/sap/opensource/_apis/build/status/SAP.ui5-logger?branchName=main)](https://dev.azure.com/sap/opensource/_build/latest?definitionId=37&branchName=main)
8
+ [![REUSE status](https://api.reuse.software/badge/github.com/UI5/cli)](https://api.reuse.software/info/github.com/UI5/cli)
10
9
  [![npm Package Version](https://badge.fury.io/js/%40ui5%2Flogger.svg)](https://www.npmjs.com/package/@ui5/logger)
11
10
  [![Coverage Status](https://coveralls.io/repos/github/SAP/ui5-logger/badge.svg)](https://coveralls.io/github/SAP/ui5-logger)
12
11
 
13
12
  ## Documentation
14
- General UI5 Tooling documentation can be found here: [sap.github.io/ui5-tooling](https://sap.github.io/ui5-tooling/)
13
+ General UI5 CLI documentation can be found here: [ui5.github.io/cli](https://ui5.github.io/cli/)
15
14
 
16
- The UI5 Logger API Reference can be found here: [`@ui5/logger`](https://sap.github.io/ui5-tooling/v3/api/module-@ui5_logger.html)
15
+ The UI5 Logger API Reference can be found here: [`@ui5/logger`](https://ui5.github.io/cli/stable/api/module-@ui5_logger.html)
17
16
 
18
17
  ## Contributing
19
- Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md).
18
+ Please check our [Contribution Guidelines](https://github.com/UI5/cli/blob/main/CONTRIBUTING.md).
20
19
 
21
20
  ## Support
22
- Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md#report-an-issue) on how to report an issue.
21
+ Please follow our [Contribution Guidelines](https://github.com/UI5/cli/blob/main/CONTRIBUTING.md#report-an-issue) on how to report an issue.
23
22
 
24
- Please report issues in the main [UI5 Tooling](https://github.com/SAP/ui5-tooling) repository.
23
+ Please report issues in the main [UI5 CLI](https://github.com/UI5/cli) repository.
25
24
 
26
25
  ## Release History
27
26
  See [CHANGELOG.md](CHANGELOG.md).
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import Logger from "./loggers/Logger.js";
2
2
 
3
3
  /**
4
- * Interface for the UI5 Tooling logging module
4
+ * Interface for the UI5 CLI logging module
5
5
  *
6
6
  * @public
7
7
  * @module @ui5/logger
@@ -1,7 +1,7 @@
1
1
  import Logger from "./Logger.js";
2
2
 
3
3
  /**
4
- * Logger for emitting status events on the progress a UI5 Tooling build process.
4
+ * Logger for emitting status events on the progress a UI5 CLI build process.
5
5
  * <br><br>
6
6
  * Emits <code>ui5.log</code>, <code>ui5.build-metadata</code> and <code>ui5.build-status</code> events on the
7
7
  * [<code>process</code>]{@link https://nodejs.org/api/process.html} object, which can which can be handled
@@ -5,7 +5,7 @@ import {inspect} from "node:util";
5
5
  const rIllegalModuleNameChars = /[^0-9a-zA-Z-_:@./]/i;
6
6
 
7
7
  /**
8
- * Standard logging module for UI5 Tooling and extensions.
8
+ * Standard logging module for UI5 CLI and extensions.
9
9
  * <br><br>
10
10
  * Emits <code>ui5.log</code> events on the [<code>process</code>]{@link https://nodejs.org/api/process.html} object,
11
11
  * which can be handled by dedicated writers,
@@ -83,6 +83,24 @@ class ProjectBuild extends Logger {
83
83
  this._log(level, `${this.#projectName}: Finished task ${taskName}`);
84
84
  }
85
85
  }
86
+
87
+ skipTask(taskName) {
88
+ if (!this.#tasksToRun || !this.#tasksToRun.includes(taskName)) {
89
+ throw new Error(`loggers/ProjectBuild#skipTask: Unknown task ${taskName}`);
90
+ }
91
+ const level = "info";
92
+ const hasListeners = this._emit(ProjectBuild.PROJECT_BUILD_STATUS_EVENT_NAME, {
93
+ level,
94
+ projectName: this.#projectName,
95
+ projectType: this.#projectType,
96
+ taskName,
97
+ status: "task-skip",
98
+ });
99
+
100
+ if (!hasListeners) {
101
+ this._log(level, `${this.#projectName}: Skipping task ${taskName}`);
102
+ }
103
+ }
86
104
  }
87
105
 
88
106
  export default ProjectBuild;
@@ -7,7 +7,7 @@ import Logger from "../loggers/Logger.js";
7
7
  /**
8
8
  * Standard handler for events emitted by @ui5/logger modules. Writes messages to
9
9
  * [<code>process.stderr</code>]{@link https://nodejs.org/api/process.html#processstderr} stream
10
- * and renders a progress bar for UI5 Tooling build processes.
10
+ * and renders a progress bar for UI5 CLI build processes.
11
11
  * <br><br>
12
12
  * The progress bar is only used in interactive terminals. If verbose logging is enabled, the progress
13
13
  * bar is disabled.
@@ -21,6 +21,7 @@ class Console {
21
21
  #progressBarContainer;
22
22
  #progressBar;
23
23
  #progressProjectWeight;
24
+ #moduleFilter;
24
25
 
25
26
  constructor() {
26
27
  this._handleLogEvent = this.#handleLogEvent.bind(this);
@@ -29,6 +30,72 @@ class Console {
29
30
  this._handleBuildMetadataEvent = this.#handleBuildMetadataEvent.bind(this);
30
31
  this._handleProjectBuildMetadataEvent = this.#handleProjectBuildMetadataEvent.bind(this);
31
32
  this._handleStop = this.disable.bind(this);
33
+ this.#initFiters();
34
+ }
35
+
36
+ #initFiters() {
37
+ const modulesPatterns = process.env.UI5_LOG_MODULES;
38
+ if (!modulesPatterns) {
39
+ this.#moduleFilter = null;
40
+ return;
41
+ }
42
+ const enabledModules = [];
43
+ const enabledNamespaces = [];
44
+ const disabledModules = [];
45
+ const disabledNamespaces = [];
46
+ // Example of modulePattern: "module1,module2:submodule:subsubmodule,module3:*:-module3:submodule"
47
+ modulesPatterns.split(",").forEach((modulePattern) => {
48
+ const pattern = modulePattern.trim();
49
+ if (pattern.startsWith("-")) {
50
+ if (pattern.endsWith(":*")) {
51
+ disabledNamespaces.push(pattern.substring(1, pattern.length - 2));
52
+ } else {
53
+ disabledModules.push(pattern.substring(1));
54
+ }
55
+ } else {
56
+ if (pattern.endsWith(":*")) {
57
+ enabledNamespaces.push(pattern.substring(0, pattern.length - 2));
58
+ } else {
59
+ enabledModules.push(pattern);
60
+ }
61
+ }
62
+ });
63
+
64
+ this.#moduleFilter = {
65
+ enabledModules,
66
+ enabledNamespaces,
67
+ disabledModules,
68
+ disabledNamespaces,
69
+ };
70
+ }
71
+
72
+ #filterModule(moduleName) {
73
+ if (!this.#moduleFilter) {
74
+ return true;
75
+ }
76
+ if (this.#moduleFilter.disabledModules.includes(moduleName)) {
77
+ return false;
78
+ }
79
+ if (this.#moduleFilter.enabledModules.includes(moduleName)) {
80
+ return true;
81
+ }
82
+ const moduleParts = moduleName.split(":");
83
+ for (let i = moduleParts.length - 1; i > 0; i--) {
84
+ const namespace = moduleParts.slice(0, i).join(":");
85
+ if (this.#moduleFilter.disabledNamespaces.includes(namespace)) {
86
+ return false;
87
+ }
88
+ if (this.#moduleFilter.enabledNamespaces.includes(namespace)) {
89
+ return true;
90
+ }
91
+ }
92
+
93
+ // If any module or namespace is enabled, all other modules are disabled by default
94
+ if (this.#moduleFilter.enabledModules.length > 0 || this.#moduleFilter.enabledNamespaces.length > 0) {
95
+ return false;
96
+ }
97
+
98
+ return true;
32
99
  }
33
100
 
34
101
  /**
@@ -137,10 +204,13 @@ class Console {
137
204
  }
138
205
 
139
206
  #handleLogEvent({level, message, moduleName}) {
140
- this.#writeMessage(level, `${chalk.blue(moduleName)} ${message}`);
207
+ if (this.#filterModule(moduleName)) {
208
+ this.#writeMessage(level, `${chalk.blue(moduleName)} ${message}`);
209
+ }
141
210
  }
142
211
 
143
212
  #handleBuildMetadataEvent({projectsToBuild}) {
213
+ this.#projectMetadata = new Map();
144
214
  projectsToBuild.forEach((projectName) => {
145
215
  this.#projectMetadata.set(projectName, {
146
216
  buildStarted: false,
@@ -327,6 +397,23 @@ class Console {
327
397
  taskMetadata.executionEnded = true;
328
398
  message = `${chalk.green(figures.tick)} Finished task ${chalk.bold(taskName)}`;
329
399
 
400
+ // Update progress bar (if used)
401
+ this._getProgressBar()?.increment(1);
402
+ break;
403
+ case "task-skip":
404
+ if (taskMetadata.executionEnded) {
405
+ throw new Error(`writers/Console: ` +
406
+ `Unexpected task-skip event for project ${projectName}, task ${taskName}. ` +
407
+ `Task execution already ended`);
408
+ }
409
+ if (taskMetadata.executionStarted) {
410
+ throw new Error(`writers/Console: ` +
411
+ `Unexpected task-skip event for project ${projectName}, task ${taskName}. ` +
412
+ `Task execution already started`);
413
+ }
414
+ taskMetadata.executionEnded = true;
415
+ message = `${chalk.green(figures.tick)} Skipping task ${chalk.bold(taskName)}`;
416
+
330
417
  // Update progress bar (if used)
331
418
  this._getProgressBar()?.increment(1);
332
419
  break;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ui5/logger",
3
- "version": "4.0.1",
4
- "description": "UI5 Tooling - Internal Logger",
3
+ "version": "5.0.0-alpha.0",
4
+ "description": "UI5 CLI - Internal Logger",
5
5
  "author": {
6
6
  "name": "SAP SE",
7
7
  "email": "openui5@sap.com",
@@ -25,36 +25,27 @@
25
25
  "./internal/loggers/*": "./lib/loggers/*.js"
26
26
  },
27
27
  "engines": {
28
- "node": "^20.11.0 || >=22.0.0",
28
+ "node": "^22.20.0 || >=24.0.0",
29
29
  "npm": ">= 8"
30
30
  },
31
31
  "scripts": {
32
- "test": "npm run lint && npm run jsdoc-generate && npm run coverage && npm run depcheck",
33
- "test-azure": "npm run coverage-xunit",
32
+ "test": "npm run lint && npm run coverage && npm run depcheck",
34
33
  "lint": "eslint ./",
35
34
  "unit": "rimraf test/tmp && ava",
36
35
  "unit-verbose": "rimraf test/tmp && cross-env UI5_LOG_LVL=verbose ava --verbose --serial",
37
36
  "unit-watch": "npm run unit -- --watch",
38
- "unit-xunit": "rimraf test/tmp && ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\" --tap | tap-xunit --dontUseCommentsAsTestNames=true > test-results.xml",
39
37
  "unit-inspect": "cross-env UI5_LOG_LVL=verbose ava debug --break",
40
38
  "coverage": "rimraf test/tmp && nyc ava --node-arguments=\"--experimental-loader=@istanbuljs/esm-loader-hook\"",
41
- "coverage-xunit": "nyc --reporter=text --reporter=text-summary --reporter=cobertura npm run unit-xunit",
42
- "jsdoc": "npm run jsdoc-generate && open-cli jsdocs/index.html",
43
- "jsdoc-generate": "jsdoc -c ./jsdoc.json -t $(node -p 'path.dirname(require.resolve(\"docdash\"))') ./lib/ || (echo 'Error during JSDoc generation! Check log.' && exit 1)",
44
- "jsdoc-watch": "npm run jsdoc && chokidar \"./lib/**/*.js\" -c \"npm run jsdoc-generate\"",
45
39
  "preversion": "npm test",
46
40
  "version": "git-chglog --sort semver --next-tag v$npm_package_version -o CHANGELOG.md v4.0.0.. && git add CHANGELOG.md",
47
41
  "prepublishOnly": "git push --follow-tags",
48
42
  "release-note": "git-chglog --sort semver -c .chglog/release-config.yml v$npm_package_version",
49
- "depcheck": "depcheck --ignores @ui5/logger,rimraf,docdash,@istanbuljs/esm-loader-hook"
43
+ "depcheck": "depcheck --ignores @ui5/logger,rimraf,@istanbuljs/esm-loader-hook,cross-env"
50
44
  },
51
45
  "files": [
52
46
  "CHANGELOG.md",
53
- "CONTRIBUTING.md",
54
- "jsdoc.json",
55
47
  "lib/**",
56
- "LICENSES/**",
57
- ".reuse/**"
48
+ "LICENSES/**"
58
49
  ],
59
50
  "ava": {
60
51
  "files": [
@@ -73,11 +64,8 @@
73
64
  ],
74
65
  "exclude": [
75
66
  "docs/**",
76
- "jsdocs/**",
77
67
  "coverage/**",
78
- "test/**",
79
- ".eslintrc.cjs",
80
- "jsdoc-plugin.cjs"
68
+ "test/**"
81
69
  ],
82
70
  "check-coverage": true,
83
71
  "statements": 90,
@@ -107,30 +95,23 @@
107
95
  },
108
96
  "repository": {
109
97
  "type": "git",
110
- "url": "git@github.com:SAP/ui5-logger.git"
98
+ "url": "git@github.com:UI5/cli.git",
99
+ "directory": "packages/logger"
111
100
  },
112
101
  "dependencies": {
113
- "chalk": "^5.3.0",
102
+ "chalk": "^5.6.2",
114
103
  "cli-progress": "^3.12.0",
115
104
  "figures": "^6.1.0"
116
105
  },
117
106
  "devDependencies": {
118
- "@istanbuljs/esm-loader-hook": "^0.2.0",
119
- "ava": "^6.1.3",
120
- "chokidar-cli": "^3.0.0",
121
- "cross-env": "^7.0.3",
107
+ "@istanbuljs/esm-loader-hook": "^0.3.0",
108
+ "ava": "^6.4.1",
109
+ "cross-env": "^10.0.0",
122
110
  "depcheck": "^1.4.7",
123
- "docdash": "^2.0.2",
124
- "eslint": "^8.57.0",
125
- "eslint-config-google": "^0.14.0",
126
- "eslint-plugin-ava": "^14.0.0",
127
- "eslint-plugin-jsdoc": "^48.8.3",
128
- "jsdoc": "^4.0.3",
129
- "nyc": "^17.0.0",
130
- "open-cli": "^8.0.0",
111
+ "eslint": "^9.36.0",
112
+ "nyc": "^17.1.0",
131
113
  "rimraf": "^6.0.1",
132
- "sinon": "^18.0.0",
133
- "strip-ansi": "^7.1.0",
134
- "tap-xunit": "^2.4.1"
114
+ "sinon": "^21.0.0",
115
+ "strip-ansi": "^7.1.2"
135
116
  }
136
117
  }
package/.reuse/dep5 DELETED
@@ -1,29 +0,0 @@
1
- Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
2
- Upstream-Name: ui5-logger
3
- Upstream-Contact: SAP OpenUI5 <openui5@sap.com>
4
- Source: https://github.com/SAP/ui5-logger
5
- Disclaimer: The code in this project may include calls to APIs (“API Calls”) of
6
- SAP or third-party products or services developed outside of this project
7
- (“External Products”).
8
- “APIs” means application programming interfaces, as well as their respective
9
- specifications and implementing code that allows software to communicate with
10
- other software.
11
- API Calls to External Products are not licensed under the open source license
12
- that governs this project. The use of such API Calls and related External
13
- Products are subject to applicable additional agreements with the relevant
14
- provider of the External Products. In no event shall the open source license
15
- that governs this project grant any rights in or to any External Products,or
16
- alter, expand or supersede any terms of the applicable additional agreements.
17
- If you have a valid license agreement with SAP for the use of a particular SAP
18
- External Product, then you may make use of any API Calls included in this
19
- project’s code for that SAP External Product, subject to the terms of such
20
- license agreement. If you do not have a valid license agreement for the use of
21
- a particular SAP External Product, then you may only make use of any API Calls
22
- in this project for that SAP External Product for your internal, non-productive
23
- and non-commercial test and evaluation of such API Calls. Nothing herein grants
24
- you any rights to use or access any SAP External Product, or provide any third
25
- parties the right to use of access any SAP External Product, through API Calls.
26
-
27
- Files: *
28
- Copyright: 2018-2024 SAP SE or an SAP affiliate company and UI5 Tooling contributors
29
- License: Apache-2.0
package/CONTRIBUTING.md DELETED
@@ -1,3 +0,0 @@
1
- # Contributing to the UI5 Tooling
2
-
3
- See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md) repository.
package/jsdoc.json DELETED
@@ -1,61 +0,0 @@
1
- {
2
- "tags": {
3
- "allowUnknownTags": false
4
- },
5
- "source": {
6
- "include": ["README.md"],
7
- "includePattern": ".+\\.js$",
8
- "excludePattern": "(node_modules(\\\\|/))"
9
- },
10
- "plugins": [
11
- "jsdoc-plugin.cjs"
12
- ],
13
- "opts": {
14
- "encoding": "utf8",
15
- "destination": "jsdocs/",
16
- "recurse": true,
17
- "verbose": true,
18
- "access": "public"
19
- },
20
- "templates": {
21
- "cleverLinks": false,
22
- "monospaceLinks": false,
23
- "default": {
24
- "useLongnameInNav": true
25
- }
26
- },
27
- "openGraph": {
28
- "title": "UI5 Tooling - API Reference",
29
- "type": "website",
30
- "image": "https://sap.github.io/ui5-tooling/v4/images/UI5_logo_wide.png",
31
- "site_name": "UI5 Tooling - API Reference",
32
- "url": "https://sap.github.io/ui5-tooling/"
33
- },
34
- "docdash": {
35
- "sectionOrder": [
36
- "Modules",
37
- "Namespaces",
38
- "Classes",
39
- "Externals",
40
- "Events",
41
- "Mixins",
42
- "Tutorials",
43
- "Interfaces"
44
- ],
45
- "meta": {
46
- "title": "UI5 Tooling - API Reference - UI5 Logger",
47
- "description": "UI5 Tooling - API Reference - UI5 Logger",
48
- "keyword": "openui5 sapui5 ui5 build development tool api reference"
49
- },
50
- "search": true,
51
- "wrap": true,
52
- "menu": {
53
- "GitHub": {
54
- "href": "https://github.com/SAP/ui5-logger",
55
- "target": "_blank",
56
- "class": "menu-item",
57
- "id": "github_link"
58
- }
59
- }
60
- }
61
- }