-
Notifications
You must be signed in to change notification settings - Fork 30
/
ember-cli-build.js
50 lines (40 loc) · 1.4 KB
/
ember-cli-build.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
'use strict';
const fs = require('fs');
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const tee = require('broccoli-tee');
const concat = require('broccoli-concat');
const build = require('./lib/build');
const FixupSources = require('./lib/fixup-sources');
module.exports = function () {
const workspaces = require('./package').workspaces.filter((workspace) => {
return fs.existsSync(`${__dirname}/${workspace}/src`);
});
const src = mergeTrees(workspaces.map(build.funnelSrc), {
annotation: 'merge workspace src',
});
const compiled = build.compileSrc(src);
let dist = new FixupSources(mergeTrees(workspaces.map((workspace) => {
const dist = build.packageDist(compiled, workspace);
tee(dist, `${__dirname}/${workspace}/dist`);
return new Funnel(dist, {
include: ['amd/es5/**', 'test/**'],
destDir: `${workspace}/dist`,
annotation: `mv . to ${workspace}/dist`
});
})), '..');
if (build.isProduction()) {
return dist;
}
const vendor = concat(dist, {
outputFile: '/test/amd/vendor.js',
inputFiles: ['packages/**/dist/amd/es5/index.js'],
sourceMapConfig: { enabled: true }
});
const test = concat(dist, {
outputFile: '/test/amd/index.js',
inputFiles: ['packages/**/test/amd/index.js'],
sourceMapConfig: { enabled: true }
});
return mergeTrees([vendor, test, build.testDist()]);
}