I’m developing a ColdBox module and running a server from a “test-harness” sub folder inside of the module root. I’d like to watch the module root for changes and then reinit the framework inside the test-harness. Is this possible?
I tried the following in Commandbox, but it doesn’t appear to be working: coldbox watch-reinit ../**.cfc
Perhaps there’s a better pattern I can use instead of ../**?
Folder structure for reference:
/ <-- module root - would like to watch for changes
/test-harness/ <-- web root for tests while developing
The coldbox watch-reinit command (which was contribution from someone) doesn’t look like it was setup to resolve paths, which is what handles things like ../. I don’t think that’s right however, so if you can put in a ticket, we should fix it for the next version of CommandBox.
Hrmph, it’s a little more complicated than I was hoping to add support for that. The mode the file globber is being used in is the same as when you process ignores like a .gitignore file. So it has
no absolute paths (everything is “rooted” in the current directory)
no way to “back up” out of the root.
In the gitignore style mode, any glob pattern starting with / is not the drive root, but the current directory root
/logs
and any glob pattern not starting with a slash like
tmp
is really interpreted as
**/tmp
matching a path of that name at any level deep inside the root.
In that context, having a ../ doesn’t really work because it instantly becomes **../ inside the globber which makes no sense. And a path like foo/*bar/**/baz/../bum.txt would break even more globbing rules.
What would actually be easier would be to just add a directory param to the command to set the root path of the globber. This is actually what the generic watch command does.
This is awesome Brad! I am excited to test it out.
I’m having some difficulty with the alpha build on my Windows 10 machine compared with the stable build.
When I start up box.exe in Windows CMD, I get a yellow notification that says:
*The module (commandbox-cbplaywrighttmp) cannot be loaded as it does not have a ModuleConfig.cfc in its root. Path Checked: C:\Users\Henweigh\.CommandBox\cfml\modules/commandbox-cbplaywrighttmp*
The above warning was present in the last stable version of Commandbox too, but didn’t impact my day-to-day operation and cbplaywright worked flawlessly, so I ignored the warning. However, with the new alpha build, there’s about a 30-40 second pause and then I also see a red notification that says:
Module [commandbox-cbplaywright] failed to load! Check the logs for more info ( system-log | open ).
> Error finding latest version of com.microsoft.playwright:driver-bundle
> C:\Users\Henweigh\.CommandBox\cfml\modules\commandbox-cbplaywright\models\DriverService.cfc:29
I should point out I had to manually update the cbplaywright driver in the past because the playwright driver from commandbox-cbplaywright is ahead of cbplaywright and cbplaywright expects a specific version (Incompatible driver version 1.25.0 · Issue #1 · coldbox-modules/cbPlaywright · GitHub). Manually removing the commandbox-cbplaywrighttmp folder broke playwright functionality and I had to re-update the playwright drivers again.
The good news:
Commandbox eventually loads, and I added the following to my box.json: package set reinitWatchDirectory=../
Then I start the server and execute coldbox watch-reinit. Everything works as expected!
The playwright issues are totally unrelated. I assume the first error is because files are missing on disk. The delay is probably due to some sort of playwright behavior that downloads stuff. I would consult @elpete in another thread with your playwright questions.