UNPKG

@sap/cds-dk

Version:

Command line client and development toolkit for the SAP Cloud Application Programming Model

41 lines (34 loc) 1.15 kB
const cds = require('../../../cds') const { exists } = cds.utils const { readProject } = require('../../projectReader') const { merge } = require('../../merge') const { MULTITENANCY } = require('../../constants').OPTIONS module.exports = class ExtensibilityTemplate extends require('../../plugin') { static help() { return 'tenant-specific model extensibility' } requires() { return exists('pom.xml') ? [MULTITENANCY] : [] // REVISIT: Remove this dependency } static hasInProduction(env) { return !!env.requires?.extensibility } async run() { const project = readProject() const { configFile } = project await merge(__dirname, 'files/package.json.hbs').into(configFile, { project }) } async combine() { const project = readProject() const { hasXsuaa } = project if (hasXsuaa) { await merge(__dirname, 'files', 'xs-security.json.hbs').into('xs-security.json', { project, additions: [ { in: 'scopes', where: { name: '$XSAPPNAME.cds.ExtensionDeveloper' }}, { in: 'role-templates', where: { name: 'ExtensionDeveloper' }} ] }) } } }