automatically remove console logs

This commit is contained in:
Nolan Lawson 2018-01-27 08:22:23 -08:00
parent 687cc5c961
commit 7a510101d0
5 changed files with 15 additions and 18 deletions

View file

@ -119,9 +119,7 @@
stop('onScrollToBottom') stop('onScrollToBottom')
}, },
addStatuses(newStatuses) { addStatuses(newStatuses) {
if (process.env.NODE_ENV !== 'production') {
console.log('addStatuses()') console.log('addStatuses()')
}
let instanceName = this.store.get('currentInstance') let instanceName = this.store.get('currentInstance')
let timeline = this.get('timeline') let timeline = this.get('timeline')
let statusIds = this.get('statusIds') let statusIds = this.get('statusIds')

View file

@ -22,16 +22,12 @@
let scrollTop = this.store.get('scrollTop') let scrollTop = this.store.get('scrollTop')
if (scrollTop > 0) { if (scrollTop > 0) {
this.observe('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight => { this.observe('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight => {
if (process.env.NODE_ENV !== 'production') {
console.log('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight) console.log('allVisibleItemsHaveHeight', allVisibleItemsHaveHeight)
}
if (!this.get('initializedScrollTop') && allVisibleItemsHaveHeight && node) { if (!this.get('initializedScrollTop') && allVisibleItemsHaveHeight && node) {
this.set({'initializedScrollTop': true}) this.set({'initializedScrollTop': true})
requestAnimationFrame(() => { requestAnimationFrame(() => {
mark('set scrollTop') 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 node.scrollTop = scrollTop
stop('set scrollTop') stop('set scrollTop')
}) })
@ -88,9 +84,7 @@
}, },
onFullscreenChange() { onFullscreenChange() {
mark('onFullscreenChange') mark('onFullscreenChange')
if (process.env.NODE_ENV !== 'production') {
console.log('is fullscreen? ', isFullscreen()) console.log('is fullscreen? ', isFullscreen())
}
this.set({ fullscreen: isFullscreen() }) this.set({ fullscreen: isFullscreen() })
stop('onFullscreenChange') stop('onFullscreenChange')
} }

View file

@ -9,8 +9,7 @@ import {
} from './constants' } from './constants'
export function getDatabase(instanceName) { export function getDatabase(instanceName) {
if (!instanceName && process.env.NODE_ENV !== 'production') { if (!instanceName) {
console.trace()
throw new Error('instanceName is undefined in getDatabase()') throw new Error('instanceName is undefined in getDatabase()')
} }
if (databaseCache[instanceName]) { if (databaseCache[instanceName]) {

View file

@ -106,9 +106,7 @@
try { try {
await this.redirectToOauth() await this.redirectToOauth()
} catch (err) { } catch (err) {
if (process.env.NODE_ENV !== 'production') {
console.error(err) console.error(err)
}
let error = `${err.message || err.name}. ` + let error = `${err.message || err.name}. ` +
(navigator.onLine ? (navigator.onLine ?
`Is this a valid Mastodon instance?` : `Is this a valid Mastodon instance?` :

View file

@ -68,7 +68,15 @@ module.exports = {
//new ExtractTextPlugin('main.css'), //new ExtractTextPlugin('main.css'),
new LodashModuleReplacementPlugin(), new LodashModuleReplacementPlugin(),
new webpack.optimize.ModuleConcatenationPlugin(), 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 new BundleAnalyzerPlugin({ // generates report.html and stats.json
analyzerMode: 'static', analyzerMode: 'static',
generateStatsFile: true, generateStatsFile: true,