Skip to content

Commit

Permalink
Add ability to rsync artifacts to a remote machine
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jelly authored and martinpitt committed Jan 4, 2022
1 parent ba3913c commit 9662fb2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test/common:
# checkout Cockpit's PF/React/build library; again this has no API stability guarantee, so check out a stable tag
$(LIB_TEST):
flock Makefile sh -ec '\
git fetch --depth=1 https://github.com/cockpit-project/cockpit.git 253; \
git fetch --depth=1 https://github.com/cockpit-project/cockpit.git e224a0296cd25a448d70810a4c114bac574b82dd; \
git checkout --force FETCH_HEAD -- pkg/lib; \
git reset -- pkg/lib'
mv pkg/lib src/ && rmdir -p pkg
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ or

$ make watch

When developing against a virtual machine, webpack can also automatically upload
the code changes by setting the `RSYNC` environment variable to
the remote hostname.

$ RSYNC=c make watch

# Running eslint

Cockpit Starter Kit uses [ESLint](https://eslint.org/) to automatically check
Expand Down
6 changes: 6 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require("fs");
const path = require("path");

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

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

// Obtain package name from package.json
const packageJson = JSON.parse(fs.readFileSync('package.json'));

// Non-JS files which are copied verbatim to dist/
const copy_files = [
"./src/index.html",
Expand All @@ -22,6 +27,7 @@ const plugins = [
new extract({filename: "[name].css"}),
new ESLintPlugin({ extensions: ["js", "jsx"] }),
new CockpitPoPlugin(),
new CockpitRsyncPlugin({dest: packageJson.name}),
];

/* Only minimize when in production mode */
Expand Down

0 comments on commit 9662fb2

Please sign in to comment.