@sap/cds-dk
Version:
Command line client and development toolkit for the SAP Cloud Application Programming Model
61 lines (50 loc) • 1.66 kB
JavaScript
module.exports = class Plugin {
/**
* Provides command-line options for the plugin.
* @returns {Array.<{option: string, flag: string, shortcut?: string, help: string}>}
*/
options() {
return []
}
/**
* Gets the required templates.
* @returns {string[]} An array of strings representing required plugins.
* Returns an empty array by default.
* In general, avoid such dependencies if possible.
*/
requires() { return [] }
/**
* Determines whether a plugin can be run.
* @returns {Promise<boolean>} A promise that resolves to `true` if the template can be run.
*/
async canRun() { return true }
/**
* Gets a brief help text for the plugin.
* Displayed when all plugins are listed with `cds add`.
* @returns {string} The help text.
*/
static help() { return '' }
/**
* Determines if the plugin has already been added to the project.
* @param {import('@sap/cds').env} env - The env for the 'production' profile.
* @returns {boolean} - Returns `true` if the template has been added, otherwise `false`.
*/
static hasInProduction(env) { // eslint-disable-line no-unused-vars
return true
}
/**
* Runs the plugin.
*/
async run() { }
/**
* Runs the combine operations for interoperability with other plugins.
*/
async combine() { }
/* ––––––––––––
Yeoman Generator
–––––––––––– */
/**
* Runs the finalize operations.
*/
async finalize() { }
}