-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (45 loc) · 1.34 KB
/
index.js
File metadata and controls
48 lines (45 loc) · 1.34 KB
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
40
41
42
43
44
45
46
47
48
'use strict';
module.exports = {
name: require('./package').name,
options: {},
isDevelopingAddon: function () {
return true;
},
included: function included(app) {
// see: https://github.com/ember-cli/ember-cli/issues/3718
if (typeof app.import !== 'function' && app.app) {
app = app.app;
}
this.app = app;
this.addonConfig = this.app.project.config(app.env)[this.name] || {};
this._super.included.apply(this, arguments);
},
treeFor: function () {
if (!this._shouldIncludeFiles()) {
return;
}
return this._super.treeFor.apply(this, arguments);
},
_shouldIncludeFiles: function () {
if (process.env.EMBER_CLI_FASTBOOT) {
return false;
}
var environment = this.app.env;
var enabledInProd =
this.app.env === 'production' && this.addonConfig.enabled;
var explicitExcludeFiles = this.addonConfig.excludeFilesFromBuild;
if (enabledInProd && explicitExcludeFiles) {
throw new Error(
'Mirage-nested was explicitly enabled in production, but its files were excluded ' +
"from the build. Please, use only ENV['ember-cli-mirage-nested'].enabled in " +
'production environment.'
);
}
return (
enabledInProd ||
(environment &&
environment !== 'production' &&
explicitExcludeFiles !== true)
);
}
};