Replies: 1 comment 10 replies
-
Do you get an error you can show? Can you provide access to your code? |
Beta Was this translation helpful? Give feedback.
10 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Someone on stackoverflow advised me to ask this here, so, here we go:
I have five modules:
AppModule
FirstModule
SecondModule
SourceModule1
SourceModule2
And one extra for
nest-commander
:CommanderModule
, which has the following files:Job.command.ts (with the @command() decorator and implements CommandRunner interface)
CommanderService (Just a service layer that
Job.command
would call because of some other concerns)Commander.ts (With my bootstrap method, which is the one I call using my command)
And to call my command, I'm using:
npx ts-node src/<path> argument --option abc
All modules have a service, and every module is imported on
AppModule
.FirstModule
is importingSourceModule1
andSourceModule2
and using them on it's service, the same goes forSecondModule
, they both useSourceModule
1 and 2 to meet their needs.My
CommanderModule
needsFirstModule
because ofCommanderService
... When a specific command is ran,FirstModule's service
shall be called byCommandModule's service
.The thing is, whenever I try using
FirstModule
on myCommanderService
soJob.command
may call aCommanderService
method and that method may callFirstModule's service
, my command doesn't reach it's "run" method, if I comment outFirstModule's service
, it works.I know
nest-commander
uses@Command()
as a way of dealing with, among some other things, dependency injection, but shouldn't I be able to use aCommanderService
besides theJob.command?
Beta Was this translation helpful? Give feedback.
All reactions