-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.js
39 lines (31 loc) · 952 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
'use strict';
const MergeTrees = require('broccoli-merge-trees');
const Config = require('./lib/config');
module.exports = {
name: 'ember-cloud-firestore-adapter',
included(app) {
this._super.included.apply(this, arguments);
if (
Object.prototype.hasOwnProperty.call(
app.options,
'esw-ember-cloud-firestore-adapter',
)
) {
this.serviceWorkerOption =
app.options['esw-ember-cloud-firestore-adapter'];
} else {
this.serviceWorkerOption = {};
}
const { firebaseConfig, firebaseVersion } = this.project.config(app.env)[
'ember-cloud-firestore-adapter'
];
this.serviceWorkerOption = Object.assign({}, this.serviceWorkerOption, {
firebaseConfig,
firebaseVersion,
});
},
treeForServiceWorker(swTree, appTree) {
const configFile = new Config([appTree], this.serviceWorkerOption);
return new MergeTrees([swTree, configFile]);
},
};