From c04363281416effff0569199ce853ff405d6c74c Mon Sep 17 00:00:00 2001 From: sjvans <30337871+sjvans@users.noreply.github.com> Date: Mon, 3 Jun 2024 10:42:04 +0200 Subject: [PATCH] fix: detect build job started via `@sap/cds-dk/bin/cds.js` (#178) closes https://github.com/cap-js/telemetry/issues/177 --- CHANGELOG.md | 6 ++++++ lib/index.js | 2 +- package.json | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54a4094..f55e437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). The format is based on [Keep a Changelog](http://keepachangelog.com/). +## Version 0.2.2 - 2024-06-03 + +### Fixed + +- Detect build job started via `@sap/cds-dk/bin/cds.js` + ## Version 0.2.1 - 2024-05-23 ### Fixed diff --git a/lib/index.js b/lib/index.js index a44e370..a23076e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -10,7 +10,7 @@ module.exports = function () { // REVISIT: better // no need to fire up plugin during build (avoid credentials validation) const i = process.argv.indexOf('build') - if (i > 1 && process.argv[i - 1].endsWith('cds')) return + if (i > 1 && process.argv[i - 1].match(/cds(\.js)?$/)) return // set logger and propagate log level diag.setLogger(cds.log('telemetry'), process.env.OTEL_LOG_LEVEL || getDiagLogLevel()) diff --git a/package.json b/package.json index 729e1b1..74e4600 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cap-js/telemetry", - "version": "0.2.1", + "version": "0.2.2", "description": "CDS plugin providing observability features, incl. automatic OpenTelemetry instrumentation.", "repository": "cap-js/telemetry", "author": "SAP SE (https://www.sap.com)", @@ -26,7 +26,7 @@ "@opentelemetry/semantic-conventions": "^1.10.1" }, "peerDependencies": { - "@sap/cds": ">=7 || ^8.0.0-beta" + "@sap/cds": ">=7" }, "devDependencies": { "@cap-js/sqlite": "^1.4.0",