From 4fc0659151eb487d5d7dddfe84a5200385262c43 Mon Sep 17 00:00:00 2001 From: Marten Schiwek Date: Wed, 18 Sep 2024 14:13:19 +0200 Subject: [PATCH] Fix issue with build step --- cds-plugin.js | 6 ++---- lib/build.js | 6 +++--- package.json | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cds-plugin.js b/cds-plugin.js index 17f43a1..982289d 100644 --- a/cds-plugin.js +++ b/cds-plugin.js @@ -1,11 +1,9 @@ const cds = require("@sap/cds/lib"); +const NotificationsBuildPlugin = require("./lib/build"); if (cds.cli.command === "build") { // register build plugin - cds.build?.register?.('notifications', { - impl: '@cap-js/notifications/lib/build', - taskDefaults: { src: cds.env.folders.srv } - }); + cds.build?.register?.('notifications', NotificationsBuildPlugin); } else cds.once("served", async () => { diff --git a/lib/build.js b/lib/build.js index 7b3c960..ab1cd4c 100644 --- a/lib/build.js +++ b/lib/build.js @@ -1,10 +1,10 @@ const cds = require('@sap/cds') -const { BuildPlugin } = cds.build const { copy, exists, path } = cds.utils -module.exports = class NotificationsBuildPlugin extends BuildPlugin { - +module.exports = class NotificationsBuildPlugin extends cds.build.Plugin { + static taskDefaults = { src: cds.env.folders.srv } + static hasTask() { const notificationTypesFile = cds.env.requires?.notifications?.types; return notificationTypesFile === undefined ? false : exists(notificationTypesFile); diff --git a/package.json b/package.json index 8119b9e..e42d5c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cap-js/notifications", - "version": "0.2.1", + "version": "0.2.2", "description": "CDS plugin providing integration to the SAP BTP Alert Notification Service.", "repository": "cap-js/notifications", "author": "SAP SE (https://www.sap.com)",