jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/391897 )
Change subject: Chore: move config code to common
......................................................................
Chore: move config code to common
Both server and client need access to config variables set by Webpack at
build time. Move the configurations from server/ to common/ and keep
default values only in config.ts instead of redundantly in
webpack.config.ts too.
Bug: T180623
Change-Id: Ie59a4f159e493abdb26f8368dc7e982be390779a
---
M src/client/webpack.config.ts
R src/common/assets/config.ts
M src/common/webpack.config.ts
M src/server/index.tsx
M src/server/webpack.config.ts
5 files changed, 12 insertions(+), 11 deletions(-)
Approvals:
Jhernandez: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/client/webpack.config.ts b/src/client/webpack.config.ts
index c2bfcfc..c56d54e 100644
--- a/src/client/webpack.config.ts
+++ b/src/client/webpack.config.ts
@@ -16,7 +16,7 @@
VERBOSE,
WEBPACK_DEV_SERVER_PORT,
WEBPACK_DEV_SERVER_URL
-} from "../server/config";
+} from "../common/assets/config";
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
diff --git a/src/server/config.ts b/src/common/assets/config.ts
similarity index 100%
rename from src/server/config.ts
rename to src/common/assets/config.ts
diff --git a/src/common/webpack.config.ts b/src/common/webpack.config.ts
index 30fb2db..e993120 100644
--- a/src/common/webpack.config.ts
+++ b/src/common/webpack.config.ts
@@ -1,6 +1,11 @@
import * as path from "path";
import * as webpack from "webpack";
-import { PRODUCTION, VERBOSE } from "../server/config";
+import {
+ PRODUCTION,
+ SERVER_PORT,
+ VERBOSE,
+ WEBPACK_DEV_SERVER_PORT
+} from "./assets/config";
const pkg = require("../../package.json");
export const PATHS = {
@@ -34,13 +39,9 @@
export const definePlugin = new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(PRODUCTION ? "production" : "development"),
- VERBOSE: JSON.stringify(VERBOSE ? 1 : 0),
- PORT: JSON.stringify(process.env.PORT ? process.env.PORT : 3000),
- WEBPACK_DEV_SERVER_PORT: JSON.stringify(
- process.env.WEBPACK_DEV_SERVER_PORT
- ? process.env.WEBPACK_DEV_SERVER_PORT
- : 8080
- )
+ VERBOSE: JSON.stringify(VERBOSE),
+ PORT: JSON.stringify(SERVER_PORT),
+ WEBPACK_DEV_SERVER_PORT: JSON.stringify(WEBPACK_DEV_SERVER_PORT)
},
VERSION: JSON.stringify(pkg.version)
});
diff --git a/src/server/index.tsx b/src/server/index.tsx
index 2c203b5..9c166cc 100644
--- a/src/server/index.tsx
+++ b/src/server/index.tsx
@@ -10,7 +10,7 @@
SERVER_PORT,
SERVER_URL,
WEBPACK_DEV_SERVER_URL
-} from "./config";
+} from "../common/assets/config";
import HTMLPage from "./components/html-page";
declare function __non_webpack_require__(name: string): any; //
eslint-disable-line camelcase
diff --git a/src/server/webpack.config.ts b/src/server/webpack.config.ts
index c2dfb5f..628b774 100644
--- a/src/server/webpack.config.ts
+++ b/src/server/webpack.config.ts
@@ -9,7 +9,7 @@
definePlugin,
typescriptLoader
} from "../common/webpack.config";
-import { VERBOSE } from "../server/config";
+import { VERBOSE } from "../common/assets/config";
const config: webpack.Configuration = {
// Target a Node.js environment. The interpreter is expected to provide
--
To view, visit https://gerrit.wikimedia.org/r/391897
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie59a4f159e493abdb26f8368dc7e982be390779a
Gerrit-PatchSet: 1
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits