-
Notifications
You must be signed in to change notification settings - Fork 11
/
ember-cli-build.js
59 lines (50 loc) · 1.61 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
'use strict';
const GlimmerApp = require('@glimmer/application-pipeline').GlimmerApp;
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const Funnel = require('broccoli-funnel');
const mergeTrees = require('broccoli-merge-trees');
const concat = require('broccoli-concat');
const { map } = require('broccoli-stew');
module.exports = function(defaults) {
const isProduction = process.env.EMBER_ENV === 'production';
function handlebars() {
return {
resolveId(id) {
if (id === 'handlebars') {
return 'node_modules/handlebars/lib/handlebars/compiler/base.js';
}
}
};
}
let app = new GlimmerApp(defaults, {
rollup: {
plugins: [
handlebars(),
resolve({ jsnext: true, module: true, main: true }),
commonjs({
namedExports: {
'node_modules/handlebars/lib/index.js': ['parse'],
'node_modules/decko/dist/decko.js': ['debounce', 'bind']
}
})
]
}
});
let monacoMode = isProduction ? 'min' : 'dev';
let monaco = new Funnel(`node_modules/monaco-editor/${monacoMode}/vs`, {
destDir: 'vs'
});
let libs = new Funnel('node_modules/@glimmer', {
include: ['*/dist/**/*.d.ts', '*/package.json']
});
libs = map(libs, (content, relativePath) => {
relativePath = `node_modules/@glimmer/${relativePath}`;
return `typings['${relativePath}'] = ${JSON.stringify(content)};\n`;
});
libs = concat(libs, {
header: `window.typings = {};\n`,
outputFile: 'types.js'
});
return mergeTrees([app.toTree(), monaco, libs]);
};