Skip to content

Commit

Permalink
rwt copy fix for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Jun 19, 2020
1 parent ff6945c commit 56a54f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ We offer two workflows for making this possible: "copy and watch", which has som
### Copy and Watch

> Are you on Windows? If so, you most likely first have to [install rsync](https://tlundberg.com/blog/2020-06-15/installing-rsync-on-windows/). Also, unfortunately you can't use "copy and watch". You'll have to manually run `yarn rwt cp ../path/to/redwood` when you've made changes to the Redwood Framework (this is tracked in [issue #701](https://github.com/redwoodjs/redwood/issues/701)).
First, build-and-watch files in the Redwood Framework for changes:

```terminal
Expand All @@ -52,7 +54,7 @@ create-redwood-app: $ nodemon --ignore dist --exec 'yarn build'
@redwoodjs/eslint-plugin-redwood: $ nodemon --ignore dist --exec 'yarn build'
```

Then, watch-and-copy those changes into your Redwood App or example app (here, [example-invoice](https://github.com/redwoodjs/example-invoice)):
Then, copy-and-watch those changes into your Redwood App or example app (here, [example-invoice](https://github.com/redwoodjs/example-invoice)):

```terminal
cd example-invoice
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/redwood-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ export const fixProjectBinaries = (PROJECT_PATH) => {

export const copyFiles = async (src, dest) => {
// TODO: Figure out if we need to only run based on certain events.

if (process.platform === 'win32') {
// rsync doesn't do Windows paths, so we need to change them to posix paths
const srcDrive = src[0].toLowerCase()
const destDrive = dest[0].toLowerCase()

src = `/${srcDrive}/${src.substring(3).replace(/\\/g, '/')}`
dest = `/${destDrive}/${dest.substring(3).replace(/\\/g, '/')}`
}

await execa('rsync', ['-rtvu --delete', `'${src}'`, `'${dest}'`], {
shell: true,
stdio: 'inherit',
Expand Down

0 comments on commit 56a54f1

Please sign in to comment.