UNPKG

@sap/generator-cap-project

Version:

Creates a new SAP Cloud Application Programming Model project.

24 lines (23 loc) 795 B
import fs from 'fs/promises'; import { isBinary, renderFile } from '../util.js'; export default async function (from, to, context, tplSettings, options) { context = context || {}; tplSettings = tplSettings || {}; await this.copyAsync(from, to, { processDestinationPath: (path) => path.replace(/.ejs$/, ''), ...options, async processFile(filename) { if (isBinary(filename, null)) { return fs.readFile(filename); } return renderFile(filename, context, tplSettings); }, process: (contents, filename, destination) => this._processTpl({ contents, filename, destination, context, tplSettings, }), }, context, tplSettings); }