Skip to content

Commit

Permalink
Update addon for FastBoot 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kratiahuja committed Jun 10, 2017
1 parent 7a37782 commit ef40b06
Show file tree
Hide file tree
Showing 3 changed files with 376 additions and 160 deletions.
42 changes: 35 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* jshint node: true */
'use strict';

const Funnel = require('broccoli-funnel');
const Merge = require('broccoli-merge-trees');
const path = require('path');
const existsSync = require('exists-sync');
const fastbootTransform = require('fastboot-transform');

module.exports = {
name: 'ember-plupload',

Expand All @@ -14,14 +20,14 @@ module.exports = {
debugMode = process.env.EMBER_ENV === 'development';
}

if (!process.env.EMBER_CLI_FASTBOOT) {
if (debugMode) {
app.import('bower_components/plupload/js/moxie.js');
app.import('bower_components/plupload/js/plupload.dev.js');
} else {
app.import('bower_components/plupload/js/plupload.full.min.js');
}

if (debugMode) {
app.import('vendor/plupload/moxie.js');
app.import('vendor/plupload/plupload.dev.js');
} else {
app.import('vendor/plupload/plupload.full.min.js');
}

app.import('bower_components/plupload/js/Moxie.swf', {
destDir: 'assets'
});
Expand All @@ -35,5 +41,27 @@ module.exports = {
});

app.import('vendor/styles/ember-plupload.css');
},

treeForVendor(tree) {
let trees = [];

if (tree) {
trees.push(tree);
}

const app = this._findHost();
let assetDir = path.join(this.project.root, app.bowerDirectory, 'plupload', 'js');
console.log(assetDir);

if (existsSync(assetDir)) {
const browserTrees = fastbootTransform(new Funnel(assetDir, {
files: ['moxie.js', 'plupload.dev.js', 'plupload.full.min.js'],
destDir: 'plupload'
}));
trees.push(browserTrees);
}

return new Merge(trees);
}
};
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"ember-cli-shims": "^1.0.2",
"ember-cli-uglify": "^1.2.0",
"ember-disable-prototype-extensions": "^1.1.0",
"ember-inline-svg": "0.1.11",
"ember-load-initializers": "^1.0.0",
"ember-resolver": "^4.1.0",
"ember-inline-svg": "0.1.11",
"ember-source": "~2.13.2",
"ember-try": "^0.2.13",
"loader.js": "^4.2.3"
Expand All @@ -43,7 +43,11 @@
"file-upload"
],
"dependencies": {
"broccoli-funnel": "^1.2.0",
"broccoli-merge-trees": "^2.0.0",
"ember-cli-babel": "^5.1.7",
"exists-sync": "^0.0.4",
"fastboot-transform": "^0.1.0",
"rsvp": "^3.0.17"
},
"ember-addon": {
Expand Down
Loading

0 comments on commit ef40b06

Please sign in to comment.