build.js: Run rsync plugin also for $RSYNC env variable

starter-kit and derivatives don't understand the build.js `-r` option,
only the environment variable. So properly handle the latter, and update
the documentation to use the env variable, to get  a common workflow for
all our projects.

Also fix the destination path, the rsync plugin moved to
/usr/local/share/cockpit some time ago.
This commit is contained in:
Martin Pitt 2023-05-26 08:18:55 +02:00 committed by Martin Pitt
parent fafe29acf1
commit 0a51a881c3
2 changed files with 8 additions and 6 deletions

View File

@ -93,14 +93,14 @@ disable them, run it with `-e`/`--no-eslint` and/or `-s`/`--no-stylelint`.
Reload cockpit in your browser after page is built. Press `Ctrl`-`C` to
stop watch mode once you are done with changing the code.
You often need to test code changes in a VM. There is an `-r`/`--rsync`
option for copying the built page into the given SSH target's
/usr/share/cockpit/ directory. If you use Cockpit's own test VMs and set up the
You often need to test code changes in a VM. You can set the `$RSYNC` env
variable to copy the built page into the given SSH target's
/usr/local/share/cockpit/ directory. If you use Cockpit's own test VMs and set up the
SSH `c` alias as described in [test/README.md](./test/README.md), you can use
one of these commands:
./build.js -w -r c kdump
./build.js -w -r c
RSYNC=c ./build.js -w kdump
RSYNC=c ./build.js -w
To make Cockpit use system packages again, instead of your checkout directory,
remove the symlink with the following command and log back into Cockpit:

View File

@ -153,7 +153,9 @@ async function build() {
}
},
...args.rsync ? [cockpitRsyncEsbuildPlugin({ source: "dist/" + (args.onlydir || '') })] : [],
...(args.rsync || process.env.RSYNC)
? [cockpitRsyncEsbuildPlugin({ source: "dist/" + (args.onlydir || '') })]
: [],
];
if (useWasm) {