-
Notifications
You must be signed in to change notification settings - Fork 183
Description
In #843, @karthikscale3 added an option to "limit the directories scanned for workflow directives". The docs continue to say "If your workflows are located in a specific directory, configure dirs to only scan that directory".
I tried it out (built the latest commit myself) and found that it doesn't do what I expected.
What it sounded like (to me): It searches all *.ts/*.js files in those directories for functions with use workflow or use step (direct discovery). This is my understanding of where my "workflows are located" and what should be "scanned for workflow directives". I tried to use src/workflows, but it didn't find anything.
How it works: It looks only for well-known filenames like page.tsx and route.ts and discovers the workflows referenced by those entrypoints (indirect discovery). Actually, the chain is: page file -> server action file -> workflow file -> step file. It seems to compile all of those, although it doesn't need the page nor the server action files.
Possible solution: If workflows.dirs is used, don't limit the input filenames to Next.js entrypoints and let devs specify the directories where they define, not start workflows. That's an even better optimiation from my point of view.