From 533f719ccad36adb688840ae94540d038d5d2eb9 Mon Sep 17 00:00:00 2001 From: Bill Church Date: Wed, 10 Jul 2024 13:09:24 +0000 Subject: [PATCH] chore: dev build testing --- app/client/public/client.htm | 49 ++++++++++++++----------- app/client/public/webssh2.css | 1 + app/client/src/client.htm | 48 ++++++++++++++----------- app/package.json | 4 ++- app/scripts/webpack.common.js | 68 +++++++++++++++++++++-------------- 5 files changed, 103 insertions(+), 67 deletions(-) diff --git a/app/client/public/client.htm b/app/client/public/client.htm index 9558557..0312668 100644 --- a/app/client/public/client.htm +++ b/app/client/public/client.htm @@ -1,25 +1,34 @@ + - - WebSSH2 - - - - -
- -
-
- - - + + diff --git a/app/client/public/webssh2.css b/app/client/public/webssh2.css index 501cae0..1edb591 100644 --- a/app/client/public/webssh2.css +++ b/app/client/public/webssh2.css @@ -1,3 +1,4 @@ +/*! Version 0.2.12 - 2024-07-10T13:04:57.892Z */ /** * Copyright (c) 2014 The xterm.js authors. All rights reserved. * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) diff --git a/app/client/src/client.htm b/app/client/src/client.htm index 9558557..1499b93 100644 --- a/app/client/src/client.htm +++ b/app/client/src/client.htm @@ -1,25 +1,33 @@ + - - WebSSH2 - - - - -
- -
-
- - - + diff --git a/app/package.json b/app/package.json index 7166c65..706704f 100644 --- a/app/package.json +++ b/app/package.json @@ -74,6 +74,7 @@ "css-loader": "^2.1.0", "extract-text-webpack-plugin": "^4.0.0-beta.0", "file-loader": "^3.0.1", + "html-webpack-plugin": "^3.2.0", "nodaemon": "0.0.5", "postcss-discard-comments": "^4.0.1", "snazzy": "^8.0.0", @@ -85,6 +86,7 @@ "webpack-cli": "^3.2.1", "webpack-merge": "^4.2.1", "webpack-stream": "^5.2.1", - "xterm": "^3.10.1" + "xterm": "^3.10.1", + "zip-webpack-plugin": "^4.0.1" } } diff --git a/app/scripts/webpack.common.js b/app/scripts/webpack.common.js index 49ed24c..c9dd2cd 100644 --- a/app/scripts/webpack.common.js +++ b/app/scripts/webpack.common.js @@ -1,41 +1,57 @@ -const webpack = require('webpack') -const path = require('path') -const CleanWebpackPlugin = require('clean-webpack-plugin') -const CopyWebpackPlugin = require('copy-webpack-plugin') -const ExtractTextPlugin = require('extract-text-webpack-plugin') +const webpack = require("webpack"); +const { BannerPlugin } = require("webpack"); +const HtmlWebpackPlugin = require("html-webpack-plugin"); +const path = require("path"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); +const CleanWebpackPlugin = require("clean-webpack-plugin"); +const ExtractTextPlugin = require("extract-text-webpack-plugin"); +const packageJson = require("../package.json"); // Load package.json +const commitHash = require("child_process") + .execSync("git rev-parse --short HEAD") + .toString() + .trim(); + module.exports = { - context: path.resolve('__dirname', '../'), + context: path.resolve(__dirname, "../"), entry: { - webssh2: './client/src/js/index.js' + webssh2: "./client/src/js/index.js", }, plugins: [ - new CleanWebpackPlugin(['client/public'], { - root: path.resolve('__dirname', '../'), - verbose: true + new BannerPlugin({ + banner: `Version ${packageJson.version} - ${new Date().toISOString()}`, + include: /\.(js|css|html|htm)$/, + }), + new CleanWebpackPlugin(["client/public"], { + root: path.resolve("__dirname", "../"), + verbose: true, + }), + new HtmlWebpackPlugin({ + template: "./client/src/client.htm", // Path to your source template + filename: "client.htm", // Optional: output file name, defaults to index.html + minify: false, + scriptLoading: "blocking", + version: `Version ${ + packageJson.version + } - ${new Date().toISOString()} - ${commitHash}`, }), new CopyWebpackPlugin([ - './client/src/client.htm', - './client/src/favicon.ico' + { from: "./client/src/favicon.ico", to: "favicon.ico" }, ]), - new ExtractTextPlugin('[name].css') + new ExtractTextPlugin("[name].css"), ], output: { - filename: '[name].bundle.js', - path: path.resolve(__dirname, '../client/public') + filename: "[name].bundle.js", + path: path.resolve(__dirname, "../client/public"), }, module: { rules: [ { test: /\.css$/, use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { - loader: 'css-loader' - } - ] - }) - } - ] - } -} + fallback: "style-loader", + use: [{ loader: "css-loader" }], + }), + }, + ], + }, +};