gro icon indicating copy to clipboard operation
gro copied to clipboard

enable running tasks from outside `src/lib`

Open ryanatkn opened this issue 1 year ago • 0 comments

This has been a long time coming. Gro's build system is long gone, and it now uses a Node loader for TypeScript and Svelte, so it should be fairly easy to support running tasks from locations other than $lib/.

I don't love non-explicit module resolution, but it seems like the obviously ergonomic choice for running tasks, so Gro will continue to look in $lib/ first. I'm thinking resolution order should be:

  1. src/lib/ (currently the only pattern that's supported)
  2. src/
  3. ./

So if you have a task in another source directly like src/routes, you could run gro routes/foo. This way $lib/ sourcing remains convenient, but it's straightforward from there, no magic sourcing into routes, just into src/ and then the cwd.

I'm going to think through this alternative:

  1. src/lib/ (currently the only pattern that's supported)
  2. ./

things to look into

  • use the SvelteKit config for any differently configured src/lib/ path, probably
  • maybe allow configurable resolution, maybe not though
  • overlapping code paths with gen module resolution (maybe simplify the abstraction here, might be overly DRY, seems unnecessarily hard to reason about)
  • maybe remove the "task directories" convenience (looks like the code is still there, but I think I removed it from the docs?)

ryanatkn avatar Feb 22 '24 23:02 ryanatkn