From b7c7e79a86b86236e2e0235b6204490728baef04 Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Tue, 26 Jan 2021 11:42:20 +0100 Subject: [PATCH] Move distributed static/ folder to dist/web/ Move the target folder for the built web interface to dist/web/ instead of static/. This better follows the norm for npm packages to include built files in the dist/ folder and also allows putting other built files into that folder in the future. --- .eslintignore | 3 +-- .gitignore | 4 ---- packages/master/master.js | 6 +++--- packages/master/webpack.config.js | 4 ++-- plugins/global_chat/webpack.config.js | 2 +- plugins/research_sync/webpack.config.js | 2 +- plugins/statistics_exporter/webpack.config.js | 2 +- plugins/subspace_storage/webpack.config.js | 2 +- 8 files changed, 10 insertions(+), 15 deletions(-) diff --git a/.eslintignore b/.eslintignore index d3cfadef..849ddff3 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1 @@ -packages/master/static -plugins/*/static +dist/ diff --git a/.gitignore b/.gitignore index 08f2a543..d93623fb 100644 --- a/.gitignore +++ b/.gitignore @@ -46,10 +46,6 @@ static/export saves /temp/ -# Web build -/packages/master/static -/plugins/*/static - # IDE .idea/ .vs/ diff --git a/packages/master/master.js b/packages/master/master.js index dbc1ed1a..02e05286 100755 --- a/packages/master/master.js +++ b/packages/master/master.js @@ -115,7 +115,7 @@ function serveWeb(route) { } // Set folder to serve static content from (the website) -app.use(express.static(path.join(__dirname, "static"))); +app.use(express.static(path.join(__dirname, "dist", "web"))); app.use(express.static("static")); // Used for data export files const slaveMappingGauge = new libPrometheus.Gauge( @@ -2025,8 +2025,8 @@ async function startServer(args) { } let pluginPackagePath = require.resolve(path.posix.join(pluginInfo.requirePath, "package.json")); - let staticPath = path.join(path.dirname(pluginPackagePath), "static"); - app.use(`/plugin/${pluginInfo.name}`, express.static(staticPath)); + let webPath = path.join(path.dirname(pluginPackagePath), "dist", "web"); + app.use(`/plugin/${pluginInfo.name}`, express.static(webPath)); } // Load plugins diff --git a/packages/master/webpack.config.js b/packages/master/webpack.config.js index 756d809d..8fca09c6 100644 --- a/packages/master/webpack.config.js +++ b/packages/master/webpack.config.js @@ -9,11 +9,11 @@ module.exports = (env = {}) => merge(common(env), { context: __dirname, entry: "./web/index.jsx", devServer: { - contentBase: "./static", + contentBase: "./dist/web", }, output: { filename: "bundle.js", - path: path.resolve(__dirname, "static"), + path: path.resolve(__dirname, "dist", "web"), }, plugins: [ new webpack.container.ModuleFederationPlugin({ diff --git a/plugins/global_chat/webpack.config.js b/plugins/global_chat/webpack.config.js index 042295a4..60b98d7b 100644 --- a/plugins/global_chat/webpack.config.js +++ b/plugins/global_chat/webpack.config.js @@ -10,7 +10,7 @@ module.exports = (env = {}) => merge(common(env), { entry: "./web/index.jsx", output: { filename: "bundle.js", - path: path.resolve(__dirname, "static"), + path: path.resolve(__dirname, "dist", "web"), }, plugins: [ new webpack.container.ModuleFederationPlugin({ diff --git a/plugins/research_sync/webpack.config.js b/plugins/research_sync/webpack.config.js index 4a519c63..484dfafe 100644 --- a/plugins/research_sync/webpack.config.js +++ b/plugins/research_sync/webpack.config.js @@ -10,7 +10,7 @@ module.exports = (env = {}) => merge(common(env), { entry: "./web/index.jsx", output: { filename: "bundle.js", - path: path.resolve(__dirname, "static"), + path: path.resolve(__dirname, "dist", "web"), }, plugins: [ new webpack.container.ModuleFederationPlugin({ diff --git a/plugins/statistics_exporter/webpack.config.js b/plugins/statistics_exporter/webpack.config.js index 3198c71e..0da4c121 100644 --- a/plugins/statistics_exporter/webpack.config.js +++ b/plugins/statistics_exporter/webpack.config.js @@ -10,7 +10,7 @@ module.exports = (env = {}) => merge(common(env), { entry: "./web/index.jsx", output: { filename: "bundle.js", - path: path.resolve(__dirname, "static"), + path: path.resolve(__dirname, "dist", "web"), }, plugins: [ new webpack.container.ModuleFederationPlugin({ diff --git a/plugins/subspace_storage/webpack.config.js b/plugins/subspace_storage/webpack.config.js index 4a7b4901..cfd034a8 100644 --- a/plugins/subspace_storage/webpack.config.js +++ b/plugins/subspace_storage/webpack.config.js @@ -10,7 +10,7 @@ module.exports = (env = {}) => merge(common(env), { entry: "./web/index.jsx", output: { filename: "bundle.js", - path: path.resolve(__dirname, "static"), + path: path.resolve(__dirname, "dist", "web"), }, plugins: [ new webpack.container.ModuleFederationPlugin({