From d2e3ca27960bfa2051cfdbbe03f829e154f07f91 Mon Sep 17 00:00:00 2001 From: Jean du Plessis Date: Fri, 7 Jul 2017 13:24:13 +0200 Subject: [PATCH 1/2] Add dragula dependency into vendor tree --- index.js | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 989c55c..5543d84 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,47 @@ /* eslint-env node */ 'use strict'; +const path = require('path'); +const Funnel = require('broccoli-funnel'); +const MergeTrees = require('broccoli-merge-trees'); +const map = require('broccoli-stew').map; + module.exports = { - name: 'ember-dragula' + name: 'ember-dragula', + + included(app) { + + console.log('included'); + + this._super.included.apply(this, arguments); + + // see: https://github.com/ember-cli/ember-cli/issues/3718 + if (typeof app.import !== 'function' && app.app) { + app = app.app; + } + + app.import('vendor/dragula.css'); + app.import('vendor/dragula.js'); + }, + + treeForVendor(vendorTree) { + let trees = []; + let dragulaTree = new Funnel(path.dirname(require.resolve('dragula')) + '/dist', { + files: ['dragula.js', 'dragula.css'] + }); + + dragulaTree = map(dragulaTree, content => `if (typeof FastBoot === 'undefined') { ${content} }`); + + if (vendorTree !== undefined) { + trees.push(vendorTree); + } + + trees.push(dragulaTree); + + return new MergeTrees(trees); + }, + + isDevelopingAddon() { + return false; + } }; From 564e73a018cf46313ca11f9b23dd5cefaa0a7b22 Mon Sep 17 00:00:00 2001 From: Jean du Plessis Date: Fri, 7 Jul 2017 13:26:01 +0200 Subject: [PATCH 2/2] Remove console.log --- index.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/index.js b/index.js index 5543d84..7228a76 100644 --- a/index.js +++ b/index.js @@ -10,9 +10,6 @@ module.exports = { name: 'ember-dragula', included(app) { - - console.log('included'); - this._super.included.apply(this, arguments); // see: https://github.com/ember-cli/ember-cli/issues/3718