From 7a510101d01f0fe05c3438fe9f51f56f6a28bdfb Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 27 Jan 2018 08:22:23 -0800 Subject: [PATCH] automatically remove console logs --- routes/_components/Timeline.html | 4 +--- .../virtualList/VirtualListContainer.html | 12 +++--------- routes/_utils/database/databaseLifecycle.js | 3 +-- routes/settings/instances/add.html | 4 +--- webpack.client.config.js | 10 +++++++++- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/routes/_components/Timeline.html b/routes/_components/Timeline.html index 05dab51..eff81ec 100644 --- a/routes/_components/Timeline.html +++ b/routes/_components/Timeline.html @@ -119,9 +119,7 @@ stop('onScrollToBottom') }, addStatuses(newStatuses) { - if (process.env.NODE_ENV !== 'production') { - console.log('addStatuses()') - } + console.log('addStatuses()') let instanceName = this.store.get('currentInstance') let timeline = this.get('timeline') let statusIds = this.get('statusIds') diff --git a/routes/_components/virtualList/VirtualListContainer.html b/routes/_components/virtualList/VirtualListContainer.html index 9b7231f..d67fc24 100644 --- a/routes/_components/virtualList/VirtualListContainer.html +++ b/routes/_components/virtualList/VirtualListContainer.html @@ -22,16 +22,12 @@ let scrollTop = this.store.get('scrollTop') if (scrollTop > 0) { this.observe('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight => { - if (process.env.NODE_ENV !== 'production') { - console.log('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight) - } + console.log('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight) if (!this.get('initializedScrollTop') && allVisibleItemsHaveHeight && node) { this.set({'initializedScrollTop': true}) requestAnimationFrame(() => { mark('set scrollTop') - if (process.env.NODE_ENV !== 'production') { - console.log('forcing scroll top to ', scrollTop) - } + console.log('forcing scroll top to ', scrollTop) node.scrollTop = scrollTop stop('set scrollTop') }) @@ -88,9 +84,7 @@ }, onFullscreenChange() { mark('onFullscreenChange') - if (process.env.NODE_ENV !== 'production') { - console.log('is fullscreen? ', isFullscreen()) - } + console.log('is fullscreen? ', isFullscreen()) this.set({ fullscreen: isFullscreen() }) stop('onFullscreenChange') } diff --git a/routes/_utils/database/databaseLifecycle.js b/routes/_utils/database/databaseLifecycle.js index 81f73af..61dbd9c 100644 --- a/routes/_utils/database/databaseLifecycle.js +++ b/routes/_utils/database/databaseLifecycle.js @@ -9,8 +9,7 @@ import { } from './constants' export function getDatabase(instanceName) { - if (!instanceName && process.env.NODE_ENV !== 'production') { - console.trace() + if (!instanceName) { throw new Error('instanceName is undefined in getDatabase()') } if (databaseCache[instanceName]) { diff --git a/routes/settings/instances/add.html b/routes/settings/instances/add.html index 30f5034..f1b0d58 100644 --- a/routes/settings/instances/add.html +++ b/routes/settings/instances/add.html @@ -106,9 +106,7 @@ try { await this.redirectToOauth() } catch (err) { - if (process.env.NODE_ENV !== 'production') { - console.error(err) - } + console.error(err) let error = `${err.message || err.name}. ` + (navigator.onLine ? `Is this a valid Mastodon instance?` : diff --git a/webpack.client.config.js b/webpack.client.config.js index 9a14046..5c30dff 100644 --- a/webpack.client.config.js +++ b/webpack.client.config.js @@ -68,7 +68,15 @@ module.exports = { //new ExtractTextPlugin('main.css'), new LodashModuleReplacementPlugin(), new webpack.optimize.ModuleConcatenationPlugin(), - new UglifyJSPlugin(), + new UglifyJSPlugin({ + parallel: true, + uglifyOptions: { + comments: false, + compress: { + drop_console: true + } + } + }), new BundleAnalyzerPlugin({ // generates report.html and stats.json analyzerMode: 'static', generateStatsFile: true,