Skip to content

Mark @sap/cds-dk peer dependency as optional #155

Open

Description

@bkohenkel

@cap-js/notifications@1.1.1 declares @sap/cds-dk as a required peer dependency:

"peerDependencies": {
  "@sap/cds": ">=8.0",
  "@sap/cds-dk": ">=8.0"
}

With npm 7+, this installs @sap/cds-dk and its complete dependency tree into the production dependency graph of every consuming application.

However, @sap/cds-dk appears to be needed only for the CAP build integration:

cds.build?.register?.("notifications", require("./lib/build"))

lib/build.js extends cds.build.Plugin, and it is only loaded when the build API is available. Neither the runtime services under srv/ nor the notification delivery code import @sap/cds-dk directly.

This makes @sap/cds-dk a build-tool prerequisite rather than a runtime dependency of applications that use the notification service.

Impact

In our CAP application, the automatically installed @sap/cds-dk@8.9.19 dependency tree brings in packages that our production security scanner reports, including vulnerable versions of handlebars, @sap/cds-mtxs, proxy-addr, axios, ws and qs.

cds-dk releases use either an npm-shrinkwrap.json (8.x, 9.x) or bundled dependencies (10.x), so consuming applications cannot reliably fix these transitive findings with npm overrides.

A possible workaround we found is:

legacy-peer-deps=true

This stops the peer from being installed, but it changes peer dependency resolution for the entire project.

Proposal

Mark the peer dependency as optional:

"peerDependenciesMeta": {
  "@sap/cds-dk": {
    "optional": true
  }
}

Applications that use the build plugin would then provide @sap/cds-dk explicitly, for example as a devDependency, through a controlled CI build image, or with an explicitly versioned npx / npm exec command.

Runtime-only installations would no longer pull in the complete cds-dk build-tool dependency tree automatically.

The build integration keeps working whenever cds-dk is available, and cds-dk no longer ends up in the production dependency graph by default.

Activity

  1. github-actions commented on Oct 14, 2026

    @github-actions

    👋 Hello @bkohenkel, thank you for submitting this issue. Our team is reviewing your report and will follow up with you as soon as possible.

  2. daogrady commented on Oct 15, 2026

    @daogrady

    Hi @bkohenkel ,

    thank you for reporting this issue. I believe this component is currently in the process of being handed over to a new team of maintainers. So processing tickets may be a bit slower for a while.

    Seeing that you already identified the underlying problem and also explicitly added a solution, would you consider contributing a PR?
    (PRs are highly welcome and encouraged on all our open source components!)

    Best,
    Daniel

  3. bkohenkel commented on Oct 15, 2026

    @bkohenkel
    Author

    Hi @daogrady ,

    yes, I'd be happy to contribute a PR. I'll mark @sap/cds-dk as an optional peer dependency while keeping the existing version constraint. The runtime plugin already guards build registration through cds.build?.register?.(...), so this prevents npm from auto-installing cds-dk without affecting projects that use it for cds build.

    Best,
    Branimir

  4. daogrady commented on Oct 15, 2026

    @daogrady

    Hi Branimir,

    that reads like a sound decision. I'll leave this open for a possible maintainer to check. Should nobody react to your PR in due time, please give me another ping and I'll make sure it gets reviewed asap.

    Best,
    Daniel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions