Skip to content

Commit

Permalink
fix: fastboot support
Browse files Browse the repository at this point in the history
closes #31
  • Loading branch information
knownasilya committed Sep 13, 2020
1 parent 318b9d2 commit b7bc9de
Show file tree
Hide file tree
Showing 4 changed files with 216 additions and 27 deletions.
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const Funnel = require('broccoli-funnel');
const MergeTrees = require('broccoli-merge-trees');
const map = require('broccoli-stew').map;
const path = require('path');

module.exports = {
Expand All @@ -23,12 +24,23 @@ module.exports = {
trees.push(vendorTree);
}

let toastrTree = new Funnel(toastrPath, {
include: ['toastr.js', 'build/toastr.*'],
let toastrJsTree = new Funnel(toastrPath, {
include: ['toastr.js'],
destDir: 'toastr',
});
let toastrCssTree = new Funnel(toastrPath, {
include: ['build/toastr.css'],
destDir: 'toastr',
});

// protect against usage in node since it depends on jquery
toastrJsTree = map(
toastrJsTree,
(content) => `if (typeof FastBoot === 'undefined') { ${content} }`
);

trees.push(toastrTree);
trees.push(toastrCssTree);
trees.push(toastrJsTree);

return new MergeTrees(trees, { overwrite: true });
},
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"ember-cli": "~3.21.2",
"ember-cli-app-version": "^3.1.3",
"ember-cli-dependency-checker": "^3.2.0",
"ember-cli-fastboot": "^2.2.3",
"ember-cli-github-pages": "^0.2.2",
"ember-cli-inject-live-reload": "^2.0.2",
"ember-cli-terser": "^4.0.0",
Expand Down Expand Up @@ -65,6 +66,7 @@
"dependencies": {
"broccoli-funnel": "^3.0.0",
"broccoli-merge-trees": "^4.2.0",
"broccoli-stew": "^3.0.0",
"ember-cli-babel": "^7.22.1",
"ember-cli-htmlbars": "^5.3.1"
},
Expand Down
14 changes: 7 additions & 7 deletions tests/dummy/config/environment.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module.exports = function(environment) {
module.exports = function (environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
rootURL: '/ember-toastr',
rootURL: '/ember-toastr/',
locationType: 'auto',
EmberENV: {
FEATURES: {
Expand All @@ -11,8 +11,8 @@ module.exports = function(environment) {
},
EXTEND_PROTOTYPES: {
// Prevent Ember Data from overriding Date.parse.
Date: false
}
Date: false,
},
},

APP: {
Expand All @@ -22,9 +22,9 @@ module.exports = function(environment) {

'ember-toastr': {
toastrOptions: {
preventDuplicates: false
}
}
preventDuplicates: false,
},
},
};

if (environment === 'development') {
Expand Down

0 comments on commit b7bc9de

Please sign in to comment.