Skip to content

Commit

Permalink
[Misc] Update to CDS major version v8 (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap authored Aug 16, 2024
1 parent 20cf6c5 commit 9831992
Show file tree
Hide file tree
Showing 7 changed files with 403 additions and 1,713 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ The CAP Operator Plugin offers a simple method for generating [CAP Operator](htt

## Before You Start

The CAP Operator plugin requires `@sap/cds-dk: "~7.9.5"`. If you've installed @sap/cds-dk globally, ensure that the installed version is `7.9.5` or higher, but below `8`.

> `@sap/cds-dk: "~8"` is not supported yet.
The CAP Operator plugin requires `@sap/cds-dk: ">=8.1.0"`. If you've installed @sap/cds-dk globally, ensure that the installed version is `8.1.0` or higher.

## Set Up the Plugin

Expand Down
11 changes: 10 additions & 1 deletion lib/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: Apache-2.0
const cds = require('@sap/cds-dk');
const { exists, path } = cds.utils

module.exports = class CapOperatorBuildPlugin extends cds.build.BuildPlugin {
module.exports = class CapOperatorBuildPlugin extends cds.build.Plugin {
static hasTask() {
return exists('chart')
}
Expand All @@ -15,6 +15,15 @@ module.exports = class CapOperatorBuildPlugin extends cds.build.BuildPlugin {
src: '.', dest: 'chart'
}

init() {
if (this.task.src !== cds.root) {
throw new Error("Invalid value for property 'src', it must have value '.'")
}

// different from the default build output structure
this.task.dest = path.join(cds.root, cds.env.build.target !== '.' ? cds.env.build.target : 'gen', 'chart')
}

async copyTemplates() {
if (exists(path.join(this.task.src, 'chart/templates'))){
return await this.copy(path.join(this.task.src, 'chart/templates')).to(path.join(this.task.dest, 'templates'))
Expand Down
Loading

0 comments on commit 9831992

Please sign in to comment.