@ui5/logger 4.0.2 → 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 +13 -1
- package/README.md +3 -4
- package/lib/loggers/ProjectBuild.js +18 -0
- package/lib/writers/Console.js +87 -1
- package/package.json +12 -33
- package/CONTRIBUTING.md +0 -3
- package/jsdoc.json +0 -61
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,19 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
|
|
|
4
4
|
|
|
5
5
|
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-logger/compare/v4.0.2...HEAD).
|
|
6
6
|
|
|
7
|
-
<a name="
|
|
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
|
+
|
|
8
20
|
## [v4.0.2] - 2025-09-11
|
|
9
21
|
### Bug Fixes
|
|
10
22
|
- Rename project to UI5 CLI [`18d935a`](https://github.com/SAP/ui5-logger/commit/18d935a7caf7d53312b4f3976b0075aeae608902)
|
package/README.md
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|

|
|
2
2
|
|
|
3
|
-
# ui5
|
|
3
|
+
# @ui5/logger
|
|
4
4
|
> Providing logging functionality for all UI5 CLI modules and extensions.
|
|
5
5
|
> Features log levels and rendering of a progress bar.
|
|
6
6
|
> Part of [UI5 CLI](https://github.com/UI5/cli)
|
|
7
7
|
|
|
8
|
-
[](https://dev.azure.com/sap/opensource/_build/latest?definitionId=37&branchName=main)
|
|
8
|
+
[](https://api.reuse.software/info/github.com/UI5/cli)
|
|
10
9
|
[](https://www.npmjs.com/package/@ui5/logger)
|
|
11
10
|
[](https://coveralls.io/github/SAP/ui5-logger)
|
|
12
11
|
|
|
13
12
|
## Documentation
|
|
14
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://ui5.github.io/cli/
|
|
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
18
|
Please check our [Contribution Guidelines](https://github.com/UI5/cli/blob/main/CONTRIBUTING.md).
|
|
@@ -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;
|
package/lib/writers/Console.js
CHANGED
|
@@ -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,7 +204,9 @@ class Console {
|
|
|
137
204
|
}
|
|
138
205
|
|
|
139
206
|
#handleLogEvent({level, message, moduleName}) {
|
|
140
|
-
this.#
|
|
207
|
+
if (this.#filterModule(moduleName)) {
|
|
208
|
+
this.#writeMessage(level, `${chalk.blue(moduleName)} ${message}`);
|
|
209
|
+
}
|
|
141
210
|
}
|
|
142
211
|
|
|
143
212
|
#handleBuildMetadataEvent({projectsToBuild}) {
|
|
@@ -328,6 +397,23 @@ class Console {
|
|
|
328
397
|
taskMetadata.executionEnded = true;
|
|
329
398
|
message = `${chalk.green(figures.tick)} Finished task ${chalk.bold(taskName)}`;
|
|
330
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
|
+
|
|
331
417
|
// Update progress bar (if used)
|
|
332
418
|
this._getProgressBar()?.increment(1);
|
|
333
419
|
break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/logger",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.0",
|
|
4
4
|
"description": "UI5 CLI - Internal Logger",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "SAP SE",
|
|
@@ -25,36 +25,27 @@
|
|
|
25
25
|
"./internal/loggers/*": "./lib/loggers/*.js"
|
|
26
26
|
},
|
|
27
27
|
"engines": {
|
|
28
|
-
"node": "^20.
|
|
28
|
+
"node": "^22.20.0 || >=24.0.0",
|
|
29
29
|
"npm": ">= 8"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"test": "npm run lint && npm run
|
|
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
|
|
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,32 +95,23 @@
|
|
|
107
95
|
},
|
|
108
96
|
"repository": {
|
|
109
97
|
"type": "git",
|
|
110
|
-
"url": "git@github.com:
|
|
98
|
+
"url": "git@github.com:UI5/cli.git",
|
|
99
|
+
"directory": "packages/logger"
|
|
111
100
|
},
|
|
112
101
|
"dependencies": {
|
|
113
|
-
"chalk": "^5.6.
|
|
102
|
+
"chalk": "^5.6.2",
|
|
114
103
|
"cli-progress": "^3.12.0",
|
|
115
104
|
"figures": "^6.1.0"
|
|
116
105
|
},
|
|
117
106
|
"devDependencies": {
|
|
118
|
-
"@eslint/js": "^9.8.0",
|
|
119
107
|
"@istanbuljs/esm-loader-hook": "^0.3.0",
|
|
120
108
|
"ava": "^6.4.1",
|
|
121
|
-
"
|
|
122
|
-
"cross-env": "^7.0.3",
|
|
109
|
+
"cross-env": "^10.0.0",
|
|
123
110
|
"depcheck": "^1.4.7",
|
|
124
|
-
"
|
|
125
|
-
"eslint": "^9.35.0",
|
|
126
|
-
"eslint-config-google": "^0.14.0",
|
|
127
|
-
"eslint-plugin-ava": "^15.1.0",
|
|
128
|
-
"eslint-plugin-jsdoc": "^52.0.4",
|
|
129
|
-
"globals": "^16.3.0",
|
|
130
|
-
"jsdoc": "^4.0.4",
|
|
111
|
+
"eslint": "^9.36.0",
|
|
131
112
|
"nyc": "^17.1.0",
|
|
132
|
-
"open-cli": "^8.0.0",
|
|
133
113
|
"rimraf": "^6.0.1",
|
|
134
114
|
"sinon": "^21.0.0",
|
|
135
|
-
"strip-ansi": "^7.1.
|
|
136
|
-
"tap-xunit": "^2.4.1"
|
|
115
|
+
"strip-ansi": "^7.1.2"
|
|
137
116
|
}
|
|
138
117
|
}
|
package/CONTRIBUTING.md
DELETED
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 CLI - API Reference",
|
|
29
|
-
"type": "website",
|
|
30
|
-
"image": "https://ui5.github.io/cli/v4/images/UI5_logo_wide.png",
|
|
31
|
-
"site_name": "UI5 CLI - API Reference",
|
|
32
|
-
"url": "https://ui5.github.io/cli/"
|
|
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 CLI - API Reference - UI5 Logger",
|
|
47
|
-
"description": "UI5 CLI - 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
|
-
}
|