Permalink
Browse files

feat(workbox, onegisnal): Use defaultsDeep for options

  • Loading branch information...
pi0 committed Nov 17, 2017
1 parent d67df15 commit 5ac89cffdb7b9462172399f7789a4f56031fb53d
Showing with 7 additions and 3 deletions.
  1. +2 −1 packages/onesignal/index.js
  2. +5 −2 packages/workbox/index.js
@@ -2,6 +2,7 @@ const path = require('path')
const { writeFileSync, readFileSync } = require('fs')
const hashSum = require('hash-sum')
const debug = require('debug')('nuxt:pwa')
const { defaultsDeep } = require('lodash')
const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0
@@ -55,7 +56,7 @@ function addOneSignal (moduleOptions) {
}
}
const options = Object.assign(defaults, moduleOptions, this.options.oneSignal)
const options = defaultsDeep({}, this.options.oneSignal, moduleOptions, defaults)
if (options.OneSignalSDK === undefined) {
if (options.cdn) {
@@ -4,6 +4,7 @@ const { readFileSync, writeFileSync } = require('fs')
const hashSum = require('hash-sum')
const escapeStringRegexp = require('escape-string-regexp')
const debug = require('debug')('nuxt:pwa')
const { defaultsDeep } = require('lodash')
const fixUrl = url => url.replace(/\/\//g, '/').replace(':/', '://')
const isUrl = url => url.indexOf('http') === 0 || url.indexOf('//') === 0
@@ -43,7 +44,7 @@ function getOptions (moduleOptions) {
}
}
const options = Object.assign({
const defaults = {
autoRegister: true,
routerBase,
publicPath,
@@ -70,7 +71,9 @@ function getOptions (moduleOptions) {
handler: 'networkFirst'
}
]
}, moduleOptions, this.options.workbox)
}
const options = defaultsDeep({}, this.options.workbox, moduleOptions, defaults)
return options
}

0 comments on commit 5ac89cf

Please sign in to comment.