import Generator from "yeoman-generator"; export default class extends Generator { private props: Generator.Answers | undefined; async initializing() { this.props = { appName: "kyma-app", hostName: "kyma-app-host", eventType: "event-type", eventTypeVersion: "event-type-version", uri: "uri", sourceId: "sourceId", appPath: "appPath", displayName: "SAP CP - Events", }; } prompting() { const prompts = [ { name: "eventType", message: "event type?", type: "input", default: !this.props!.eventType, when: !this.options.eventType, }, { name: "eventTypeVersion", message: "event type version?", type: "input", default: !this.props!.eventTypeVersion, when: !this.options.eventTypeVersion, }, { name: "uri", message: "uri?", type: "input", default: !this.props!.uri, when: !this.options.uri, }, { name: "sourceId", message: "sourceId?", type: "input", default: this.props!.sourceId, when: !this.options.sourceId, }, { name: "appPath", message: "appPath?", type: "input", default: this.props!.appPath, when: !this.options.appPath, }, { name: "hostName", message: "hostName?", type: "input", default: this.props!.hostName, when: !this.options.hostName, }, { name: "displayName", message: "displayName?", type: "input", default: this.props!.displayName, when: !this.options.displayName, }, ]; return this.prompt(prompts).then((answers) => { this.props = Object.assign(this.options, answers); }); } writing() { // @ts-ignore console.log("kyma event generator properties to generate: ", this.props); this.fs.copyTpl( this.templatePath("k8s"), this.destinationPath(this.props!.appPath, "/k8s"), this.props ); } }