jurassicjs/nuxt-scheduler

Why server/app ?

atinux opened this issue ยท 6 comments

Wondering why this particular path?

Why not using server/schedulers/[name].ts?

It was an instinctual decision because it fits well with how I structured Avantage. Seems tidy to me.

image

But now that you mention it, I can see it may be useful to use the current path as a default and allow overriding via runtimeConfig.

I don't think I would have more than one scheduler file though. It seems to me having one place for all scheduled tasks is a good thing for keeping things simple and easy to find. I've worked on large Laravel projects that still only use the one kernel file for scheduled tasks. But that's just an opinion, if enough people want multi-file support I'm not dead set against it. Especially if they write the code to implement it ๐Ÿ˜„

Then I would simply use server/plugins/scheduler.ts for this usecase since the plugins are auto-imported automatically and then expose the util for end user :)

Sounds reasonable to me. I'll implement it asap.

Implemented! ๐Ÿ™‚ See the latest version.

Thank you @atinux for the suggestion. It's definitely made this module better. I struggled to understand how simple your suggestion really was. I was overengineering the shit out of things late into the night. When I realized just how easy this was to implement, it made me love Nuxt even more. ๐Ÿš€

๐Ÿฅฐ

Nice refactoring!