| 9 | } |
| 10 | |
| 11 | export class MutationGenerator extends Generator<MutationGeneratorOptions> { |
| 12 | sourceRoot: SourceRootType |
| 13 | isAppDir = false |
| 14 | constructor(options: MutationGeneratorOptions) { |
| 15 | super(options) |
| 16 | this.sourceRoot = getTemplateRoot(options.templateDir, {type: "template", path: "mutation"}) |
| 17 | this.isAppDir = fs.existsSync(require("path").join(process.cwd(), "src/app/layout.tsx")) |
| 18 | } |
| 19 | static subdirectory = "mutation" |
| 20 | |
| 21 | // eslint-disable-next-line require-await |
| 22 | async getTemplateValues() { |
| 23 | return { |
| 24 | name: this.options.name, |
| 25 | Name: this.options.Name, |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | getTargetDirectory() { |
| 30 | const context = this.options.context ? `${camelCaseToKebabCase(this.options.context)}` : "" |
| 31 | if (this.isAppDir) { |
| 32 | return `src/app/${context}/mutations` |
| 33 | } |
| 34 | return `src/${context}/mutations` |
| 35 | } |
| 36 | } |
nothing calls this directly
no outgoing calls
no test coverage detected