UNPKG

@sap/cds-dk

Version:

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

48 lines (38 loc) 1.58 kB
const { join } = require('path') const cds = require('../../../cds') const { exists, copy } = cds.utils const { readProject } = require('../../projectReader') const { merge } = require('../../merge') const { URLS } = require('../../constants') module.exports = class PipelineTemplate extends require('../../plugin') { static help() { return 'CI/CD pipeline integration' } async canRun() { if (cds.cli.options.force) { return true; } if (exists('Jenkinsfile') || exists(join('.pipeline', 'config.yml'))) { throw `Pipeline support file exists. Use --force to overwrite.` } return true; } async run() { await copy(join(__dirname, 'files')).to(cds.root) const project = readProject() const { apps, appPath, hasUI5 } = project if (hasUI5) { // UI5 integration might be needed even without HTML5 repo for (const { app } of apps) { project.app = app await Promise.all([ merge(__dirname, 'files/app-package.json.hbs').into(join(appPath, app, 'package.json'), { project }), merge(__dirname, 'files/ui5.yaml.hbs').into(join(appPath, app, 'ui5.yaml'), { project }), merge(__dirname, 'files/ui5-deploy.yaml.hbs').into(join(appPath, app, 'ui5-deploy.yaml'), { project }) ]) } } } async finalize() { console.log(`for information on project "Piper" and its pipelines see ${URLS.PIPELINE_HELP}`); } }