forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
73 lines (59 loc) · 1.87 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* eslint-env node */
'use strict';
var fs = require('fs');
var path = require('path');
var resolve = require('resolve');
var paths = {};
var absolutePaths = {};
function add(paths, name, path) {
Object.defineProperty(paths, name, {
configurable: false,
get: function() { return path; }
});
}
add(paths, 'prod', 'vendor/ember/ember.prod.js');
add(paths, 'debug', 'vendor/ember/ember.debug.js');
add(paths, 'jquery', 'vendor/ember/jquery/jquery.js');
add(absolutePaths, 'templateCompiler', __dirname + '/dist/ember-template-compiler.js');
module.exports = {
init: function() {
this._super.init && this._super.init.apply(this, arguments);
if ('ember' in this.project.bowerDependencies()) {
// TODO: move this to a throw soon.
this.ui.writeWarnLine('Ember.js is now provided by node_module `ember-source`, please remove it from bower');
}
},
name: 'ember-source',
paths: paths,
absolutePaths: absolutePaths,
treeForVendor: function() {
var Funnel = require('broccoli-funnel');
var MergeTrees = require('broccoli-merge-trees');
var jqueryPath;
try {
jqueryPath = path.dirname(resolve.sync('jquery/package.json', { basedir: this.project.root }));
} catch (error) {
jqueryPath = path.dirname(require.resolve('jquery/package.json'));
}
var jquery = new Funnel(jqueryPath + '/dist', {
destDir: 'ember/jquery',
files: [ 'jquery.js' ]
});
var emberFiles = [
'ember-runtime.js',
'ember-template-compiler.js',
'ember-testing.js',
'ember.debug.js',
'ember.min.js',
'ember.prod.js'
].filter(function(file) {
var fullPath = path.join(__dirname, 'dist', file);
return fs.existsSync(fullPath);
});
var ember = new Funnel(__dirname + '/dist', {
destDir: 'ember',
files: emberFiles
});
return new MergeTrees([ember, jquery]);
}
};