From 679ab320ac87bd2ada286fd6c817613e55833e51 Mon Sep 17 00:00:00 2001 From: adrigzr Date: Tue, 1 Feb 2022 15:12:13 +0100 Subject: [PATCH 1/2] fix: allow override default settings fixes #108 --- index.js | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/index.js b/index.js index 3d07775..4997a39 100644 --- a/index.js +++ b/index.js @@ -10,23 +10,26 @@ module.exports = { isDevelopingAddon: () => true, config(env, baseConfig) { - const workboxOptions = (this.app && this.app.options.workbox) || {}; const emberCliWorkboxOptions = baseConfig['ember-cli-workbox']; - const options = emberCliWorkboxOptions || {}; const appOptions = (this.app && this.app.options['ember-cli-workbox']) || {}; const projectName = (baseConfig.APP && baseConfig.APP.name) || 'app'; + let workboxOptions = (this.app && this.app.options.workbox) || {}; + let options = emberCliWorkboxOptions || {}; - Object.assign(workboxOptions, { - swDest: 'sw.js', - globDirectory: './', - globPatterns: [ - '**/*.{json,css,js,png,svg,eot,ttf,woff,jpg,gif,ico,xml,html,txt}', - ], - skipWaiting: false, - clientsClaim: false, - cacheId: projectName, - }); + workboxOptions = Object.assign( + { + swDest: 'sw.js', + globDirectory: './', + globPatterns: [ + '**/*.{json,css,js,png,svg,eot,ttf,woff,jpg,gif,ico,xml,html,txt}', + ], + skipWaiting: false, + clientsClaim: false, + cacheId: projectName, + }, + workboxOptions + ); env = env || process.env.EMBER_ENV; @@ -37,11 +40,15 @@ module.exports = { const isProdBuild = Boolean(env.match('prod')); - Object.assign(options, appOptions, { - enabled: isProdBuild, - debug: !isProdBuild, - importScriptsGlobPatterns: ['assets/service-workers/*.js'], - }); + options = Object.assign( + { + enabled: isProdBuild, + debug: !isProdBuild, + importScriptsGlobPatterns: ['assets/service-workers/*.js'], + }, + options, + appOptions + ); this._options = options; this.workboxOptions = workboxOptions; From c3df91bff9a8f7b58621de69cc648e5762ac057c Mon Sep 17 00:00:00 2001 From: adrigzr Date: Tue, 1 Feb 2022 15:32:39 +0100 Subject: [PATCH 2/2] chore: ignore changelog from prettier --- .prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.prettierignore b/.prettierignore index f5cff0f..0d723ea 100644 --- a/.prettierignore +++ b/.prettierignore @@ -17,6 +17,7 @@ .eslintcache *.html *.hbs +CHANGELOG.md # ember-try /.node_modules.ember-try/