Niedzielski has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/372831 )

Change subject: Chore: Add VERBOSE env var for webpack config
......................................................................


Chore: Add VERBOSE env var for webpack config

There are times where you want to see all the info on the build process.
Add a VERBOSE env variable with which you can enable logging options.

The default remains staying silent unless errors/warnings.

Change-Id: Ia9dfc7b7af48c1d694ca6624e2d0209c4f50f6b3
---
M webpack.config.js
1 file changed, 18 insertions(+), 12 deletions(-)

Approvals:
  Niedzielski: Verified; Looks good to me, approved



diff --git a/webpack.config.js b/webpack.config.js
index b2b434b..aa12c30 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -4,6 +4,8 @@
 const ExtractTextPlugin = require("extract-text-webpack-plugin");
 
 const isProd = process.env.NODE_ENV === "production";
+const isVerbose = Boolean(JSON.parse(process.env.VERBOSE || "false"));
+
 const paths = {
   client: {
     output: path.resolve("./dist/public/")
@@ -13,20 +15,24 @@
 // There is no builtin Stats "warnings" preset.
 // https://github.com/webpack/webpack/blob/7fe0371/lib/Stats.js#L886
 // https://github.com/webpack/webpack/blob/7fe0371/lib/Stats.js#L101-L131
-const WARNINGS_STATS_PRESET = {
-  all: false, // Default all options to false.
-  errors: true,
-  errorDetails: true,
-  moduleTrace: true,
-  warnings: true
-};
+const STATS = isVerbose
+  ? {
+      all: true
+    }
+  : {
+      all: false, // Default all options to false.
+      errors: true,
+      errorDetails: true,
+      moduleTrace: true,
+      warnings: true
+    };
 
 module.exports = {
   entry: {
     index: "./src/client/index"
   },
 
-  stats: WARNINGS_STATS_PRESET,
+  stats: STATS,
 
   output: {
     path: paths.client.output,
@@ -50,7 +56,7 @@
         test: /\.tsx?$/,
         loader: "ts-loader",
         options: {
-          logLevel: "warn"
+          logLevel: isVerbose ? "info" : "warn"
         }
       },
       {
@@ -75,16 +81,16 @@
         contentBase: false,
 
         // Log warnings and errors in the browser console.
-        clientLogLevel: "warning",
+        clientLogLevel: isVerbose ? "info" : "warning",
 
         // Hide bundling start and finish messages.
-        noInfo: true,
+        noInfo: !isVerbose,
 
         // Show warnings and errors as an obtrusive opaque overlay in the
         // browser.
         overlay: { warnings: true, errors: true },
 
-        stats: WARNINGS_STATS_PRESET
+        stats: STATS
       },
 
   plugins: [

-- 
To view, visit https://gerrit.wikimedia.org/r/372831
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia9dfc7b7af48c1d694ca6624e2d0209c4f50f6b3
Gerrit-PatchSet: 4
Gerrit-Project: marvin
Gerrit-Branch: master
Gerrit-Owner: Jhernandez <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: Sniedzielski <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to