-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.js
53 lines (42 loc) · 1.56 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
'use strict';
/* global process, require, module, __dirname */
var path = require('path');
var unwatchedTree = require('broccoli-unwatched-tree');
var mergeTrees = require('broccoli-merge-trees');
var pickFiles = require('broccoli-static-compiler');
module.exports = {
name: 'ember-cli-velocity',
treeForVendor: function treeForVendor() {
var emberCliVelocity = unwatchedTree(path.join(__dirname, 'vendor'));
var velocityAnimate = pickFiles(unwatchedTree(require.resolve('velocity-animate').replace('velocity.js', '')), {
srcDir: '/',
files: ['*.js'],
destDir: 'velocity-animate'
});
return mergeTrees([emberCliVelocity, velocityAnimate]);
},
velocityOptions: function () {
var env = process.env.EMBER_ENV;
return this.project.config(env).velocityOptions || { enabled: true, ui: false };
},
included: function(app) {
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;
}
var emberCLIVersion = app.project.emberCLIVersion();
if (emberCLIVersion < '0.0.41') {
throw new Error('ember-cli-velocity requires ember-cli version 0.0.41 or greater.\n');
}
var options = this.velocityOptions();
if (options.enabled === false) {
return;
}
app.import('vendor/velocity-animate/velocity.js');
if (options.ui) {
app.import('vendor/velocity-animate/velocity.ui.js');
}
app.import('vendor/ember-cli-velocity/velocity-promise-shim.js');
}
};