[ ] Tests for the changes have been added (for bug fixes / features)
[ ] Docs have been added / updated (for bug fixes / features)
PR Type
What kind of change does this PR introduce?
[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:
What is the current behavior?
when running nest generate controller when our app.module.ts has any decorator factory before @Module(), the wrong decorator is being changed
import { Injectable, Module, Scope } from '@nestjs/common'
@Injectable({}) // BUG: this will receive the `controllers` prop after nest generate
class Service {}
@Module({
imports: [],
providers: [Service],
controllers: [],
})
export class
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
when running
nest generate controller
when ourapp.module.ts
has any decorator factory before@Module()
, the wrong decorator is being changeddemo-issue-nestjs-cli.webm
What is the new behavior?
.module.ts
files but only the first@Module({})
occurrence will be update (if found)@Module()
decorator look up to use a find-first approach instead of find-manynote that we still don't support import aliases such as
import { Module as M } from "@nestjs/core"
Does this PR introduce a breaking change?