gro
gro copied to clipboard
enable running tasks from outside `src/lib`
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:
-
src/lib/
(currently the only pattern that's supported) -
src/
-
./
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:
-
src/lib/
(currently the only pattern that's supported) -
./
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?)