From 9204cd44af3059065adc294e0b9108d075df38f0 Mon Sep 17 00:00:00 2001 From: argshook Date: Fri, 10 Jun 2022 23:33:36 +0300 Subject: [PATCH 1/2] refactor config constants --- packages/web-console/webpack.config.js | 28 +++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/packages/web-console/webpack.config.js b/packages/web-console/webpack.config.js index 09386d5a6..57ef527fe 100644 --- a/packages/web-console/webpack.config.js +++ b/packages/web-console/webpack.config.js @@ -33,11 +33,12 @@ const Webpack = require("webpack") const monacoConfig = require("./monaco.config") require("dotenv").config() -const PORT = 9999 -const BACKEND_PORT = 9000 -const isProdBuild = process.env.NODE_ENV === "production" -const runBundleAnalyzer = process.env.ANALYZE -const ASSET_PATH = process.env.ASSET_PATH || "/" +const config = { + port: 9999, + backendUrl: "http://127.0.0.1:9000", + assetPath: process.env.ASSET_PATH || "/", + isProduction: process.env.NODE_ENV === "production", +} if (!process.env.NODE_ENV) { process.env.NODE_ENV = "development" @@ -107,18 +108,18 @@ module.exports = { compress: true, host: "localhost", hot: false, - port: PORT, + port: config.port, proxy: { context: ["/imp", "/exp", "/exec", "/chk"], - target: `http://localhost:${BACKEND_PORT}/`, + target: config.backendUrl, }, }, - devtool: isProdBuild ? false : "eval-source-map", - mode: isProdBuild ? "production" : "development", + devtool: config.isProduction ? false : "eval-source-map", + mode: config.isProduction ? "production" : "development", entry: "./src/index", output: { filename: "qdb.js", - publicPath: ASSET_PATH, + publicPath: config.assetPath, path: path.resolve(__dirname, "dist"), }, resolve: { @@ -147,10 +148,13 @@ module.exports = { test: /\.s[ac]ss$/i, use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"], }, - ...(isProdBuild ? [] : devLoaders), + ...(config.isProduction ? [] : devLoaders), ], }, - plugins: [...basePlugins, ...(isProdBuild ? prodPlugins : devPlugins)], + plugins: [ + ...basePlugins, + ...(config.isProduction ? prodPlugins : devPlugins), + ], stats: { all: false, chunks: true, From 8c7d0ed16c7632b49de51514ca8799384a431b6d Mon Sep 17 00:00:00 2001 From: argshook Date: Fri, 10 Jun 2022 23:55:29 +0300 Subject: [PATCH 2/2] add `files` to package.json --- packages/web-console/package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web-console/package.json b/packages/web-console/package.json index eed128698..194c9bee3 100644 --- a/packages/web-console/package.json +++ b/packages/web-console/package.json @@ -3,11 +3,13 @@ "version": "0.0.1", "license": "Apache-2.0", "description": "QuestDB Console", + "files": [ + "dist" + ], "repository": { "type": "git", "url": "https://github.com/questdb/ui.git" }, - "private": true, "engines": { "node": ">=16.13.1" },