From f720c0f6342501a3c67d954fdec3f8aa44d38652 Mon Sep 17 00:00:00 2001 From: Bill Dami Date: Wed, 20 Sep 2017 10:32:16 -0400 Subject: [PATCH 1/3] add compatibility for FastBoot >=1.0.0 --- index.js | 27 +++++++++++++++++++++------ package.json | 3 +++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 4d9e709..7774d75 100644 --- a/index.js +++ b/index.js @@ -1,18 +1,33 @@ 'use strict'; var path = require('path'); +var Funnel = require('broccoli-funnel'); +var mergeTrees = require('broccoli-merge-trees'); +var map = require('broccoli-stew').map; module.exports = { name: 'ember-colpick', blueprintsPath: function() { return path.join(__dirname, 'blueprints'); }, - included: function colpick_included(app) { - this._super.included.apply(this, arguments); - if(!process.env.EMBER_CLI_FASTBOOT) { - var colpickPath = path.join(app.bowerDirectory, 'colpick'); + treeForVendor(defaultTree) { + var trees = []; - this.app.import(path.join(colpickPath, 'js', 'colpick.js')); - this.app.import(path.join(colpickPath, 'css', 'colpick.css')); + if (defaultTree) { + trees.push(defaultTree); } + + var browserVendorLib = new Funnel(path.join(this.app.bowerDirectory, 'colpick', 'js'), { + files: ['colpick.js'], + destDir: 'colpick' + }); + + browserVendorLib = map(browserVendorLib, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`); + trees.push(browserVendorLib); + return new mergeTrees(trees); + }, + included: function colpick_included(app) { + this._super.included.apply(this, arguments); + this.app.import(path.join('vendor', 'colpick', 'colpick.js')); + this.app.import(path.join(app.bowerDirectory, 'colpick', 'css', 'colpick.css')); } }; diff --git a/package.json b/package.json index 1ad3257..0aa5c7a 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,9 @@ "license": "MIT", "devDependencies": { "broccoli-asset-rev": "^2.4.2", + "broccoli-funnel": "1.2.0", + "broccoli-merge-trees": "^2.0.0", + "broccoli-stew": "1.5.0", "ember-cli": "2.4.3", "ember-cli-app-version": "^1.0.0", "ember-cli-dependency-checker": "^1.2.0", From ea6e700c53b684ce2c2a8c2a53bcad5efa7e0cd9 Mon Sep 17 00:00:00 2001 From: Bill Dami Date: Wed, 20 Sep 2017 11:26:25 -0400 Subject: [PATCH 2/3] don't use object method shorthand --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 7774d75..ffaf837 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ module.exports = { blueprintsPath: function() { return path.join(__dirname, 'blueprints'); }, - treeForVendor(defaultTree) { + treeForVendor: function(defaultTree) { var trees = []; if (defaultTree) { From 8a6783274c6c161228e61afd6a0e5cc7dc0d3fa2 Mon Sep 17 00:00:00 2001 From: Bill Dami Date: Wed, 20 Sep 2017 12:59:21 -0400 Subject: [PATCH 3/3] can't use arrow functions or template strings either --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index ffaf837..8f9c1db 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,10 @@ module.exports = { destDir: 'colpick' }); - browserVendorLib = map(browserVendorLib, (content) => `if (typeof FastBoot === 'undefined') { ${content} }`); + browserVendorLib = map(browserVendorLib, function(content) { + return "if (typeof FastBoot === 'undefined') { " + content + " }"; + }); + trees.push(browserVendorLib); return new mergeTrees(trees); },