Organizing the scripts directory with subfolders

Is it possible to use yarn rw exec to execute scripts in subfolders within the scripts directory?

I have several scripts that are called from cronjobs. I’d like to create a directory scripts/jobs for those scripts, to separate them from my data import scripts.

But if I call, e.g., yarn rw exec jobs/updateActualRuns, I get an error:

No script called jobs/updateActualRuns in ./scripts folder.

Is this something Redwood supports, or could support in the future?

This is conceptually the same use-case as @rob for one of his projects. I don’t know about the directory structure, though.

This would be a very simple contribution to the exec command, effectively adding the ability to take a path. Would you be interested/available in helping?

Note: it should be confirmed that api build is compatible with nested directories… I’d assume so but we should check.

Hi @asher-eastham , thanks for reaching out! I am working with @dom / @thedavid to see about this.

It seems that this capability might already work for some projects, I’ve asked for some clarification around how it’s being used.

In the meantime, will you please share the output from:
yarn rw info ?

I think this might be fixed already in v5! I just upgraded, and now I’m able to run the script.

This is my yarn rw info:

System:
OS: macOS 13.3.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.18.0 - /private/var/folders/_j/cprt60vd42ng14d777d0qmsr0000gn/T/xfs-6a8a8b44/node
Yarn: 3.2.3 - /private/var/folders/_j/cprt60vd42ng14d777d0qmsr0000gn/T/xfs-6a8a8b44/yarn
Databases:
SQLite: 3.39.5 - /usr/bin/sqlite3
Browsers:
Chrome: 112.0.5615.137
Edge: 113.0.1774.35
Firefox: 112.0.2
Safari: 16.4
npmPackages:
@redwoodjs/auth-clerk-setup: 5.0.6 => 5.0.6
@redwoodjs/core: 5.0.6 => 5.0.6

3 Likes

Thanks! glad to hear it’s working for you.