-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathember-cli-build.js
110 lines (95 loc) · 2.49 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
var Funnel = require('broccoli-funnel');
var Rollup = require('broccoli-rollup');
var typescript = require('broccoli-typescript-compiler').typescript;
var TSLint = require('broccoli-tslinter');
var MergeTrees = require('broccoli-merge-trees');
var concat = require('broccoli-concat');
var sourcemaps = require('rollup-plugin-sourcemaps');
module.exports = function(/* defaults */) {
var src = new Funnel('src', {
destDir: '/src'
});
var tests = new Funnel('tests', {
destDir: '/tests'
});
var srcAndTests = new MergeTrees([src, tests]);
var distSrcAndTests = typescript(srcAndTests, {
workingPath: __dirname,
rootPath: __dirname,
buildPath: __dirname
});
var distSrc = new Funnel(distSrcAndTests, {
srcDir: '/dist/src',
destDir: '/dist/src'
});
var distBundle = new Rollup(new MergeTrees([src, distSrc]), {
rollup: {
input: 'dist/src/index.js',
plugins: [sourcemaps()],
output: [
{
file: 'dist/simple-html-tokenizer.js',
format: 'umd',
sourcemap: true,
name: 'HTML5Tokenizer'
},
{
file: 'dist/es6/index.js',
format: 'es',
sourcemap: true
}
]
}
});
var distTests = new Funnel(distSrcAndTests, {
srcDir: '/dist/tests',
destDir: '/dist/tests'
});
var distTestsUmd = new Rollup(new MergeTrees([tests, distTests]), {
rollup: {
input: 'dist/tests/tokenizer-tests.js',
external: ['simple-html-tokenizer'],
plugins: [sourcemaps()],
output: [
{
globals: {
'simple-html-tokenizer': 'HTML5Tokenizer'
},
file: 'dist/tests/tokenizer-tests.js',
format: 'umd',
sourcemap: true
}
]
}
});
var tslintTests = new TSLint(srcAndTests);
var allTests = concat(new MergeTrees([tslintTests, distTestsUmd]), {
inputFiles: ['**/*.js'],
outputFile: '/dist/tests/tests.js'
});
var testSupport = new Funnel('tests', {
files: ['index.html'],
destDir: '/dist/tests'
});
var qunit = new Funnel('node_modules/qunit', {
srcDir: 'qunit',
files: ['qunit.js', 'qunit.css'],
destDir: '/dist/tests'
});
var distTypes = new Funnel(distSrc, {
include: ['**/*.d.ts'],
srcDir: '/dist/src',
destDir: '/dist/types'
});
var dist = new MergeTrees([
distBundle,
distTypes,
allTests,
testSupport,
qunit
]);
return new Funnel(dist, {
srcDir: '/dist',
destDir: '/'
});
};