-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (21 loc) · 893 Bytes
/
index.js
File metadata and controls
26 lines (21 loc) · 893 Bytes
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
'use strict';
const Config = require('./lib/config');
const mergeTrees = require('broccoli-merge-trees');
module.exports = {
name: 'ember-service-worker-index',
included(app) {
this._super.included && this._super.included.apply(this, arguments);
this.app = app;
this.app.options = this.app.options || {};
this.app.options['esw-prember'] = this.app.options['esw-prember'] || {};
},
treeForServiceWorker(swTree, appTree) {
const premberOptions = this.app.options['prember'];
// Make sure we only do this stuff if prember is enabled
if (premberOptions && (premberOptions.enabled || (this.app.env === 'production' || process.env.PREMBER))) {
const eswPremberOptions = this.app.options['esw-prember'];
const configFile = new Config(appTree, {env: this.app.env, ...eswPremberOptions});
return mergeTrees([swTree, configFile]);
}
}
};