redwood
redwood copied to clipboard
[Bug]: Can't use baremetal deploy from a Windows machine to a *nix machine
What's not working?
Baremetal uses path.join()
when building up the deploy path, but path.join()
is running on the deploy machine, not the host machine: https://github.com/redwoodjs/redwood/blob/main/packages/cli/src/commands/deploy/baremetal.js#L212
So if you're trying to deploy from Windows then it will create the path with backslashes, even though you may be deploying to a *nix machine which uses forward slashes.
How do we reproduce the bug?
Try to use Baremetal deploy from a Windows machine to a *nix machine:
Note that the path contains backslahes. :(
What's your environment? (If it applies)
No response
Are you interested in working on this?
- [ ] I'm interested in working on this
I can think of two possible solutions:
- Instead of using
path.join()
just hardcode forward slashes (or forcepath.join()
to use them, which would be my preference) and make it a requirement of Baremetal deploy that you can only deploy to *nix systems - Somehow detect the OS that you're deploying to and determine the slash direction on the fly. However, I'm not sure that this deployment would even work going to a Windows machine...is SSH even widely supported for connecting to Windows machines?
I'm leaning towards (1) since I don't know that (2) is even possible, or if anyone would ever need that anyway (do people serve Node apps from Windows machines??)
I lean toward the former as well, and a very good point about node apps being deployed to windows machines. Narrowing scope seems appropriate.
We have a third option! @pantheredeye suggested in Discord that we default to forward slashes always, but make a --windows
flag available that will override and use backslahes. So if you really want to deploy to a Windows machine you still can. It remains to be seen if you can actually serve the app from Windows, however. :)
I found a dedicated npm package just for converting paths to forward slashes always: https://www.npmjs.com/package/slash