Browse Source

Make logger && db env dependent - fixes storybook

master
meriadec 7 years ago
parent
commit
98adc5ab58
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 13
      src/helpers/db/db-storybook.js
  2. 0
      src/helpers/db/db.js
  3. 3
      src/helpers/db/index.js
  4. 3
      src/logger/index.js
  5. 23
      src/logger/logger-storybook.js
  6. 0
      src/logger/logger.js

13
src/helpers/db/db-storybook.js

@ -0,0 +1,13 @@
// @flow
const noop = () => {}
module.exports = {
init: noop,
get: noop,
set: noop,
getIn: noop,
setIn: noop,
cleanCache: noop,
resetAll: noop,
}

0
src/helpers/db.js → src/helpers/db/db.js

3
src/helpers/db/index.js

@ -0,0 +1,3 @@
const db = process.env.STORYBOOK_ENV ? require('./db-storybook') : require('./db')
module.exports = db

3
src/logger/index.js

@ -0,0 +1,3 @@
const logger = process.env.STORYBOOK_ENV ? require('./logger-storybook') : require('./logger')
module.exports = logger

23
src/logger/logger-storybook.js

@ -0,0 +1,23 @@
const noop = () => {}
module.exports = {
setProcessShortName: noop,
onCmd: noop,
onDB: noop,
onReduxAction: noop,
onTabKey: noop,
websocket: noop,
libcore: noop,
network: noop,
networkSucceed: noop,
networkError: noop,
networkDown: noop,
analyticsStart: noop,
analyticsStop: noop,
analyticsTrack: noop,
analyticsPage: noop,
log: noop,
warn: noop,
error: noop,
critical: noop,
}

0
src/logger.js → src/logger/logger.js

Loading…
Cancel
Save