redwood icon indicating copy to clipboard operation
redwood copied to clipboard

Force file paths computed during Baremetal deploy to always have forward slashes

Open cannikin opened this issue 1 year ago • 5 comments

I ended up not adding the --windows flag for now because there are paths computed in several different places and I couldn't find an elegant way to give all of the surrounding functions access to the result of the flag. Let's go with this for now and if we get complaints about not being able to deploy to Windows then we can revisit.

Closes #6124

cannikin avatar Aug 04 '22 21:08 cannikin

☁️ Nx Cloud Report

CI is running/has finished running commands for commit db4b6822b0bde47c601897e16498e9744752d7c0. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 14 targets

Sent with 💌 from NxCloud.

nx-cloud[bot] avatar Aug 04 '22 21:08 nx-cloud[bot]

Deploy Preview for redwoodjs-docs canceled.

Name Link
Latest commit db4b6822b0bde47c601897e16498e9744752d7c0
Latest deploy log https://app.netlify.com/sites/redwoodjs-docs/deploys/62fbf75739041a000c871e61

netlify[bot] avatar Aug 04 '22 21:08 netlify[bot]

Turns out that slash package is ESM and it makes everything blow up. Just wrote a simple replace() instead.

cannikin avatar Aug 04 '22 22:08 cannikin

I'm planning on testing this out tonight! Thanks so much for getting a PR together so fast!!

russell-davis avatar Aug 04 '22 22:08 russell-davis

Bookmarking this here for your reference... I found this platform check: const join = process.platform === 'win32' ? path.win32.join : path.posix.join

That could be shortened to const join = path.posix.join to force forward slashes.

The code below that could be:

export const execaOptions = {
  cwd: join(getPaths().base),
  stdio: 'inherit',
  shell: true,
  cleanup: true,
}
...

await sshExec(ssh, deployPath, 'cp', [
         join('web', 'dist', '200.html'),
         join('web', 'dist', '200.html.orig'),
       ])

... etc.

pantheredeye avatar Aug 10 '22 19:08 pantheredeye

Great catch @pantheredeye , updated!

cannikin avatar Aug 16 '22 19:08 cannikin