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.
This commit is contained in:
Jelle van der Waa 2022-01-04 13:20:03 +01:00 committed by Martin Pitt
parent ba3913caa0
commit 9662fb2ffc
3 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,4 @@
const fs = require("fs");
const path = require("path");
const copy = require("copy-webpack-plugin");
@ -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",
@ -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 */