Skip to content
Permalink
Browse files

feat(mirage): add option to disable mirage support

  • Loading branch information...
anehx authored and czosel committed May 24, 2019
1 parent 0ff0e23 commit 93531d133edc8ccfb876a7717d5815a2c1f4840e
Showing with 26 additions and 8 deletions.
  1. +23 −7 index.js
  2. +3 −1 package.json
@@ -7,6 +7,10 @@ const path = require("path");
/* eslint-disable node/no-unpublished-require */
const EngineAddon = require("ember-engines/lib/engine-addon");

const DEFAULT_OPTIONS = {
includeMirageConfig: true
};

/* eslint-disable ember/avoid-leaking-state-in-ember-objects */
module.exports = EngineAddon.extend({
name: "ember-caluma",
@@ -28,13 +32,25 @@ module.exports = EngineAddon.extend({
treeForApp(appTree) {
const trees = [appTree];

const mirageDir = path.join(__dirname, "addon-mirage-support");

const mirageTree = new Funnel(mirageDir, {
destDir: "mirage"
});

trees.push(mirageTree);
const app = this._findHost();
const addonOptions = Object.assign(
{},
DEFAULT_OPTIONS,
app.options["ember-caluma"]
);

if (
addonOptions.includeMirageConfig &&
app.registry.availablePlugins["ember-cli-mirage"]
) {
const mirageDir = path.join(__dirname, "addon-mirage-support");

const mirageTree = new Funnel(mirageDir, {
destDir: "mirage"
});

trees.push(mirageTree);
}

return mergeTrees(trees);
}
@@ -123,7 +123,9 @@
"node": "6.* || 8.* || >= 10.*"
},
"ember-addon": {
"configPath": "tests/dummy/config"
"configPath": "tests/dummy/config",
"demoURL": "https://caluma.io/ember-caluma",
"after": ["ember-cli-mirage"]
},
"commitlint": {
"extends": [

0 comments on commit 93531d1

Please sign in to comment.
You can’t perform that action at this time.