-
Notifications
You must be signed in to change notification settings - Fork 48
/
index.js
57 lines (45 loc) · 1.51 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
"use strict";
const mergeTrees = require("broccoli-merge-trees");
const Funnel = require("broccoli-funnel");
const path = require("path");
const version = require("./package.json").version;
const writeFile = require("broccoli-file-creator");
module.exports = {
name: "ember-cli-jstree",
_jstreePath() {
return path.dirname(require.resolve("jstree/package.json"));
},
included(app) {
this._super.included.apply(this, app);
if (process.env.EMBER_CLI_FASTBOOT) {
return;
}
app.import("vendor/ember-cli-jstree/jstree.js");
app.import("vendor/ember-cli-jstree/style.css");
app.import("vendor/ember-cli-jstree/register-version.js");
},
treeForVendor(tree) {
let registerVersionTree = writeFile(
"ember-cli-jstree/register-version.js",
`Ember.libraries.register('Ember CLI jsTree', '${version}')`
);
let stylesTree = new Funnel(
path.join(this._jstreePath(), "dist/themes/default"),
{
include: ["*.css"],
destDir: "ember-cli-jstree"
}
);
let jsTree = new Funnel(path.join(this._jstreePath(), "dist"), {
include: ["*.js"],
destDir: "ember-cli-jstree"
});
return tree ? mergeTrees([tree, registerVersionTree, jsTree, stylesTree], {overwrite: true}) : mergeTrees([registerVersionTree, jsTree, stylesTree], {overwrite: true});
},
treeForPublic() {
return new Funnel(path.join(this._jstreePath(), "dist/themes/default"), {
include: ["**/*.png", "**/*.gif"],
destDir: "/assets"
});
}
};