Skip to content

Commit 9662fb2

Browse files
jellymartinpitt
authored andcommitted
Add ability to rsync artifacts to a remote machine
Use the CockpitRsyncWebpack plugin to optionally rsync build code to a remote machine, the destination is determined by looking at the package.json's name field.
1 parent ba3913c commit 9662fb2

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ test/common:
158158
# checkout Cockpit's PF/React/build library; again this has no API stability guarantee, so check out a stable tag
159159
$(LIB_TEST):
160160
flock Makefile sh -ec '\
161-
git fetch --depth=1 https://github.com/cockpit-project/cockpit.git 253; \
161+
git fetch --depth=1 https://github.com/cockpit-project/cockpit.git e224a0296cd25a448d70810a4c114bac574b82dd; \
162162
git checkout --force FETCH_HEAD -- pkg/lib; \
163163
git reset -- pkg/lib'
164164
mv pkg/lib src/ && rmdir -p pkg

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ or
4343

4444
$ make watch
4545

46+
When developing against a virtual machine, webpack can also automatically upload
47+
the code changes by setting the `RSYNC` environment variable to
48+
the remote hostname.
49+
50+
$ RSYNC=c make watch
51+
4652
# Running eslint
4753

4854
Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check

webpack.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const fs = require("fs");
12
const path = require("path");
23

34
const copy = require("copy-webpack-plugin");
@@ -7,10 +8,14 @@ const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
78
const CompressionPlugin = require("compression-webpack-plugin");
89
const ESLintPlugin = require('eslint-webpack-plugin');
910
const CockpitPoPlugin = require("./src/lib/cockpit-po-plugin");
11+
const CockpitRsyncPlugin = require("./src/lib/cockpit-rsync-plugin");
1012

1113
/* A standard nodejs and webpack pattern */
1214
const production = process.env.NODE_ENV === 'production';
1315

16+
// Obtain package name from package.json
17+
const packageJson = JSON.parse(fs.readFileSync('package.json'));
18+
1419
// Non-JS files which are copied verbatim to dist/
1520
const copy_files = [
1621
"./src/index.html",
@@ -22,6 +27,7 @@ const plugins = [
2227
new extract({filename: "[name].css"}),
2328
new ESLintPlugin({ extensions: ["js", "jsx"] }),
2429
new CockpitPoPlugin(),
30+
new CockpitRsyncPlugin({dest: packageJson.name}),
2531
];
2632

2733
/* Only minimize when in production mode */

0 commit comments

Comments
 (0)