-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathindex.js
34 lines (26 loc) · 912 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
'use strict';
const Config = require('./lib/config');
const MergeTrees = require('broccoli-merge-trees');
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]);
},
};